.. (לתיקייה המכילה) | ||
Did you update the homework after it was published? | |
Yes The input for CalcWP and CheckWin functions is now the player number by value in the stack and not the address to the label containing it Examples 1 and 3 were updated according to change in the CalcWP function |
are the examples result in decimal or octal ? | |
the board numbering system and the example output appears in decimal base for your convenience , PDP11 only know how to save data in octal base ( the "." operator is only cosmetic ) and because of that all your result are in octal base. |
From where should we run the program for dry question 4 ?( filling the stack) | |
you should fill out what is in the stack from the start of the program . |
During the minimax algorithm, for which player does calcWP calculate the WP for? | |
calcWP always calculates the WP for the player in the label "Player" (the player we are trying to find the optimal move for). For example, if "Player" contains "1", during the minimax algorithm you will always call calcWP with 1 as the second parameter. Please notice, that calcWP is the base case (stopping condition) of the recursive algorithm, so it's should only be used when the algorithm reaches maximum depth (defined in Steps) or there's a victory. In any other case, the value on the current recursive call is calculated according the value returned from it's children, if it's the player's turn (even depth) we take maximum over those values and if it's the adversary's turn (odd depth) we take minimum. |
What is the order of parameters passed by stack in the defined subroutines? | |
The order needs to be exactly as stated in the homework. For example, if in the subroutine table it's stated that it takes parameter A and parameter B, then those parameters are passed in that order to the stack, in other words, A will be pushed first and then B before calling the subroutine. please notice that if the subroutine has output in the stack then the output parameter will be the lowest in the stack - the first one to be pushed before any input to the subroutine. |
what should we do when one of the players has no moves to make in the current turn? | |
In that case, we skip his turn, because the player might have available moves to make later after the opponent has moved his pieces. Notice that even if we skip the turn, this still counts as a move for the player, in other words, it counts as part of the maximum number of steps in the minimax algorithm. |
Should calcWP return 20 in case of a win and -20 in case of a loss? | |
You are free to choose whether to check for win/loss in calcWP, according to what's easier for your implementation. |
What if the Optimal Move to make is not to make a move( for example the player chosen won already by the current status of the board) | |
you should return the WP as usual and the DstPos and SrcPos should be equal and point to a one of the players game pieces( we don`t care which one ) |
Should you check that the parameters to the function monPiece are legal ? or do you need to check them ? | |
You can assume that the parameters are legal , there is no need to check them . we send the the source and destination by value meaning we will send the index in the board for each of the parameters. |
What if there are no soldiers in the color you sent in the player label ? | |
You may assume that there will be at least one soldier that has the color we told you to check about. |