Base Types
There are four main base elements in RECYCLE, String, Integer, Card, and Boolean.
String
Strings are used for text within RECYCLE games. String literals are composed of all capital letters.
STOCK HAND PILE TRICK SCORE GREEN SUIT HEARTS
Strings are used in many places across Recycle. For example, they are the name portion of a CardCollection_, and the key/value pairs of a Card.
The cardatt function will return a String. It is used to look up the value stored a Card for a given key. If the key is not found or the card does not exist, this will return the empty String “”.
(cardatt [String] [Card])
StringStorage
Strings can be stored in a StringStorage for the Game_, Player_, or Team_.
([Game | Player | Team] str [String])
Integer
Integer literals are contiguous sequences of digits from 0 to 9. Currently only positive integers are supported with literals, but negative integers can be acheived through various actions.
0 23 999
Standard Integer operators can be applied to Integers to calculate new Integers, with addition, subtraction, multiplication, integer division (//), modular division (%), and exponentiation (^).
(+ [Integer] [Integer])
(- [Integer] [Integer])
(* [Integer] [Integer])
(// [Integer] [Integer])
(% [Integer] [Integer])
(^ [Integer] [Integer])
Two functions can be used to calculate the value from an integer sequence, either triangular numbers (1, 3, 6, 10, 15, 21, …) or fibonacci (1, 1, 2, 3, 5, 8, 13, …).
(tri [Integer])
(fib [Integer])
Five functions will return Integers. First, a Card can be scored using the values mapped through a PointMap_.
(score [Card] using [PointMap])
Similarly, each Card in a CardCollection_ can be individually scored with a PointMap_ and then these scores are summed.
(sum [CardCollection] using [PointMap])
One can find either the minimum or maximum card in a collection when given a PointMap_ from the card dictionaries to an integer, and the score can be returned. If there is a tie, the max or min is decided randomly among all tied cards.
(scoremax [CardCollection] using [PointMap])
(scoremin [CardCollection] using [PointMap])
The size of a CardCollection_ can be calculated and returned as an Integer.
(size [CardCollection])
Random Integer can also be generated with the random function in two ways. The first generates numbers between 0 and the Integer argument, exlcusive, and the second, with two Integer arguments, generates a number between the two numbers.
(random [Integer])
(random [Integer] .. [Integer])
Each player and team has an id number (player 1, team 2, etc) that can be used as an _Integer. The syntax for the id is as follows:
(pid (current player))
(tid (next team))
Integers are also derived from Aggregation_.
IntegerStorage
Integers are stored as part of the game, belonging either to the Game_, a Player_, or a Team_. These IntegerStorage locations are named with a String.
([Game | Player | Team] sto [String])
Card
A card is a set of maps from a String key to a String value, such as RANK => KING, COLOR => BLUE, and VALUE => FIVE.
A card can never be directly described, but is created through the CreateDeck_ setup and referenced through locations in a CardCollection_.
(top [CardCollection])
(bottom [CardCollection])
([Integer] [CardCollection])
Besides using references to individual specific cards in the CardCollection_, two functions can find either the minimum or maximum card in a collection when given a PointMap_ from the card dictionaries to an integer. If there is a tie, the max or min is decided randomly among all tied cards.
(max [CardCollection] using [PointMap])
(min [CardCollection] using [PointMap])
Boolean
Booleans in RECYCLE comprise the standard True and False, derived mainly from comparisons between other data types, or conjunctions and disjunctions of other Booleans. They are only evaluated, never explicitly stated as literal True or False.
(and [Boolean] [Boolean]+)
(or [Boolean] [Boolean]+)
(not [Boolean])
(> [Integer] [Integer])
(< [Integer] [Integer])
(>= [Integer] [Integer])
(<= [Integer] [Integer])
(== [Integer] [Integer])
(!= [Integer] [Integer])
(== [Card] [Card])
(!= [Card] [Card])
(== [String] [String])
(!= [String] [String])
(== [Player] [Player])
(!= [Player] [Player])
(== [Team] [Team])
(!= [Team] [Team])
Booleans are also derived from Aggregation_.