User Tools

Site Tools


lab_5

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

lab_5 [2018/10/09 07:29]
hutch
lab_5 [2018/10/09 07:38] (current)
hutch
Line 53: Line 53:
  
 Notes: ​ Notes: ​
-  * For the pseudocode shown below, **choice** is a global variable that will hold the move computed by minimax. Minimax must return at least a score because that is how you build the move-score table recursively. However, minimax must also compute the move because it is associated with the score. So, when doing the max calculation for example, you find the index of the highest score in the list and then save the move associated with that score in **choice**. **choice** will be overwritten many times as minimax executes but that is OK. The only move you care about is the move associated with the max score at the first call of minimax. That will also be the last time that **choice** is written so it will contain the move you care about - the move associated with the highest score (assuming that you are the player).+  * For the pseudocode shown below, **choice** is a global variable that will hold the move computed by minimax. Minimax must return at least a score because that is how you build the move-score table recursively. However, minimax must also compute the move because it is associated with the score. So, when doing the max calculation for example, you find the index of the highest score in the list and then save the move associated with that score in **choice**. **choice** will be overwritten many times as minimax executes but that is OK. The only move you care about is the move associated with the max score at the first call of minimax. That will also be the last time that **choice** is written so it will contain the move you care about - the move associated with the highest score (assuming that you are '​X'​).
   * move can be implemented as a struct containing a row and a column.   * move can be implemented as a struct containing a row and a column.
   * You can store your moves and scores in two arrays: a moves array and a scores array. Use one index for both.   * You can store your moves and scores in two arrays: a moves array and a scores array. Use one index for both.
lab_5.txt ยท Last modified: 2018/10/09 07:38 by hutch