Author | Message |
---|---|
BryanYeh
Posts: 38
|
Posted 17:42 Apr 29, 2014 |
function minscore (role,action,state) {var opponent = findopponent(role,game); var actions = findlegals(opponent,state,game); var score = 100; for (var i=0; i<actions.length; i++) {var move; if (role==roles[0]) {move = [action,actions[i]]} else {move = [actions[i],action]} var newstate = findnext(move,state,game); var result = maxscore(role,newstate); if (result<score) {score = result}}; return score} This is the minscore from the minimax from chapter 6. What is move = [action,actions[i]] and move = [actions[i],action] difference and what is it suppose to return?
Last edited by BryanYeh at
20:18 Apr 29, 2014.
|
rabbott
Posts: 1649
|
Posted 21:07 Apr 29, 2014 |
I'm not sure. Here's my guess. It looks like It appears that the assumption is that there is only one opponent. So the combined move is a pair of The way a pair of Last edited by rabbott at
21:10 Apr 29, 2014.
|
rodthung
Posts: 14
|
Posted 01:22 Apr 30, 2014 |
Here is what I did create list of move : List<Move> = move 1. And if the role that we are considering is our player ( Role == Roles[0]) we add move to the list of move by move.add(action) //our move move.add(action.get(i)) // follow by the opponent move 2. else if the role is opponent move.add(action.get(i)) // the opponent move move.add(action) // follow by our move PS. Before adding the move you have to make sure that we not adding the same move with the opponent I think this would help
|