|Memory system||Cell based|
|Major implementations||Python 3|
The Unicode playing cards (U+1F0A1 to U+1F0DF), with the exception of the knight cards encode Shuffle's commands. Cards in this range that are "reserved" are interpreted as jokers. All other characters are comments.
The two decks are separated by two consecutive line-breaks. Everything before the double line-break is Player One's deck. Everything after is Player Two's. If a character is not a command, it is not put into the deck.
The cards are put into the decks in the order they appear in script, with the first cards going on the top.
Cards can be used more than once, and there does not need to be a full deck.
There are three types of syntax errors in Shuffle.
- not enough decks defined; occurs when there is no double line-break.
- invalid deck split; occurs when there is more than one double line-break
- deck contains no cards; occurs when there is no valid cards in at least one deck
Shuffle takes the suits of the two cards which are played as a command. The commands are as defined in the table bellow. The suit on the left is Player One's card, the suit on top is Player Two's.
|Spade||Move pointer to the right.||Move pointer down.||Move pointer up.||Move pointer to the left.|
|Heart||If the current cell has a value of zero, interpret the next command as NOP.||Interpret the next n commands as NOP. Where n is the value of Player One's card||Interpret the next command as NOP.||If the current cell has a value of zero, interpret the next n commands as NOP. Where n is the value of Player One's card|
|Diamond||Subtract the value of Player One's card from the current cell||Add one onto the current cell||Subtract one from the current cell||Add the value of Player One's card to the current cell|
|Club||Get user input in the form of an 8-bit character and save the value to the current cell.||Output the value of the current cell as an int.||Output the value of the current cell as an 8-bit character.||Get user input in the form of an 8-bit unsigned int and save the value to the current cell.|
If a joker is played (and is not interpreted as NOP), the program terminates.
At the beginning of each round, both players will play the card on the top of their deck. These two cards are then run as instruction. Whichever player has the higher value card gets both of the played cards added to the bottom of their deck with the higher valued card on the bottom. The next round is then played.
In the event that both players play cards of the same value, each player forms a "stakes" pile. The two players then will add cards from the top of their deck to the bottom of their stakes pile until they have placed three cards each. A player will not add a card to their stakes if it is their last card. The six (three from each player) cards added to the stakes do not have their commands run.
Each then adds one more card to the bottom of their stakes. These last two cards are run. The values of the two most recently placed cards are then compared. Whoever has the higher value card gets the stakes piles added onto the bottom of their own; with the winning stake pile under the losing pile. The next round is then played.
If the cards once again have the same value, then the players repeat the tie-breaking process without clearing the stakes piles. This continues until a winner is decided, or until a player runs out of cards.
End of program
When one of the two players run out of cards, the program terminates.
Prints "Hello" with a trailing new-line
1 byte cat
Gets a char input, then outputs it
Exits the program on startup
Found by reading this paper: http://math.pugetsound.edu/~mspivey/War.pdf
I have no life.