Durak is a Russian card game and here I programmed it to play with the computer. It is played with a deck of 36 cards. The deck is shuffled, and each player receives six cards. The top card on the remaining deck is made visible and placed at the bottom of the deck at a 90 degree angle. This determines the trump suit.
The first player to attack is the one who holds the lowest trump suit in his hand. The attacker throws any card he wishes from his hand and the defender must beat this card. A card can be beaten by a higher card of the same suit or any card of the trump suit, unless the card is itself from the trump suit. In the latter case it can only be beaten by a higher trump.
If the defender cannot or does not want to beat the card of the attacker he must collect it and add it to his hand. If the defender beats the card the attacker can add another card of the same rank of one of the cards on the table. The defender must beat this card too. The defender cannot be attacked by a number of cards that exceeds the number of cards in his hand.
If the defender cannot beat one or more cards he has been attacked with he must collect all the cards at the table and add them to his han. If the defender succeeds to beat all the cards, these cards are discarded. In the next turn, the defender will attack.
If there are no cards left in the remaining deck the face-up trump card is taken by the person whose turn is to take cards. After this no more cards are taken and the game continues until one of the players gets rid of his hand. The person who remains with the cards is called Durak.
It is of course possible to play Durak offline if we download and save it to our local computer. Let's go and save it to the desktop.
$ cd ~/Desktop/
We can download it by cloning my online Git repository.
$ git clone https://github.com/ara-martirossyan/durak.git Cloning into 'durak'... remote: Counting objects: 160, done. remote: Total 160 (delta 0), reused 0 (delta 0), pack-reused 159 Receiving objects: 100% (160/160), 1.46 MiB | 1.05 MiB/s, done. Resolving deltas: 100% (91/91), done. Checking connectivity... done.
We also need to download the jQuery framework from the official website of jQuery. Click to download the compressed production jquery.min.js file of the latest version. Then rename it to jquery.min.js and move the renamed file to ~/Desktop/durak/js/ folder
mv ~/Downloads/jquery-3.2.1.min.js ~/Desktop/durak/js/jquery.min.js
Now we can open the ~/Desktop/durak/index.html file with any web browser and play Durak offline.