Coder Social home page Coder Social logo

vanilla-js-tric-trac's Introduction

๐ŸŽฒ Vanilla JS Tric-Trac

Vanilla JS implementation of the Backgammon variation Tric-Trac.

Rules

  • The game has two players: white and black.
  • Each player has 15 checker.
  • The board is a regular backgammon board.
  • All checkers are initially placed outside board.
  • The game uses two dice.
  • The lower number of the dice must be plaied first.
  • If the lower number of the dice cannot be played, the turn switches.
  • If a player rolls a double (e.g. 1 + 1), the number is played four times (e.g. 4 * 1).
  • If a player rolls a tric-trac, the player plays 2 * 1 & 2 * 2 & 2 * 5 & 2 * 6.
  • If a player rolls a 3 and a 4, the player is allowed to move backwards.
  • Each player starts in their 1st quarter.
  • A player can only move dice to the 2nd and 3rd quarter, if all player's dice are on the board.
  • A player can only move dice into the 4th quarter, if mo more dice are in the 1st quarter.
  • All dice in the 4th quarter cannot be moved within that quarter.
  • All dice in the 4th quarter need to be thrown out with an exact number.
  • A single checker in a row is unprotected and can be thrown out by the competitor.
  • Two or more checker in a row are protected and blocking this row for the competitor.
  • A checker that had been thrown out by the competitor must be brought in before making other moves.

Checker states:

  • Initial: The checker hasn't been brought on the board yet or had been thrown out by the competitor.
  • Progress: The checker is currently on the board.
  • Finished: The checker had been cleared from the board by the player.

Dice states:

Roll Move
1 | 1 4 * 1
1 | 2 tric-trac
1 | 3 1 & 3
1 | 4 1 & 4
1 | 5 1 & 5
1 | 6 1 & 6
Roll Move
2 | 1 tric-trac
2 | 2 4 * 2
2 | 3 2 & 3
2 | 4 2 & 4
2 | 5 2 & 5
2 | 6 2 & 6
Roll Move
3 | 1 1 & 3
3 | 2 2 & 3
3 | 3 4 * 3
3 | 4 3 & 4
3 | 5 3 & 5
3 | 6 3 & 6
Roll Move
4 | 1 1 & 4
4 | 2 2 & 4
4 | 3 3 & 4
4 | 4 4 * 4
4 | 5 4 & 5
4 | 6 4 & 6
Roll Move
5 | 1 1 & 5
5 | 2 2 & 5
5 | 3 3 & 5
5 | 4 4 & 5
5 | 5 4 * 5
5 | 6 5 & 6
Roll Move
6 | 1 1 & 6
6 | 2 2 & 6
6 | 3 3 & 6
6 | 4 4 & 6
6 | 5 5 & 6
6 | 6 4 * 6

tric-trac = 2 * 1 & 2 * 2 & 2 * 5 & 2 * 6

vanilla-js-tric-trac's People

Contributors

nielslange avatar

Watchers

 avatar  avatar

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.