Coder Social home page Coder Social logo

barbu's Introduction

New Game Protocol:
# This is the protocol for starting a game
PLAYER 2  <- indicates which position around the table you are sitting
as 2s 3s 4s 5s ... <- your hand
# Eventually we should have a player choose a game - that should happen here.
GAMENAME  <- name of the game
# Each player gets a chance to double.  Slightly different than actual
# barbu, you only get a chance to double once, if you are doubled after
# then you do not get another chance to re-double.
DOUBLING
1 DOUBLE 2 0
2 DOUBLE
3 DOUBLE 0
0 DOUBLE 3

# This is the protocol for trick-taking games
# (nullo, queens, barbu, hearts, last two, ravage, trumps)
TRICK <- indicates that we're starting a trick
0 ah
1 5h
PLAY  <- PLAY reminds you that it's your turn to play
>> 6h
kh  <- if this is barbu then the game is over

# This is the protocol for dominoes
0 9h
1 th
2 9s
3 PASS

# This is the protocol for ending a game
END 0 0 0 -18



Cards are specified as two character strings, the first character is rank and the second character is suit.
Ranks are 23456789tjqka
Suids are cdhs

Example cards:
kh - king of hearts
as - ace of spades
2d - two of diamonds


Ai protocol:

An Ai is first given the name of the game on a single line, current games right now are RAVAGE and LASTTWO.

After the game is specified the ai will be given its hand on a single line, 13 cards each separated by a space.
Example:
3h 6s 9c ks 2h kc td qd 5d 6h jh kh jd

After that will be 13 rounds, each round goes as follows:
The ai will receive a list of cards on a single line, each separated by a space.  These are the cards played by the other players so far this trick.  The cards are listed in the order they are played, so if the line is
kc ac
that means the player across from this ai lead with the king of clubs, the player to this ai's right played the ace of clubs, and now it is this ai's turn to play.
This ai should write the card it wants to play to stdout, followed by a newline.
After this the ai will receive a list of cards on a single line, each separated by a space.  These are the cards played by the rest of the players this trick.  The cards are listed in the order they are played.

An example of a few rounds:
Stdin > 4s ks as
Stdout< 9s
Stdin > 
Stdin > 8h
Stdout< jh
Stdin > 4h 6h

In this example there are two tricks.  This ai was last to play in the first trick.  The four of spades was lead and this ai followed with the nine of spades.  Since this ai was last to play in the trick there are no cards listed after its play.  Since the player to this ai's right won the trick it is the only one that plays before it in the second trick.  It leads with the eight of hearts, this ai follows with the jack, and then the remaining two players' cards are given on the last line.

After the 13 rounds another round may begin just as this one did with the name of the game on a single line.


BUILDING:
To build everything you'll need go and g++ installed.  Then just run make.bash.
Here is something you might try to see how things work:

./make.bash
./barbu \
--game ravage \
--permute \
--n 5 \
--player1 bin/jonai \
--player2 bin/jonai \
--player3 bin/davidai \
--player4 bin/davidai


barbu's People

Contributors

runningwild avatar davidgarthur avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Forkers

davidgarthur

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.