.. (לתיקייה המכילה) | ||
If iterative deepening timed out, can we finish this recursive check? | |
No. Quit the recursive method as quickly as possible, we consider this run of minimax invalid. |
What should we print on stage 2c in the workflow (If a player won, print the winner and make game as inactive) | |
"[player] won! Game over." When player is either "White" or "Black". In case of a tie, print: "It's a tie! Game over." |
Suppose we run iterative deepening for a computer player, and it times out before we finish with steps=1. | |
Any legal move is OK in this case. |
Should we check for number overflows in parameters? | |
We will not check with parameters that cause overflows. We may check with any number that does fit in a word, though. |
Why are we asked to print the time it takes the computer to make a move? | |
The time given in start command is a hard limit. Thus, if for example the computer has 5 seconds to return a move, we can't use all of this time for iterative deepening, since returning from all the recursive calls takes some time. keep some spare-time for this. E.g. instead of running the Iterative deepening for 5 seconds, run it for 4.5 seconds, then you have 0.5 seconds to quit the recursion and and apply the move. UPDATE: you are allowed to spare time for recursion unwinding, but you don't have to (if you start to return from the recursion only when the time is up - it's OK). the important part is making a move and printing the time taken, even if it is 5.0 all the time. |
How should we handle input while printing the board? | |
Input is accepted ONLY in section 3 (the program prints "$ " and waits for input), so no input is allowed while printing the board (section 2) / executing a command (section 4) / ETC. Pay attention that input IS allowed when the computer calculates the best move (section 3.a) |
Can we assume that command's arguments are valid? | |
No. you must validate all arguments and print the "cannot execute" error if any of them is invalid. invalid arguments include: * in start: player that is not h or c * in start: player time that contains characters other than digits (0-9) * in move: any invalid move you can ignore extra arguments (e.g. you can accept "start h 5 c 5 banana pineapple" as a valid command). UPDATE: Trailing spaces do not invalidate a command (so "start h 5 c 5 " is valid). |
If current player has no valid moves, what should it do? | |
If current player (human or computer alike) has no valid moves, it should intiate a move from 00 to 00. The game should validate that there is indeed no valid move, and switch player. |
in what base should we input / output numbers? | |
Seconds are ALWAYS decimal (start h 9 c 60 is legal, white gets 9 seconds, black gets 1 minute) Board cells are ALWAYS octal (cells are from 00 to 77) WP is ALWAYS octal (it is 9 in the example - it's a mistake) |
Should we accept upper-case commands like "STOP"? | |
All input will be lower-case. You can handle "STOP" as you see fit. |
We were not able to finish HW3 in time. Can we use someone else's code? | |
No, that will be considered as cheating (and not only in this course) what you should do is implement a "mock": write a subroutine that: 1. Has the same name like the one in HW3 and 2. Receives the same arguments like the main subroutine in HW3 and 3. Returns a valid move, without the considerations of the subroutine from HW3 mocks are used when you want to use a function you don't have, and don't really care about its return value, only what it looks like (in this case, a valid move) and you want some code to compile with it. Note: this will cause in a minor points fine and will get minus 5 points for using this option. |
How many Enters should we print between any two lines? and what to print in case of ...? | |
The text that you print should follow these guidelines: * Informative - The text should represent the information that you want to convey (for example: if there is a tie, please include the word "tie" in your text) * Clean - You must not print two different texts in the same line, or stop printing one text in the middle and start printing another. The exact text that you use is less of a concern. |
Can we limit the Iterative Deepening so that we won't run out of stack space? | |
Yes, you can tweak the ID algorithm so that if it finished the calculation without timeout for some depth value (say, 11), it will choose to make that move and not search deeper. |
Does "stop" command finish the application's run? I.e. should we perform "halt" operation after "stop" command? | |
No. "stop" command does finish the game, but you can receive another "start" command afterwards. |
We were told we can ignore words coming after a legal command. If a legal command following non-space character was entered, | |
No. You can ignore only words coming after a legal command. Thus, "stop234" is illegal but "stop 234" is. |