See the assignment turn-in page (last modified on 21 January 2003) for instructions on turning in your assignment.
You are not required to make any of the moves 1 through 4 as soon as they are possible; when more than one move is possible, you may choose any one of them. Play ends when all the cards have been dealt. You win if there's a single pile of cards left.
The first non-blank line the program reads from std-in is the sequence of cards dealt, with the left-most card being the first card dealt and the right-most card being the last dealt. This line must contain 52 cards.
The remaining 1 <= n <= 52 non-blank lines the program reads from std-in represent the tableau at the end of the game, in left to right order (that is, the second line read from std-in is the leftmost pile and the nth line read from std-in is the right-most pile. Within each line representing a pile, the left-most card is the card on the top of the pile and the right-most card is the card at the bottom of the pile. Here is an example input:
ad2d3d4d5d6d7d8d9dtdjdqdkd as2s3s4s5s6s7s8s9stsjsqsks ac2c3c4c5c6c7c8c9ctcjcqckc ah2h3h4h5h6h7h8h9hthjhqhkh ad2d3d4d5d6d7d8d9dtdjdqdkd as2s3s4s5s6s7s8s9stsjsqsks ac2c3c4c5c 6c7c8c9ctcjcqckc ah2h3h4h5h6h7h8h9hthjhqhkh
Any input that doesn't follow this format is syntactically invalid and should terminate the program with an informative error message.
A tableau is winning if it contains the smallest number of piles possible for the given deal; a tableau that contains more than the smallest number of piles possible is a losing tableau. If the given tableau can be derived from the given deals but is a losing tableau, the program should output to std-out a winning tableau. If the given tableau is both derivable and winning, the program should output nothing.
gen-game
program in /export/home/class/cs-509/pa3
generates some input you can use to
test your program. The command format is
gen-game
[ -b
]
By default, gen-game
writes to std-out a correct but not necessarily
optimal output. The -b
command-line option causes gen-game
to write
incorrect output.
This page last modified on 4 March 2003.