Advertisement

Big2 card game AI

Started by October 16, 2005 11:48 PM
0 comments, last by kevmo 19 years, 1 month ago
Big2 is very popular in Asia. It is played by 4 players. Here is the place teaches you how to play Big2: http://www.pagat.com/climbing/bigtwo.html I want to make a bot that can play Big2. Any idea to make the bot run very fast and has certain level of skill(dont too stupid)? I need to run around 4000 bots in the concurrently in no more than 5 seconds to process each turns,is that possible? regards, Martin
As a side note, this game sounds very similar to the game that I typically call 'Capitalism' when I play with my friends. This is just another of the many names that the game has.

If I were you, I would start by making a framework for playing the game (unless you already have one that has an API for adding in a bot). A simple framework includes a game state class, a player interface, and the main program which controls the flow of everything. The main program initializes the game state class (deals the cards). It then goes into a loop for the game. Each step of the game, when a player needs to make a move, it asks the game state class for a list of legal moves for the player. It enumerates this list, and hands it off to the player interface. The player interface picks a move from the list to perform, which the main program hands back to the game state class. The game state updates itself with the move, and the main program moves onto the next player.

At this point, you would implement a HumanPlayer class from the player interface to test your framework. At this point it is easy to try different strategies for bots. You could make a RandomBotPlayer class that simply chooses a random element from the list that is given to it. You could try using some simple heuristics for another bot, such as always playing the lowest card in the move list. I am very out of practice for the game, so I would not be able to suggest other heuristics for you. I think using heuristics would be the best approach however, because a) minimax won't work, each player is working with incomplete information and b) heuristics are fast - they typically involve a few (100 is still a few in terms of processing time) if statements for deciding which move to pick.

To test your bots, modify your main program to loop for a large number of games, and take statistics on how your bots perform. You can then use these to tell what works, and what doesn't.

This topic is closed to new replies.

Advertisement