mau-mau
v0.4.1
Published
Card game for 2 or more players, popular in Czech Republic, Germany and other lands
Downloads
16
Readme
Mau-Mau
Card play for two or more players known as Mau Mau, Mau-Mau, Prší and by other names. The players are dealt each a hand of cards and the first player, who got rid of all his/her cards, wins the game.
Install and Run
You need Node.js 0.12 or newer to play the game.
npm install mau-mau
./node_modules/.bin/mau-mau
Command-line interface
The script mau-mau
starts a new card game, interacting on the console.
One-based index of the winning player is returned as the program exit code.
Usage: mau-mau [option]
Starts a new mau-mau card game, interacting on the console. One-based
index of the winning player is returned as the program exit code.
Options:
-h, --help output usage information
-V, --version output the version number
-p, --players <integer|list> Player count (2-4 by default) or list
-m, --human <integer|random> One-based index of the human player or the
text "random" (nothing by default)
-s, --silent No console output (false by default)
-l, --language <locale> Translation of texts (env.LANG by default)
--continue-to-end <yes|no> Play until the last player remains with
some cards in his hand (yes by default)
--cards-per-player <integer> Number of cards that the players are dealt
(4 by default)
--players-per-deck <integer> Player threshold to add another card deck
(4 by default; 5 means another deck)
Player list is a comma-delimited list of player implementations: "human",
"smart", "average" and "poor" identifiers are available. A random
combination of "smart,average,poor" is the default.
Supported locales: "en", "de", "cs".
Usage examples
Runs an unattended game with four computer-controlled players:
mau-mau
Starts a game with four players, three computer-controlled ones and one human-controlled at a random position:
mau-mau --players=4 --human=random
Starts a game with two players, two first one human and the second one smart computer-controlled one, interacting German:
mau-mau --players=human,smart --language=de
Lets 50 games be played with a smart and poor player implementations and gather results for each player:
#!/bin/bash
WINS[1]=0
WINS[2]=0
for ((i = 0; i < 50; ++i)); do
mau-mau --silent --players=smart,poor --continue-to-end=no
WINS[$?]=$((${WINS[$?]} + 1))
done
echo "smart won ${WINS[1]} times, poor ${WINS[2]} times"
Rules
Only Czech rules are implemented so far:
- The German card deck with 32 cards is used.
- There can be 2 or more players. If there are more than four playes, an additional pack of cards will be used, and so on for every other four players.
- Each player is dealt four cards at the beginning and one card is dropped face up on the playing stack. The first player starts as if the last player had played this card - the rules for sevens and aces apply to him.
- Only one card of the same suit or of the same rank, that has the card on the top of the playing stack, can be played.
- If the player cannot play any card, he/she has to draw one new card.
- Playing an ace makes the next player skip his/her current turn and wait for the next one.
- Playing a seven makes the next player draw two cards and wait for the next turn.
- Playing a queen is possible on a card of any suit or rank and lets the player change its suit. The next player will play, as if there was a queen with the changed suit on the top of the playing stack.
- If there are no more cards in the drawing stack, the playing stack will be turned over, shuffled and used as another drawing stack, except for the last card on its top, which will stay as the top of the new playing stack.
- The first player, who got rid of all his/her cards, wins. The game caan be played to the end, until the last player remains with some cards in his hand.
Maintenance
Check the sources, build the debug version and test it regularly:
gulp
If you want to get the distribution files continuously updated and just
run the mau-mau
script to check out your progress, watch for the source
code changes and build the output in the background:
gulp watch-node &
./bin/mau-mau
If you want to release a new version, perform these steps:
- Build and test the release mode of the distribution files
- Update the revision history in README.md
- Bump the version number in package.json
- Commit the changes including the
dist
directory - Tag the sources by the new version number
- Push the changes and tags to Github
- Publish the NPM module to the NPM registry
- Post the test code coverage to coveralls
gulp --release
vi README.md
vi package.json
git add README.md package.json dist
git commit
git tag v0.1.1
git push
git push --tags
npm publish
gulp post-coveralls
Contributing
In lieu of a formal style-guide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Gulp.
Release History
- 2016-12-21 v0.4.1 Upgrade dependencies
- 2016-03-05 v0.4.0 Rename "dummy" computer player to "poor"
- 2016-03-05 v0.3.1 Fix playing engine of the smart computer
- 2016-02-01 v0.3.0 Make the game opening more random
- 2016-01-24 v0.2.1 Add an average player, improve the smart one Make the game more configurable
- 2016-01-18 v0.1.3 Improve choosing of the best card to play Add German and Czech locales
- 2016-01-17 v0.1.0 Initial release
License
Copyright © 2016 Ferdinand Prantl
Licensed under the MIT license.