Advertisement

cards AI

Started by November 22, 2003 12:46 PM
9 comments, last by zaidgs 21 years ago
can anyone help me with cards AI ??! i am a hobbiest, and i sometimes search internet for help. i have a slight expertise in AI as i made a simple chess engine, with alphabeta, verified null-move, iterative deepening,,,, etc. what matters is that now i want to make a game called "TRIX", i have not found anything about this game at all, and on card game on general as much i found about chess for example. this game if you dont know it is more like "HEARTS" in windows, although not much similar but the best match i found from popular card games. links or explanations are apreciated please........
?

Figure out how you would play and write the rules from there.

Dave Mark - President and Lead Designer
Intrinsic Algorithm - "Reducing the world to mathematical equations!"

Dave Mark - President and Lead Designer of Intrinsic Algorithm LLC
Professional consultant on game AI, mathematical modeling, simulation modeling
Co-founder and 10 year advisor of the GDC AI Summit
Author of the book, Behavioral Mathematics for Game AI
Blogs I write:
IA News - What's happening at IA | IA on AI - AI news and notes | Post-Play'em - Observations on AI of games I play

"Reducing the world to mathematical equations!"

Advertisement
i want it to have a "computer-style",
i mean i dont want it to use our usual logic.
i have already made a class to define game rules and stuff,
and want it to use the aproach of "foreseeing", somehow
like in chess, a game tree.
the problem as u must know is that its not a game of perfect
information, and we dont know the cards of opponents.
a friend before suggested to me a "points scheme"
ie. use certain points for different situations,
the problem with this style that its so much limited
to the thinking style of the programmer (ie. me)
but i want the computer to find BETTER solutions than i would
in the same solution, not imitate me, or emulate how a human thinks
so get to possibly
same soltion i (or a usual human player) would have got.
i want it to find a maximum gain, least risk, solution
based on game rules, and the randomity.
maybe this aproach is not suitable for card games,
maybe there are better aproaches,
can anyone guide me to the right track ??!
Hi Zaid;

Trix has already been implemented for the computer by a Jordanian team. I googled for it, but found nothing.

As for Trix AI, You might have to code 5 different algorithms, or maybe two (One for Trix and the other for the Q,K, Diamonds and Ltoosh).

Are you thinking of implementing a straightforward tricks game, or a variation? (e.g. complex Trix or Trix with a partner...etc)

If you can''t find the team I mentioned earlier, then maybe I can help you in this project.

Peace Out!
a straight forward one !!!!
n yes i googled but found nthn, thats my problem :S
no idea at all, i have some but need to know what works
best :S
My current project (which now is at at a stand-still, but basically is 80% completed) is a card game. Actually the AI was one of the biggest challenges for this project, except for the fact I had to learn how to work with the native Win32 API with its slow drawing functions...

The approach I used was to first program the actual game, at least the parts that did not require any kind of interferance from other players than the human. Then I sat down I began to think about what kind of AI I wanted. This was a very important step as it will determine how much work I'd have to put into it. I decided to use a method that basically generates a "desireability" for each card in a list of the possible cards to play.

Once I had the method established I began to think about how each card would be valued. In my game the objective is to get rid of the cards, but they need to be put out on the board in a certain order. Therefore the most simple system that can be used is the one which counts how much each option will affect the road to the objective of the game, often for multiple players. The implementation I settled for desireabilities for each card based on how many cards are left in the same category as the card, how many cards enemy cards that are blocked (a negative desireability to put), and how many own cards are blocked.

I hope this helps, good luck finding your approach!
Essentially it all boils down to the fact one must find his algorithms through analysis, planning and implementation. This is mainly due to the fact there is no universal way to do AI for most games.

[edited by - Unwise owl on November 24, 2003 4:33:12 PM]
Advertisement
And here is a link which provides a PDF about using game trees with games of imperfect knowledge (ie: cards)

http://citeseer.nj.nec.com/blair96perfect.html

Maybe some of the Poker AI literature might be of some help, at least with card and risk prediction.

http://www.cs.ualberta.ca/~games/poker/

AI Depot has this short thread on card games:

http://ai-depot.com/Dump/1032.html


