Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 The "I hate losing game"
Index -> Programming, Turing -> Turing Submissions
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
a random person




PostPosted: Sat Nov 26, 2005 10:04 am   Post subject: The "I hate losing game"

i created this game because i was getting sick of losing, so i had a idea to
have a simulated dice roll game that i cold not lose. the secret is in the code for this game.
code:

loop
    var a, b : int
    var p1, p2, pa : string
    put "player one enter your name"
    get p1
    put "player two enter your name"
    get p2
    randint (a,1,6)
    randint (b,1,6)
    if p1 = "bob" then
        randint (a, b + 1, 6)
    else
        randint (a, 1, 5)
    end if
    if p2 = "bob" then
        randint (b, a + 1, 6)
    else
        randint (b, 1, 5)
    end if
    put p1, " rolled a ", a, " vs. ", p2, " rolled a ", b
    if a < b then
        put p2, " wins"
    elsif a > b then
        put p1, " wins"
    else
        put "tie"
    end if
    put "play again (y)es or (n)o?"
    get pa
    if pa = "y" then
        cls
    else
        exit when pa = "n"
    end if
end loop

you can replase bob with any other name, now YOU can be a winner!
Sponsor
Sponsor
Sponsor
sponsor
Display posts from previous:   
   Index -> Programming, Turing -> Turing Submissions
View previous topic Tell A FriendPrintable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 1 Posts ]
Jump to:   


Style:  
Search: