MetaWar

Warbot is a game that puts a meta spin on the classic card game that we all know and love.

The game mechanics are pretty simple. There are two players, each with money and a face down, shuffled deck of cards. The goal is to take all your opponents money. One player has a dealer chip. Each turn, the players ante in $1, draw a card, and look at it. Then the player with the dealer chip places a bet based on how likely they think it is that they have the high card. Based on the dealer’s bet, the second player can either choose to call the bet, or fold. If they fold, then the dealer keeps the ante, but if they call then both cards are revealed and the player with the higher card takes the entire pot. Then the dealer chip is rotates, and the game repeats. If the two cards are equal, then the round is a push and both players keep their bets.

Now let’s make it meta. Instead playing this game, with Warbot you create a bot to play the game for you. In realtime. And the bot plays the game fast. Really fast. Let me explain how it works…

When you start the game your bot has no strategy. Each round it antes and bets zero. To give your bot some strategy, you fill out the body of a Javascript function:

function(card, coins) {
    var bet = 0;
    // do strategy here
    return bet;
}

card is the value of the card you drew (an integer between 1 and 13 inclusive). coins is the amount of money that you have to bet with. The return value of the function is your bet (it has to be an integer between 0 and coins inclusive).

Since it’s impossible to lose if you have a 13, a very naive strategy might be…

// Go all in on a 13, else fold.
function(card, coins) {
    if (card === 13) {
        return coins;
    }
    return 0;
}

You create the strategy for your bot in realtime, and since the starting strategy sucks, you’ll want to code fast. As you get more experience, you can create multiple different strategies for your bot, but you can only have one strategy active at any given time. On the backend we’re taking the strategy of both bots, and playing them at, oh, you know, like 1000 rounds/minute. The first player unable to ante loses. Have fun :)

If you’re interested in the roots of this idea, check out the first iteration, which applied the same idea but to Tic Tac Toe.

 
0
Kudos
 
0
Kudos

Now read this

[notes] The Innovator’s Solution

The Innovator’s Solution: Creating and Sustaining Successful Growth (2003) by Clayton M. Christensen and Michael E. Raynor # Buy from Amazon NOTE: Bewarned, these notes are un-edited, un-revised, and un-styled. I plan on cleaning them up... Continue →