Now you can participate in such a game. Develop a strategy in the form of a simple program obeying the following grammar:
program ::= statement. statement ::= command | ifstat ifstat ::= IF condition THEN statement ELSE statement condition ::= cond | cond op condition op ::= AND | OR cond ::= memory { = | # } { command | NULL } memory ::= { MY | YOUR } LAST{1|2|3|4|5|6|7|8|9} command ::= TRADE | CHEAT
LAST1 refers to the previous encounter, LAST2 to the encounter before that,
and so on. The symbol '#' means 'is not equal to'. NULL indicates that an
encounter has not ocurred. Spaces and line breaks may appear anywhere in the
program and are for readability only.
Examples for valid programs are:
TRADE.
This is a program that always trades.
CHEAT.
And this is one that always cheats.
IF YOUR LAST1 = CHEAT THEN CHEAT ELSE TRADE.
This strategy is called "Tit for Tat" for obvious reasons.
So far there are four programs in my league. The three example programs
mentioned above and my own personal strategy.
Each program in the league plays 10 times against each other program.
The current results are:
Name Score 1. Mark 16 2. Mr. Tit for Tat 7 3. Cheater 6 4. Trader -27
Now develop your own strategy and send it in.