Backgammon game. Rules

Coefficients table
1. «Марс»/«mars»: K = 2.
2. «Кокс»/«coke»: К = 3.
3. «Домашний Марс»/«Home mars»: К = 4.
4. Single Game: К = 1.
5. Termination of the game before the end of the game (leave the table, «surrender» function, long-term connection loss, inactivity within the turn (game timer): К = 2.

The winnings is calculated by the formula:
S = K * B,
where S – winnings, К - coefficient, B – bet. The winner is awarded a winnings including a commission of 5% of the amount.

Basic concepts and game rules
«Dice» - cubes.
«Head» - checkers at their initial positions.
«Home Board» - it is the last quadrant your checkers move to before they are borne off.
«Doubles» - two thrown dice with identical numbers on their upper faces.
The object of the game is move all your checkers into your own home board and then bear them off. The first player to bear off all of their checkers wins the game.
To start the gameeach player rolls one die. Whoever drops more points will go first. If the game is not the first, the priority of the move belongs to the player who won in the previous game.
During the game, the players take turns to move the checkers along the playing edge of the board for a certain number of lines (holes), according to the dropped number of points towards their Home board.
From the head within one move you can take only one checker, except when a combination of numbers comes up: 3х3, 4х4 и 6х6.
If a doubles fall on the dice, the player can make four moves by moving one, two, three or four checkers on as many spaces as the number of one dice shows.
It is forbidden to put six (or more) checkers in a row (blocking the opponent's move) until at least one of the opponent's checkers reaches his Home board.
Once a player has moved all of his checkers into his home board, he may commence bearing off in accordance with the points dropped on dice. The first player to bear off all of their checkers wins the game.
If player bore off all of their checkers and opponent has not borne off any of his checkers, the winner scores a “Mars”. A gammon is worth twice bet.
If player bore off all of their checkers and opponent still has a checker in the first quarter of the board (in the "head" area), the winner scores a ”koke”, which is worth triplebet.
“Home Mars” is the rarest situation in which the loser managed to bring all his checkers into the Home Board, but did not bear off a single one, while the opponent has borne off all of his. This alignment increases the coefficient to 4, i.e. the winner receives a win of four bets.
If the player decides to leave the table before the end of the game, the win is awarded to the opponent taking into account the coefficient k = 2, i.e. in the amount of two bets.