changelog shortlog tags changeset files revisions annotate raw

bin/Data Structures: The Card Game

changeset 368: a1c4ba7f2fe0
parent:151dead8cc5b
child:751d42400a9e
author: harrisonmetz (openid-provider.appspot.com/harrisonmetz)
date: Mon Dec 07 02:29:47 2009 +0000 (2 years ago)
permissions: -rwxr-xr-x
description: medit/bin/Data Structures: The Card Game chebang=#!/usr/bin/env .wiki cont=This is a card game, created by Gregor Richards and Harrison Metzger. It is absurdly complicated.

== The data structures

=== Deck
The game is played with two standard 52-card decks.

=== Queue
In the center of the table is a queue. The queue has a maximum of five cards, and moves in a predetermined direction. The stack of cards is placed at the beginning of the queue to indicate its direction. The cards in the queue are face-up.

=== Stacks
Each player has a stack. The stack is face-up in front of the player.

=== Hands
Each player has a five-card hand.

=== Arrays
Each player has three arrays. The objective of the game is to get all three arrays to have every value (2, 3, 4, 5, 6, 7, 8, 9, 10, J, Q, K) in order. The lists may start with any value, but must loop back 'round to one less than that value.

== Setup

At the beginning of the game, the deck is placed to one side. All five cards of the queue are set out, as are a single card for each stack, and each player's five-card hand.

== Gameplay

The game is a turn based game. Each players turn can be divided up into phases.

=== Phase 1 (Inserting into arrays)
During this phase, the player can use any card from their hand, pop for any of the 2 stacks, or remove the head of the list to place the proper next card on his or her own array. An array can only be started from a card in the player's hand. Should an array become complete on a card move, the array is turned upside down (so all cards are now face down) and will be shuffled back into the deck at the end of the turn.

Should the player use all 5 cards in their hand, they are allowed to redraw all 5 cards. Likewise, should all 5 cards in the queue be used, it will be refilled here.

Alternatively, should the player be unable to play any card (this is verified by showing all cards in the hand to the opponent) they can chose to burn 4 out of their 5 cards. This forcebly ends phase 1 (although it would be ended automatically as there are no moves, but we want to be explicit incase burning is allowed if moves are a possibility to expand the scope of the rule)

=== Phase 2 (Discards)
Phase 2 begins by "burning" the head of the queue. The player removes the head of the queue and places it on the to-be-shuffle-back-in pile.

The player then must place one of their cards on the stack.

Should the player have any cards in their hand and the queue not be full, they can optionally put cards from their hand into the queue.

=== Phase 3 (Replenish)

Should any arrays be closed they, along with the garbage pile are shuffle back into the deck.

At this phase should the queue be less than 5 cards, it is replenished by drawing from the deck.

Also, the players hand is replenished to 5 cards.

An invariant is that on the beginning of each players turn, both players have 5 cards in their hand and the queue is filled with 5 cards.
1#!/usr/bin/env .wiki
2This is a card game, created by Gregor Richards and Harrison Metzger. It is absurdly complicated.
3
4== The data structures
5
6=== Deck
7The game is played with two standard 52-card decks.
8
9=== Queue
10In the center of the table is a queue. The queue has a maximum of five cards, and moves in a predetermined direction. The stack of cards is placed at the beginning of the queue to indicate its direction. The cards in the queue are face-up.
11
12=== Stacks
13Each player has a stack. The stack is face-up in front of the player.
14
15=== Hands
16Each player has a five-card hand.
17
18=== Arrays
19Each player has three arrays. The objective of the game is to get all three arrays to have every value (2, 3, 4, 5, 6, 7, 8, 9, 10, J, Q, K) in order. The lists may start with any value, but must loop back 'round to one less than that value.
20
21== Setup
22
23At the beginning of the game, the deck is placed to one side. All five cards of the queue are set out, as are a single card for each stack, and each player's five-card hand.
24
25== Gameplay
26
27The game is a turn based game. Each players turn can be divided up into phases.
28
29=== Phase 1 (Inserting into arrays)
30During this phase, the player can use any card from their hand, pop for any of the 2 stacks, or remove the head of the list to place the proper next card on his or her own array. An array can only be started from a card in the player's hand. Should an array become complete on a card move, the array is turned upside down (so all cards are now face down) and will be shuffled back into the deck at the end of the turn.
31
32Should the player use all 5 cards in their hand, they are allowed to redraw all 5 cards. Likewise, should all 5 cards in the queue be used, it will be refilled here.
33
34Alternatively, should the player be unable to play any card (this is verified by showing all cards in the hand to the opponent) they can chose to burn 4 out of their 5 cards. This forcebly ends phase 1 (although it would be ended automatically as there are no moves, but we want to be explicit incase burning is allowed if moves are a possibility to expand the scope of the rule)
35
36=== Phase 2 (Discards)
37Phase 2 begins by "burning" the head of the queue. The player removes the head of the queue and places it on the to-be-shuffle-back-in pile.
38
39The player then must place one of their cards on the stack.
40
41Should the player have any cards in their hand and the queue not be full, they can optionally put cards from their hand into the queue.
42
43=== Phase 3 (Replenish)
44
45Should any arrays be closed they, along with the garbage pile are shuffle back into the deck.
46
47At this phase should the queue be less than 5 cards, it is replenished by drawing from the deck.
48
49Also, the players hand is replenished to 5 cards.
50
51An invariant is that on the beginning of each players turn, both players have 5 cards in their hand and the queue is filled with 5 cards.