Santase-ai is an interface for different artificial intelligence agents for the game santase (also known as sixty-six). It is useful in two cases:
- You need out of the box artificial intelligence agent for the game of santase. You can use the interface santase-ai provides and you can switch to different implementations easily.
- You want to create an artificial intelligence for the game of santase. You can use santase-ai to skip writing common logic such as checking for user input and focus on writing the AI.
This project includes two implementations for such agents.
Always plays random valid moves. This is more for demonstration purposes than actually useful.
This is more advanced agent that uses monte carlo methods to search for good moves. If you are interested of how this works I recommend looking into [1] [2] [3].
Here is how to use this library if you want to use an AI out of the box:
// create initial hand for the ai
hand := santase.NewHand()
hand.AddCard(santase.NewCard(santase.Nine, santase.Diamonds))
hand.AddCard(santase.NewCard(santase.King, santase.Spades))
hand.AddCard(santase.NewCard(santase.Queen, santase.Diamonds))
hand.AddCard(santase.NewCard(santase.Nine, santase.Spades))
hand.AddCard(santase.NewCard(santase.Ace, santase.Spades))
hand.AddCard(santase.NewCard(santase.Ten, santase.Hearts))
// create trump card for the game
trumpCard := santase.NewCard(santase.Ten, santase.Clubs)
// is the opponent first to move
isOpponentMove := true
// create a game
game := santase.CreateGame(hand, trumpCard, isOpponentMove)
// specify which agent to use for choosing moves
game.SetAgent(ismcts.NewAgent(5.4, time.Second))
// update the game with the move the opponent makes
game.UpdateOpponentMove(santase.Move{Card: santase.NewCard(santase.Nine, santase.Hearts)})
// start the AI
move := game.GetMove()
fmt.Println(move.Card)
// finish the first round by updating what card the AI draws
game.UpdateDrawnCard(santase.NewCard(santase.Jack, santase.Hearts))
// Output:
// 10♥
To create your own agent all you need to do is implement the Agent
interface:
type Agent interface {
GetMove(*Game) Move
}
Your agent will be called whenever it is time to play a move with a reference to the game state, from which information about the game can be obtained. You can see how the two agents are implemented for more information. The random agent is pretty simple.
santase-gui is a graphical interface that uses santase-ai for the artificial intelligence part. You can use it to test how your AI compares to different ones.
This library is licensed under the MIT License.