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

Username:   Password: 
 RegisterRegister   
 For Matt S tiktest
Index -> Programming, Turing -> Turing Submissions
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
exploitmonkey




PostPosted: Wed Jan 26, 2005 9:30 am   Post subject: For Matt S tiktest

Turing:

%********************************
%name block
%name - CLinton Shepley
%date -
%program description
%*********************************
%
%
%*********************************
%Algorithm
%A set of instructions in order, used to pre-plan a program
%*********************************
%
%
%*********************************
%Variables Dictionary
%declare variable by name and type
var nam : string                                            %...gets name
var num : array 1 .. 5 of int := init (1, 2, 6, 8, 9)      %...preset numbers
var numpick : array 1 .. 5 of int := init (1, 2, 3, 4, 5)   %...user numbers
var points : int := 0                                       %...counter for points
var ans : string (1)                                        %...answer from user
var array10n : array 1 .. 10 of string

%*********************************
%
%
%*********************************
%Procedures/Subprograms/Subroutines
%do each seperatly in a block

%<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< box with a ball on it
proc boxball

    drawfillbox (1, 10, 200, 110, red)         %...box

    drawfilloval (120, 130, 20, 20, green)       %...ball

    for c : 1 .. 120
        drawline (120, 300, 50 + c, 150, yellow) %...triangle
    end for

    delay (3000)

    cls

end boxball

%<><><<><><><><><><><><><><><><><><><><><><> dropping ball
proc fall

    for c : 1 .. 500                                %...Animates falling ball
        drawfilloval (200, 500 - c, 30, 30, black)
        delay (5)
        drawfilloval (200, 500 - c, 30, 30, white)
    end for

    delay (1000)

    cls

end fall

%<><<><><><><><><><><><><><><><><><><><><><> name
proc name

    put "Enter your name..."

    get nam                 %...gets name from player

    locatexy (320, 240)
    put "Hello ", nam ..    %...shows name on screen

    delay (5000)

    cls

end name

%<><><><><><><><><><><><><><><><><><><><>gets 5 numbers adds them and gets the average
proc numbers

    put "pik 5 numbers between 1 and 10"

    put ""
    get numpick (1)
    get numpick (2)
    get numpick (3)
    get numpick (4)
    get numpick (5)
    put ""

    %................................................................Adding
    put "The totalled value is ", numpick (1) + numpick (2) + numpick (3) + numpick (4) + numpick (5)

    %................................................................Averaging
    put "The average of the 5 numbers is ", numpick (1) + numpick (2) + numpick (3) + numpick (4) + numpick (5) / 5

    delay (5000)

    cls

end numbers

%<><><><><><><><<><><><><><><><><><><><> Compares 5 nums picked by me to the user selection.
proc compare

    if numpick (1) = num (1) then %...compares the numbers to my picked numbers
        points := points + 1

    elsif numpick (2) = num (2) then
        points := points + 1

    elsif numpick (3) = num (3) then
        points := points + 1

    elsif numpick (4) = num (4) then
        points := points + 1

    elsif numpick (5) = num (5) then
        points := points + 1

    end if

    put "Surprise you get 1 point for each right number"

    put ""

    put num (1) : 2, " - ", numpick (1)

    put num (2) : 2, " - ", numpick (2)

    put num (3) : 2, " - ", numpick (3)

    put num (4) : 2, " - ", numpick (4)

    put num (5) : 2, " - ", numpick (5)

    put ""
    put "Points= ", points
    delay (1000)

end compare

%<><><><><><><><><><><><><><><><><><>gets 10 names
proc array10

    put "Now enter 10 names"
    delay (100)

    get array10n (1)
    get array10n (2)
    get array10n (3)
    get array10n (4)
    get array10n (5)
    get array10n (6)
    get array10n (7)
    get array10n (8)
    get array10n (9)
    get array10n (10)

end array10

%<><><><><><><><><><><><><><><>><><>display names
proc displayarray

    put "-------------------------------------------------------------------------------"
    put array10n (1)
    put array10n (2)
    put array10n (3)
    put array10n (4)
    put array10n (5)
    put array10n (6)
    put array10n (7)
    put array10n (8)
    put array10n (9)
    put array10n (10)
    put "-------------------------------------------------------------------------------"
    put array10n (1), " ",
        array10n (2), " ",
        array10n (3), " ",
        array10n (4), " ",
        array10n (5), " ",
        array10n (6), " ",
        array10n (7), " ",
        array10n (8), " ",
        array10n (9), " ",
        array10n (10)

end displayarray
%*********************************
%
%
%*********************************
%Mainline
%step by step enter the program

loop            %...Repeats the game over again
    drawfillbox (0, 0, maxx, maxy, white)
    boxball
    fall
    name
    numbers
    compare
    array10
    displayarray
    put "Wanna play again?  y/n"

    getch (ans)

    exit when ans = "n" or ans = "N" %...leaves program program

end loop

quit           %...exits when ans  is n
%*********************************
Sponsor
Sponsor
Sponsor
sponsor
MiX-MaztA-M8riX




PostPosted: Wed Jan 26, 2005 10:40 am   Post subject: (No subject)

You Didnt Use Code Tags Surprised
Please.... Really, Use Them In The Future

code:

[code]
Makes It A Lot Easier To See...
[/code]


And Also Indent PLZ!

Good Job On This?
Its really meant to not do much, but I guess its a good example to get sum basic stuff down...
Tony




PostPosted: Wed Jan 26, 2005 10:42 am   Post subject: (No subject)

edited for redability. Please do so yourself next time
MiX-MaztA-M8riX




PostPosted: Wed Jan 26, 2005 10:56 am   Post subject: (No subject)

Thank you Tony.

But may I ask the 'exploitmonkey' what this program was made for? Razz
cool dude




PostPosted: Wed Jan 26, 2005 2:53 pm   Post subject: (No subject)

MiX-MaztA-M8riX wrote:
Thank you Tony.

But may I ask the 'exploitmonkey' what this program was made for? Razz


it wasn't really made for anything but he justed wanted probably to have some comments on how to improve in turing. he combined all his programs that he made and put them in one whole program.

a comment to his program would be that u don't need procedures on everything; because in your program there is no need.
ste_louis26




PostPosted: Fri Jan 28, 2005 3:40 pm   Post subject: (No subject)

interesting but not very useful....
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  [ 6 Posts ]
Jump to:   


Style:  
Search: