Gorilla It Out

To **Gorilla out** a hand each player has four areas for cards. The **taker's** four areas are labeled **to play**, **played**, **blocked**,
and **run**.
The **giver's** four areas are labeled **to play**, **played**,
**pitch**, and **keep**,

The algorithm starts with each player's whole hand in his respective **to
play** areas. During the first phase the team works through all four suits
and moves all cards out of the
**to play**
area into one of the different areas.

For phase one, go through each suit and do the following steps:

- If the
**taker**has cards in the suit:- If the
**giver**has cards in the suit**and**at least one of them is lower than the**taker's**top card then the**taker**puts his highest card in that suit into the**played**area and the**giver**puts the highest card that is lower than the**taker's**card into the the**played**area. The algorithm continues with the same suit. - If the
**giver**is out of the suit then the**taker**puts all of his remaining cards in the suit into the**run**area. The algorithm continues with the next suit.

- If the
- If the
**taker**is out of the suit then all of the**giver's**cards in the suit go into the**keep**area. The algorithm continues with the next suit.

Phase two begins when there are no remaining cards in either **to play**
area. Phase two steps:

- If all cards are in
**played**then the hand is possible. The algorithm ends. - If the
**taker**has no cards in**run**then the hand is impossible. The algorithm ends. - If the
**taker**has no cards in**blocked**then the hand is possible. The algorithm ends. - If the
**giver**has no cards in**keep**then the hand is impossible. The algorithm ends. - If the
**taker**has no cards in**pitch**then the hand is possible. The algorithm ends.

In phase three the partnership figures out which suit is the next suit to
attack. The only way to be in phase three is if **taker** has cards in both
**run** and **blocked** and **giver** has some cards in
both **keep** and **pitch**. Phase three steps:

- Count the number of cards that
**taker**has in**run**. Call this number*runcount*. - For each of the suits that
**giver**has represented in**pitch**:- Count the number of cards that
**giver**has in that suit in**pitch**. Call this number*pitchcount*. - If
*runcount*is greater than or equal to*pitchcount*then this suit is a candidate suit, otherwise it is not.

- Count the number of cards that
- If there is no candidate suit, then the hand is impossible. The algorithm ends.
- For each of candidate suits:
- Take the number of cards in the suit that
**taker**has in**blocked**and subtract from it the number of cards in the suit that**giver**has in**pitch**. It is not a problem if this number is negative, just remember that positive numbers are bigger than negative ones. This number is the*surplus*for the suit.

- Take the number of cards in the suit that
- Select the suit with the largest
*surplus*. If there is a tie select one of the tied suits. - As long as
**giver**has at least one card in the selected suit in**pitch**:**Taker**takes one card out of**run**and moves it to**played**.**Giver**takes the highest card from the selected suit out of**pitch**and moves it to**played**.

**Taker**moves all cards in the selected suit from**blocked**to**run**. The algorithm continues by beginning phase two again.

Copyright © 2004 by Jon Hale