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

Username:   Password: 
 RegisterRegister   
 [Source Code] Intelligence game
Index -> Programming, Turing -> Turing Submissions
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
the_icycle




PostPosted: Tue Jan 20, 2004 11:00 am   Post subject: [Source Code] Intelligence game

TAKE AWAY SOUND AND PICS!!!! (but with pics and sound looks and sounds crazy)!!
code:
%Declaration section
var choice : string
var reply : string (1)
var font1, font2 : int
var A : string
var letter : string
var score : int

%Program title
procedure title
    drawfillbox (0, 0, 640, 400, 53)
    locate (1, 40)
    color (white)
    colorback (53)
    font1 := Font.New ("Script MT Bold:24")
    assert font1 > 0
    Font.Draw ("~!Compic!~", 270, 370, font1, black)
    Font.Free (font1)
end title
title

%pauseProgram
procedure pauseProgram
    cls
    title
    font2 := Font.New ("Swis721 BdCnOul BT:24")
    assert font2 > 0
    Font.Draw ("Press any key...", 100, 300, font2, black)
    Font.Free (font2)
    locate (6, 39)
    getch (reply)
end pauseProgram
pauseProgram


%Program Introduction
procedure intro
    title
    locate (5, 1)
    colorback (9)
    color (black)
    put "Test your ability at recognizing different parts of a computer as input, output, CPU or storage. 'Compic' is the one ideal game for that skill. Recognize away...!"
end intro
intro


%Procedure mainMenu
procedure mainMenu
    title
    for x : 1 .. 10
        locate (3, 1)
        put "1: Test away!"
        locate (4, 1)
        put "2: Too afraid...go while you got the chance!"
        locate (5, 1)
        put "Please enter your choice '1: Enter.. 2: Leave..': " ..
        get choice
        if choice < "1" or choice > "2" then
            locate (13, 1)
            put "Please enter the choice you wish to the corresponding number beside it. "
        else
            exit
        end if
    end for
end mainMenu
mainMenu

procedure pic1
    Pic.ScreenLoad ("keyboard2.bmp", 270, 130, picCopy)
end pic1

procedure pic2
    Pic.ScreenLoad ("printer.bmp", 320, 100, picCopy)
end pic2

procedure pic3
    Pic.ScreenLoad ("hard drive.bmp", 320, 100, picCopy)
end pic3

procedure pic4
    Pic.ScreenLoad ("CPU.bmp", 320, 100, picCopy)
end pic4

procedure pic5
    Pic.ScreenLoad ("speakers.bmp", 320, 100, picCopy)
end pic5

procedure pic6
    Pic.ScreenLoad ("floppy drive.bmp", 320, 100, picCopy)
end pic6

%Procedure goodBye
procedure bye
    title
    if choice = "2" then
        locate (20, 17)
        put " This is the way out.. Thanks for trying!"
        locate (10, 20)
        put "Program created By:"
        locate (11, 24)
        put "Mario!"
    end if
end bye
bye



%Procedure userInput
procedure userInput
    cls
    title
    pic1
    locate (4, 3)
    put "A = Input"
    locate (5, 3)
    put "B = Output"
    locate (6, 3)
    put "C = Storage"
    locate (7, 3)
    put "D = CPU"
    locate (20, 6)
    put "Match the picture with the name..: " ..
    get letter
    if choice = "1" then
    else
    end if
end userInput
userInput

procedure userInput2
    cls
    title
    pic2
    locate (4, 3)
    put "E = Input"
    locate (5, 3)
    put "F = CPU"
    locate (6, 3)
    put "G = Storage"
    locate (7, 3)
    put "H = Output"
    locate (20, 6)
    put "Match the picture with the name..: " ..
    get letter
    if letter = "A" or letter = "B" or letter = "C" or letter = "D" then
    elsif letter = "A" then
    score := score + 1
    else
    end if
end userInput2
userInput2

procedure userInput3
    cls
    title
    pic3
    locate (4, 3)
    put "I = Output"
    locate (5, 3)
    put "J = CPU"
    locate (6, 3)
    put "K = Storage"
    locate (7, 3)
    put "L = Input"
    locate (20, 6)
    put "Match the picture with the name..: " ..
    get letter
    if letter = "H" or letter = "E" or letter = "F" or letter = "G" then
    elsif letter = "H" then
    score = score + 1
    else
    end if
end userInput3
userInput3

