View previous topic :: View next topic 
Author 
Message 
songoku107723
Level: 85
Position: Registered User
Joined: 27 Sep 2008
Posts: 2
Kel: 3 [ Donate ]
Online Status: Offline

Posted: Sat Sep 27, 2008 4:11 pm Post subject: building triple triad card using minimax algorithm 


hello, i'm newbie, i want ask how if i want building triple triad card using minimax algorithm, can all of u help me to give some idea? by the way thanks...^^ 

Back to top 


Sleipnir
Level: 150
Position: Administrator
Joined: 10 Apr 2002
Posts: 4180
Kel: 3691 [ Donate ]
Online Status: Offline

Posted: Sun Sep 28, 2008 2:46 am 


Combinatorics isn't really my field, but Wikipedia filled me in on the details... so lets take a stab.
A bit more information would be useful  Are you implementing this in an actual game, or as a theoretical exercise (e.g. a Maths assignment)?
I'm assuming the Minimax you're talking about is the gametheory AI algorithm, so if you're building an actual game there will be a lot of other code to worry about first.
If you restrict yourself to the "Open" rule (where the AI can see the player's cards), and assume infinite computing resources (so that we don't need to worry about recursing over an arbitrarily large tree) then just construct a tree of all possible moves.
Then you can assign the leaf nodes a value of +/ 1 if a player wins/loses normally, 0 if it a draw, and +/ infinity if a player gets a perfect win/loss (entailing the winner to take all 5 of the losers cards).
Then you can just use the algorithm (given on Wikipedia, and i assume a number of other sources) to determine the best move.
Of course, in reality it is much more subtle than this, as the possible move tree will be quite large, you may need to limit the number of moves the AI looks ahead by.
The endgame scoring is also a bit more subtle  rather than assigning +/ 1, you probably want to assign different weights depending on which cards you win/lose.
For example, if using the rule where you keep whatever cards you flipped, you want to minimize the chance of losing your valuable cards while maximizing the chance of taking your opponents valuable cards.
HTH. 

Back to top 


songoku107723
Level: 85
Position: Registered User
Joined: 27 Sep 2008
Posts: 2
Kel: 3 [ Donate ]
Online Status: Offline

Posted: Sun Sep 28, 2008 4:44 am 


eemmm, i implementing this for an actual game for my final project at college, i was make the minimax tree, but get some confuse with how the AI can choose the best move for eliminating the player..., i restrict this game with open rule so it wiil be a game with perfect information as u say AI can see the player's cards.
by the way thank's for ur information... hehehe...^^
i wiil try what u say (assign the leaf nodes a value of +/ 1 if a player wins/loses normally, 0 if it a draw, and +/ infinity if a player gets a perfect win/loss (entailing the winner to take all 5 of the losers cards))
or u have some another idea..? hohoho....;p[/img] 

Back to top 


