Skip to content

sebastianriese/baghchal

Repository files navigation

bhagchal 0.1
An implementation of the bagh chal board game

Copyright 2012 Sebastian Riese

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

Author: Sebastian Riese <sebastian.riese.mail@web.de>

usage: baghchal [-astvhr] [-d NUM]

RULES
-----

The Board in its initial configuration is shown in Fig. 1. o denotes
an empty place, |, \, / and --- denote connections between the fields.

The two parties use different pieces: One of them plays the wolves or
tigers (T) the other plays sheep or goats (or whatever, S). The
parties move alternating.

The tigers have to movement possibilities: either along one of the
lines to an empty field, or jumping straight over a field occupied by
a sheep to an empty field. The sheep on the field inbetween is removed
from the game (eaten).

The moves of the sheep occur in two phases: As you can see there are
no sheep on the board initially, so first all 20 sheep are set, one
each turn, to the free board places. When all 20 sheep are set (when a
sheep is eaten it is not added back to that pool), sheep can move like
tigers, except they can not jump tigers or sheep.

The sheep win, if the tigers can not move any longer, the tigers win
if they ate 5 sheep.

The traditional implementation of the game is a piece of paper, on
which the board is drawn with a pen or pencil, twenty small stones
(sheep) and four larger ones (tigers).

T---o---o---o---T
| \ | / | \ | / |
o---o---o---o---o
| / | \ | / | \ |
o---o---o---o---o
| \ | / | \ | / |
o---o---o---o---o
| / | \ | / | \ |
T---o---o---o---T
Fig 1: Bagh-Chal board in initial configuration

THIS IMPLEMENTATION
-------------------

The major feature this implementation gains in comparison to the
pen-and-paper-and-stones variant is the availability of computer
adversaries, making it possible to play the game all alone.

With the -t/-s option you activate the AI for tigers/sheep. It is
possible to let the AI play itself (-st). To do so, you should also
give the -a option to see the board after each turn (it is usually not
displayed).

The playing interface in the commandline is currently not nice: though
with the -v option the board is beautifully ascii-arted to your screen
the turns are done by examining the numbered boards resulting from
possible moves and enter the number of the move you want to make.

In the game commandline the command u undoes the previous move, h
prints help (currently nothing) and q exits.

For more comfort while playing the Python/Tk frontend is strongly
recommended. It is invoked as tkchal.py and should be sufficiently
intuitive (except that the turns done by AI are shown immediately
after your turn, without showing the configuration after your turn,
okay not *immediately*; the AI usually takes its time, well it has to
consider a few hundred millions of possible board configurations).

BUILDING
--------

Build with
$ make

Install with
$ make install

By adapting PREFIX you may adapt the installation location (default
is ~/.local). The rights of the installed files will be -r-xr-xr-x,
if you don't like that, adapt INSTALL_MODE, for example:

$ make install PREFIX=/usr INSTALL_MODE=0550

About

An implementation of the Bhag-Chal board game

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published