UNO

From Esolang
Jump to navigation Jump to search
For the card game, see wikipedia:UNO.
UNO should always be capitalised.

UNO is an esolang by User:Hammy that resembles a game of UNO. There is two versions of the UNO esolang: Textual UNO (TU), which is a text form of Actual UNO, and Actual UNO (AU), which actually costs money to code in because you have to buy a game of UNO.

Memory and stuff

UNO has a pile and a stack. The pile is like a pile of face-down UNO cards, ready to be played onto the stack. Unlike the name, the stack is actually what you play cards (commands) on, and no, there isn't self-modifying. To make this more "possible to code in", I added a second stack that actually acts as a stack, now referred to as just "the stack". The actual stack and the pile won't even need to be referred to. If the pile ever runs out of cards, the actual stack will become the pile, but only if the last card played on the previous pile wasn't a skip. The program ends if someone loses every card or if the bottom of the pile is a skip when replacing. You can only play cards that are the same color/number as the one currently on the card stack.

Programs

The first part of the program is the pile definition.

Here's a table of cards for the pile.

Card Symbol Meaning when "played" Amount needed
Any red number 0123456789 Push that number to the stack.

19 numbers in total, 18 non-zeros and 1 zero

Any yellow number abcdefghi Push that number in base 19 to the stack. 19 numbers in total. 18 non-a and 1 a
Any green number jklmnopqrs Does the corresponding operation:
Symbol Number Command Befunge equivalent (This is the best example of a stack-based language)
j 0 Add. If there isn't any left, you could use ko to emulate it. +
k 1 Subtract. -
l 2 Multiply. *
m 3 Divide. /
n 4 Modulo. %
o 5 Negate. 01-*
p 6 Duplicate. :
q 7 Greater than. `
r 8 Pop. $
s 9 Output as character. ,
You probably get the idea from the above two
Any blue number tuvwxyzAB Same as red numbers s e e a b o v e
Skip (Any color) CDEF Prevent the next player from doing anything on their next turn. 4. 1 for each color
Reverse GHIJ Reverse the order of play. 4. 1 for each color
Draw 2 KLMN Make the next player draw 2 cards, making the program terminate later. 4. 1 for each color
Wild ! Can be used to change color, making programming easier. 4
Wild draw 4 ? Take input from the user, then do the actions of a Wild and two Draw 2s. 4


In AU, it's literally setting up a pile of UNO cards.

In TU, it is made by stringing together characters corresponding to the second column of the table above. The last character is the top of the pile.

More details soon, this took long to write...

Examples

Soon.