1 How to play
serve-singles
serve-couples
serve1
serve2
play

Rackgammon: Backgammon for Racket

David Van Horn <dvanhorn@ccs.neu.edu>

This package provides a distributed Backgammon game.

Report a bug.

1 How to play

 (require (planet dvanhorn/backgammon))

These instructions assume you know the rules of Backgammon.

You can either play in singles or couples mode. In either case, you need to run a "Backgammon Server".

From the command line:

Single player mode (starts server and plays):

racket -p dvanhorn/backgammon/self

Play:

racket -p dvanhorn/backgammon/play <name>

racket -p dvanhorn/backgammon/play -- [--ip <addr>] <name>

Serve 1 player mode:

racket -p dvanhorn/backgammon/serve1

Serve 2 player mode:

racket -p dvanhorn/backgammon/serve2

Example 2 player game on localhost:

racket -p dvanhorn/backgammon/serve2 &

racket -p dvanhorn/backgammon/play Mary &

racket -p dvanhorn/backgammon/play Jane &

Spawn a thread serving single (self-playing) games.

Spawn a thread serving coupled games, pairing together players on a first-come, first-served basis.

(serve1)  any/c
Serve single (self-playing) games.

(serve2)  any/c
Serve coupled games.

(play name [#:IP ip])  any/c
  name : string?
  ip : LOCALHOST = string?
Play a game under the given player name using the Backagammon server located at the given IP address.

To play a game between two players, call (serve-couples) to start the backgammon server. Then call (play "Player 1") and (play "Player 2"). If the backgammon server is on a different machine than the players, use the #:IP keyword argument to specify the IP address of the server. The players do not need to be on the same computer, but if they are, the calls to play should be in different tabs of DrRacket, or use launch-many-worlds.

To play a game using one player who controls the entire game, call (serve-singles), then call play as before.

When it is not your turn, you will see "Passive" displayed across the board. You are not able to modify the board, but you will see all changes as the opponent makes them. When the opponent defers to you, it will be your turn.

When it is your turn, you may roll the dice and move checkers around the board. To roll the dice, press "R". To select a checker, click on it. Once selected, it is attached to your cursor. Click again on an area of the board to place it.

When you’re done with your turn, press "D". This defers to the opponent and makes your board passive.

In a singles game, the opponent always and immediately defers back to you.

Just as on a real backgammon board, there is no checking of the validity of moves. It is up to the players, all of whom can see each move made, to enforce the rules of play.