Cheers,
Will

[edited by - RPGeezus on November 24, 2003 4:43:58 PM]
------------------http://www.nentari.com
You should definitely check out the Bayesian Poker Player developed by Kevin Korb. This handles the sort of problem that you want to deal with. Google it... there are several papers out there that should get you started.

Additionally, Ariel Bud was doing some interesting work on decision-theoretic advisors before he intermitted his PhD. Check out this paper for a starting point:

http://www.ai.mit.edu/conferences/aistats2001/files/bud159.ps


Cheers,

Timkin
i am working on reading the links suggested,
and i found few other ones.
to tell the truth nothing is clear,
i've been trying to understand how the
imp-minimax works, but in vain.
i am working on better understanding,
but on parallel, i have my own ideas,
some contradicting ones, that i'd like someone
who understands better than me to tell me what
seems to be better than the other.
in my own way, there are three main things to
decide, and i have listed them:

Option 1:
-form a large library of possible ways
a deal can be made
-at first throw, the possibilities count is
39C13 * 26C13 as C means combinations
which is = 8.4E16 ( or 8.4*10^16 )
-for each possibility make a perfect
information game tree and return a score,
and best card to be thrown.
-decision 1a:
-choose a card with highest occurence
ie. if Ace Spades is 6E16 times the
best move, while some other card is
1E16 times the best, then Ace Spades
is chosen.
-decision 1b:
-choose a card such that:
( AverageScore * Percentage )
is highest.
ie. :
suppose 8 ways (only) with results:
(1) Ace Spades 20
(2) Ace Spades 20
(3) Ace Spades 10
(4) Ace Spades 50
(5) Queen Clubs 50
(6) Queen Clubs 70
(7) King Hearts 80
(8) Jack Clubs 30
**now using decision 1a, the answer is
Ace Spades as it occured 4 times
**now using decision 1b:
Ace Spades: Avg:25 %:50 Rate:1250
Queen Clubs: Avg:60 %:25 Rate:1500
King Hearts: Avg:80 %:12.5 Rate:1000
Jack Clubs: Avg:30 %:12.5 Rate:375
so Queen Clubs is the answer.
-note: scores are really change in scores,
ie. if score was 200, and after the match
the new score is 210 then score for that move
is +10 , or if new score is 190 then score
for that move is -10, as change in score
is more relevent than absolute score,
especially for decision 1b.
-the big disadvantage for this algorithm is the
long long time it takes, the first throw needs
to make a 13-depth trees 8.4E16 times !!!!!
-this approach assumes "normal luck" to all
players.

Option 2:
-each player has all cards that are unknown
except those he is proved not to
-this is a pessimestic aproach, as
this means that the enemy has "good" luck,
while the player himself has "bad" luck.
-note: not relying on luck might cause loss,
as we should not forget a 99% chance of winning
for a 1% chance for loss.
-assume a HEARTS game where Queen Spades is not
down yet, and the player has Ace Spades.
Jack Spades is played, followed by Ten Spades,
and its your turn, there is 33% that he has
Queen Spades, but its still SO RISKY to leave
the Ace Spades in your hand, as u might be forced to throw it and eat all that is left.
so if you are so pessimistic and assume the
player has Queen Spades, you might cause urself
big loss.

Options 3: (optional change to options 1 & 2)
-this applies to the possibilities generation
in both options 1 & 2.
-this gives an optimistic flavor.
-its excluding from the possibilities what can
be guessed, but not proved.
-assume a HEARTS game. Queen Spades is not down
yet. player one plays Ace Spades, followed by
Jack Spades, then King Spades, then Ten Spades.
then we guess that the player one has
Queen Spades, and excude possibilites where
Queen Spades is with another player.
while its possible for that to be wrong,
it might make a possible gain.


[edited by - zaidgs on November 26, 2003 3:00:21 PM]
I don''t know enough about the game your trying to work on. Could you use state tables to deal with different game situations?

A little OT but: The layout of you''re posts remind me of someone using a Commodore 64 or old COCO. heh.

Cheers,
Will
------------------http://www.nentari.com

This topic is closed to new replies.

Advertisement