
-----------------------------------
cool dude
Sun Mar 26, 2006 8:17 pm

Get 20
-----------------------------------
i was playing a game with my sister a while back and decided to program it in turing just for fun because i was bored. u can play this game with 2 people but i made it against the computer. my AI is really good and almost unbeatable! if u r good at math and logic u will figure out how to beat it and if u cant then just post and i'll tell u how. 

RULES
it is very simple but may sound complicated!!!

basically u start off by choosing either 1 or 2.

then the computer chooses a number that is 1 or 2 greater than your number

then u have to choose a number that is 1 or 2 greater than the computers number and so on...

the object of this game is to land on the number 20 and then u win!



P.S. i know it is terrible coding but it took me about 15 min and i didn't want to think about making it sufficient and stuff. i'm sure i and others can make this game in less than 60 lines of code. also this was one of my first programs done in turing so i didn't know arrays back then otherwise it would have been much better!!!

P.P.S since i said i made this just for fun i didn't want to error proof so please don't comment on any error proofing

-----------------------------------
MysticVegeta
Mon Mar 27, 2006 11:36 am


-----------------------------------
The goal of the game is that the player should choose 17, so that whatever moves the computer makes you win, and this cycle repeats, same with 17, the goal now becomes for you to choose 14 so whatever the computer  chooses you will able to land on 17 and win. The cycle repeats. Didnt take longer than a minute to figure it out =\ pretty straightforward.

Cycle for the player to choose to win it:

2
5
8
11
14
17
20

Dont worry anything the computer chooses you win ;)

-----------------------------------
MysticVegeta
Mon Mar 27, 2006 12:07 pm


-----------------------------------
var choose : array 1 .. 7 of int := init (2, 5, 8, 11, 14, 17, 20)
var num : int

var mainAns : int := 0

fcn getGreater (n : int) : int
    var ans : int
    for x : 1 .. 7
        if (n + 1 = choose (x)) or (n + 2 = choose (x)) then
            ans := choose (x)
            result ans
        elsif n = choose (x) then
            ans := n + Rand.Int (1, 2)
            result ans
        end if
    end for
end getGreater

loop
    cls
    put "Enter a number > ", mainAns, " + and increment of 1 or 2: " ..
    get num
    if num > mainAns and num 