Back to ToR Home

The ToR strategies developed and used during our ProWo

This part of the ToR program contains the BASIC code of all 26 strategies

Comments on the code are all in red
Comments on writing a strategy are at the bottom
We'd suggest setting a 1024 * 768 pixels screen resolution.

REM ............. students have to fit in their code below ......

choice$ = "c"                           This means that the choice will be cooperation by default if you do not change this.
SELECT CASE mynum           The variable mynum (1-26) is your ship´s number in the game.

CASE 1
name$(1) = "Anny"                 Your default name is the letter in the alphabet with your number. Change this.
descr$(1) = "Killswitch 1"       Describe your strategy with a short text that tells people what your code does.
IF RND < .6 THEN choice$ = "d" ELSE choice$ = "c"                        Using RND is like rolling a dice.

CASE 2
name$(2) = "Bambi"
descr$(2) = "always defect"         This is misleading. Bambi defects in 80 % of all moves.
IF RND > .2 THEN choice$ = "d" ELSE choice$ = "c"

CASE 3
name$(3) = "Spaniard"
descr$(3) = "Big Boat"
IF nom = 10 THEN choice$ = "d"               <nom> is the number of the move. But you don´t know the last move!
IF INSTR(otrecord$, "dcd") THEN choice$ = "d"   <otrecord$> is a string like <ccccdcccddcc> that tells you what
IF INSTR(otrecord$, "dd") THEN choice$ = "d"    the other player has done = record of other player´s moves

CASE 4
name$(4) = "chrissi"
descr$(4) = "Tit for Tat"                               This was the winning strategy in Axelrod´s tournament. One line only!
IF otlast$ = "d" THEN choice$ = "d"         <otlast$> tells you what the other ship did last time.  c=coop., d=defect.

CASE 5
name$(5) = "Chris"
descr$(5) = "Fair play"
IF INSTR(otrecord$, "dd") THEN choice$ = "d"    <INSTR> looks here whether the other ship has defected twice.
IF mymon < otmon THEN choice$ = "d"                   Compares if they have more money (total) than player 5.

CASE 6
name$(6) = "Lars"
descr$(6) = "Cheaty"
IF otlast$ = "d" THEN choice$ = "d"
IF RND < .7 THEN choice$ = "d" ELSE choice$ = "c"
IF mymon < otmon THEN choice$ = "d"

CASE 7
name$(7) = "Gina"
descr$(7) = "Looser"
IF otlast$ = "c" THEN choice$ = "c"              Line not needed because choice$ is "c" by default.
IF nom = 10 THEN choice$ = "c"                     Can be skipped, too.

CASE 8
name$(8) = "Holly"
descr$(8) = "Nice start"
IF otfirst$ = "c" THEN choice$ = "c"          
Line not needed because choice$ is "c" by default.
IF RND > .2 THEN choice$ = "c"                  Line not needed because choice$ is "c" by default. Same as no 7.

CASE 9
name$(9) = "Tim"
descr$(9) = "Normal Strategy"
IF INSTR(otrecord$, "dd") THEN choice$ = "d"
IF INSTR(otrecord$, "dcd") THEN choice$ = "d"
IF INSTR(otrecord$, "cc") THEN choice$ = "c"             Overwrites the "d" in the two lines above.
IF INSTR(otrecord$, "cdc") THEN choice$ = "c"           Perhaps better the other way round.

CASE 10
name$(10) = "Agent Michi"
descr$(10) = "Big Agent"
IF INSTR(otrecord$, "dd") THEN choice$ = "d"
IF INSTR(otrecord$, "dcd") THEN choice$ = "d"

CASE 11
name$(11) = "King"
descr$(11) = "Cheater"
REM choice$ = "d"
IF otlast$ = "c" THEN choice$ = "d"

CASE 12
name$(12) = "Juliane"
descr$(12) = "uncooperative strategy"
choice$ = "d"

CASE 13
name$(13) = "Mary"
descr$(13) = "clever strategy"
IF INSTR(otrecord$, "dcd") THEN choice$ = "d"
IF INSTR(otrecords$, "ddc") THEN choice$ = "d"

CASE 14
name$(14) = "NO Return"
descr$(14) = "cheaty"
choice$ = "d"
IF RND > .2 THEN choice$ = "d" ELSE choice$ = "c"

CASE 15
name$(15) = "Mother Theresa"
descr$(15) = "Killswitch 2"
choice$ = "d"
IF INSTR(otrecord$, "dd") THEN choice$ = "d"
IF INSTR(otrecord$, "dcd") THEN choice$ = "d"
IF otlast$ = "d" OR otfirst$ = "d" THEN choice$ = "d"

CASE 16
name$(16) = "Niko Robin"
descr$(16) = "Nemesis"
IF INSTR(otrecord$, "d") THEN choice$ = "c" ELSE choice$ = "d"
IF mylast$ = "c" THEN choice$ = "c"

CASE 17
name$(17) = "Katharina"
descr$(17) = "Tricky strategy"
IF mymon < otmon THEN choice$ = "d"
IF otfirst$ = "d" THEN choice$ = "d"

CASE 18
name$(18) = "Nurcan"
descr$(18) = "uncooperativ strategy 2"
choice$ = "d"
IF mylast$ = "c" THEN choice$ = "d"

CASE 19
name$(19) = "Campino"
descr$(19) = "till the bitter ending"
IF INSTR(otrecord$, "dd") THEN choice$ = "d"
IF INSTR(otrecord$, "dcd") THEN choice$ = "d"
IF nom = 10 THEN choice$ = "d"

CASE 20
name$(20) = "T's Timmy"
descr$(20) = "defect till they coop"
choice$ = "d"
IF otlast$ = "c" THEN choice$ = "c"

CASE 21
name$(21) = "T's Uriel"
descr$(21) = "d t t c  but no double cheats"
choice$ = "d"
IF otfirst$ = "c" THEN choice$ = "c"
IF INSTR(otrecord$, "dd") THEN choice$ = "d"

CASE 22
name$(22) = "T's Vernon"
descr$(22) = "defect till double coop"
choice$ = "d"
IF INSTR(otrecord$, "cc") THEN choice$ = "c"
IF mymonfrom > otmonfrom THEN choice$ = "c"

CASE 23
name$(23) = "T's Walter"
descr$(23) = "less money"
IF mymonfrom < otmonfrom THEN choice$ = "d"

CASE 24
name$(24) = "T's Xaver"
descr$(24) = "50 50 plus start finish"
IF RND < .5 THEN choice$ = "d"
IF otfirst$ = "c" AND otlast$ = "c" THEN choice$ = "c"

CASE 25
name$(25) = "T's Yps"
descr$(25) = "80 p c defection"
IF RND < .8 THEN choice$ = "d"

CASE 26
name$(26) = "T's Zelda"
descr$(26) = "unfriendly start then always nice"
IF nom = 1 THEN choice$ = "d" ELSE choice$ = "c"

END SELECT

Some comments on writing code for your strategy

You should make good use of the following variables:

name$(insertyournumberhere)    This string variable can take your name
descr$(
insertyournumberhere)    This string variable should describe your strategy in a few words
mymonfrom            This is the money that you have got when trading with (or raiding?) the ship you have just met.
otmonfrom              This is the money that the people on the other ship have got when trading (or raiding?) with you.
myfirst$            
This string variable is "c" or "d" = your first move when you met the partner
mylast$              This string variable is "c" or "d" = your last move
otfirst$               This string variable is "c" or "d" = the other ship's first move
otlast$                This string variable is "c" or "d" = the other ship´s last move
myrecord$         This string variable is a list of c's and d's showing a record of what you have done. 
otrecord$           This string variable is a list of c's and d's showing a record of what the other ship has done.
                           The length of the strings myrecord$ and otrecord$ varies, it is actually the number of moves.
                           The first and the last letter in these variables is actually myfirst$, otfirst$, mylast$, or otlast$.
nom                    The number of the move. You don´t know the number of the last move, it can change each time the
                           the program is run.


You can copy or change lines from our student´s strategies (see above) or write some new code.


Back to ToR Home