procedure userInput4
    cls
    title
    pic4
    locate (4, 3)
    put "M = Storage"
    locate (5, 3)
    put "N = Output "
    locate (6, 3)
    put "O = CPU"
    locate (7, 3)
    put "P = Input"
    locate (20, 6)
    put "Match the picture with the name..: " ..
    get letter
    if letter = "K" or letter = "I" or letter = "J" or letter = "L" then
    elsif letter = "K" then
    score = score + 1
    else
    end if
end userInput4
userInput4

procedure userInput5
    cls
    title
    pic5
    locate (4, 3)
    put "Q = CPU"
    locate (5, 3)
    put "R = Input"
    locate (6, 3)
    put "S = Storage"
    locate (7, 3)
    put "T = Output"
    locate (20, 6)
    put "Match the picture with the name..: " ..
    get letter
    if letter = "O" or letter = "M" or letter = "N" or letter = "P" then
    elsif letter = "O" then
    score = score + 1
    else
    end if
end userInput5
userInput5

procedure userInput6
    cls
    title
    pic6
    locate (4, 3)
    put "U = CPU"
    locate (5, 3)
    put "V = Storage"
    locate (6, 3)
    put "AB = Output"
    locate (7, 3)
    put "BC = Input"
    locate (20, 6)
    put "Match the picture with the name..: " ..
    get letter
    if letter = "T" or letter = "Q" or letter = "R" or letter = "S" then
    elsif letter = "T" then
    score := score + 1
    else
    end if
end userInput6
userInput6

procedure display
cls
title
if letter = "U" or letter = "V" or letter = "AB" or letter = "BC" then
put "Congratulations!  You have finished the great computer challenge!"
put "Your Score is...............................: ",  score
pauseProgram
else
end if
end display

%Main Program
intro
pauseProgram
loop
    mainMenu
    exit when choice = "2"
    userInput
    userInput2
    userInput3
    userInput4
    userInput5
    userInput6
display
    end loop
Sponsor
Sponsor
Sponsor
sponsor
JHDK




PostPosted: Tue Jan 20, 2004 4:05 pm   Post subject: (No subject)

hmm... it doesnt really do anything.
sport




PostPosted: Tue Jan 20, 2004 10:43 pm   Post subject: (No subject)

Game of patience would be a great name for the pragram
MattyGG




PostPosted: Tue Nov 23, 2004 2:04 pm   Post subject: (No subject)

Interesting program...i find it does almost nothing...and where are the pics? (I cant see them)
Viper




PostPosted: Tue Nov 23, 2004 2:21 pm   Post subject: (No subject)

kool n like da other guy say "game of patience" should be the title Confused Confused
zomg




PostPosted: Wed Nov 24, 2004 11:42 am   Post subject: (No subject)

im thinking if ur gonna have a program with pics/sounds then post a zip file with the source and pics/sounds in it Confused
beard0




PostPosted: Wed Nov 24, 2004 2:47 pm   Post subject: Re: [Source Code] Intelligence game

the_icycle wrote:
code:
if choice = "1" then
else
end if

if letter = "A" or letter = "B" or letter = "C" or letter = "D" then
elsif letter = "A" then
    score := score + 1
else
end if

if letter = "H" or letter = "E" or letter = "F" or letter = "G" then
elsif letter = "H" then
    score = score + 1
else
end if

if letter = "K" or letter = "I" or letter = "J" or letter = "L" then
elsif letter = "K" then
    score = score + 1
else
end if

if letter = "O" or letter = "M" or letter = "N" or letter = "P" then
elsif letter = "O" then
    score = score + 1
else
end if

if letter = "T" or letter = "Q" or letter = "R" or letter = "S" then
elsif letter = "T" then
    score := score + 1
else
end if

if letter = "U" or letter = "V" or letter = "AB" or letter = "BC" then
    put "Congratulations!  You have finished the great computer challenge!"
    put "Your Score is...............................: ", score
    pauseProgram
else
end if


Ummm... your code has major problems:
The first if statement does nothing, ever.
Then you have a bunch that will never increase the score, even if the right letter is entered because you have tested already for that letter up above, followed by an else that does nothing. The last ine up there will actually sometimes do something, as it should, but why the else that does nothing. This is some pretty messy coding Confused .
Kelsey




PostPosted: Mon Dec 13, 2004 9:52 pm   Post subject: (No subject)

Where are the pictures? Sad I like pictures.
Sponsor
Sponsor
Sponsor
sponsor
m&m




PostPosted: Thu Dec 16, 2004 11:39 am   Post subject: (No subject)

im thinking...hmmm unintelligence game
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  [ 9 Posts ]
Jump to:   


Style:  
Search: