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

Username:   Password: 
 RegisterRegister   
 Trivia
Index -> Programming, Turing -> Turing Submissions
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Loves to Spooge




PostPosted: Tue Oct 31, 2006 10:49 am   Post subject: Trivia

How well do you know your Assasins Creed?


%%___________________________________%%
%|----------------------------------- |%
%| By: |%
%| Date: October 25th |%
%| Trivia |%
%| |%
%|___________________________________|%
%%-----------------------------------%%


% Variables
var i : int
var questions : string % Stores the questions
var money : real %stores how much money you have made
var key : string (1)
var ans : string
var A, B, C, D : string
var count : int := 1
var font1 : int





% Starting Page
font1 := Font.New ("serif:25")
assert font1 > 0
drawfillbox (-1, -1, 1000, 1000, 7)
color (123)
colorback (7)
locate (12, 30)
Font.Draw ("Trivia", 250, 270, font1, red)
locate (25, 25)
Font.Draw ("Press any key to continue", 150, 150, font1, red)
getch (key)
cls



% Question Number 1

delay (100)
color (0)
colorback (7)
locate (10, 30)
put "Question Number 1" ..
locate (12, 9)
put "What was another name suggestion for th title of the game Assasins Creed" ..
locate (14, 30)
put "A)Project Assasin"
locate (15, 30)
put "B)Assasins of 2006"
locate (16, 30)
put "C)Hello Kitty Island Adventure"
locate (17, 30)
put "D)None of the above"
get ans
if ans = "A" then
put "That is correct" ..
put " Press any key to continue"
getch (key)
else
if ans = "D" then
put "That is not correct the correct answer was A" ..
put " Press any key to continue"
count := count + 1
getch (key)
elsif
ans = "B" then
put "That is not correct the correct answer was A" ..
put " Press any key to continue"
getch (key)
elsif
ans = "C" then
put "That is not correct the correct answer was A" ..
put " Press any key to continue"
getch (key)
cls
end if
end if
cls

% Question Number 2

delay (100)
color (0)
colorback (7)
locate (10, 30)
put "Question Number 2" ..
locate (12, 30)
put "What time period does the game take place?" ..
locate (14, 30)
put "A)2006"
locate (15, 30)
put "B)During the Third Crusade in 1189-1192"
locate (16, 30)
put "C)10 BC"
locate (17, 30)
put "D)All of the above"
get ans
if ans = "B" then
put "That is correct" ..
put " Press any key to continue"
count := count + 1
getch (key)
else
if ans = "A" then
put "That is not correct the correct answer was B " ..
put " Press any key to continue"
getch (key)
elsif
ans = "C" then
put "That is not correct the correct answer was B" ..
put " Press any key to continue"
getch (key)
elsif
ans = "D" then
put "That is not correct the correct answer was B" ..
put " Press any key to continue"
getch (key)

end if
end if
cls

% Question Number 3

delay (100)
color (0)
colorback (7)
locate (10, 30)
put "Question Number 3" ..
locate (12, 9)
put "What is the name of the character you play in Assasins Creed?" ..
locate (14, 30)
put "A)Lucas Morris"
locate (15, 30)
put "B)Altair"
locate (16, 30)
put "C)George W.Bush"
locate (17, 30)
put "D)Helom"
get ans
if ans = "B" then
put "That is correct" ..
put " Press any key to continue"
count := count + 1
getch (key)
else
if ans = "A" then
put "That is not correct the correct answer was B" ..
put " Press any key to continue"
getch (key)
elsif
ans = "C" then
put "That is not correct the correct answer was B" ..
put " Press any key to continue"
getch (key)
elsif
ans = "D" then
put "That is not correct the correct answer was B" ..
put " Press any key to continue"
getch (key)
end if
end if
cls

% Question Number 4

delay (100)
color (0)
colorback (7)
locate (10, 30)
put "Question Number 4" ..
locate (12, 9)
put "What part of Altairs body was cut off so he could finish his trainning" ..
locate (14, 30)
put "A)His head"
locate (15, 30)
put "B)His right foot"
locate (16, 30)
put "C)His ears"
locate (17, 30)
put "D)His left index finger"
get ans
if ans = "D" then
put "That is correct" ..
put " Press any key to continue"
count := count + 1
getch (key)
else
if ans = "A" then
put "That is not correct the correct answer was D " ..
put " Press any key to continue"
getch (key)
elsif
ans = "C" then
put "That is not correct the correct answer was D" ..
put " Press any key to continue"
getch (key)
elsif
ans = "B" then
put "That is not correct the correct answer was D" ..
put " Press any key to continue"
getch (key)
end if
end if
cls

% Question Number 5

delay (100)
color (0)
colorback (7)
locate (10, 30)
put "Question Number 5" ..
locate (12, 9)
put "Where does the game take place" ..
locate (14, 30)
put "A)Jerusalem"
locate (15, 30)
put "B)Acre"
locate (16, 30)
put "C)Damascus"
locate (17, 30)
put "D)All of the above"
get ans
if ans = "D" then
put "That is correct" ..
put " Press any key to continue"
count := count + 1
getch (key)
else
if ans = "A" then
put "That is not correct the correct answer was D" ..
put " Press any key to continue"
getch (key)
elsif
ans = "C" then
put "That is not correct the correct answer was D" ..
put " Press any key to continue"
getch (key)
elsif
ans = "B" then
put "That is not correct the correct answer was D" ..
put " Press any key to continue"
getch (key)
end if
end if
cls

% Your Score
color (0)
colorback (7)
if count = 1 then
put "You won 1000$"
put "batter luck next time"
else
color (0)
colorback (7)
if count = 2 then
put "You won 2000$"
put "Not bad"
else
color (0)
colorback (7)
if count = 3 then
put "You won 3000$$"
put " Good job!"
else
color (0)
colorback (7)
if count = 4 then
put "You won 4000$. Thats Great"
else
color (0)
colorback (7)
if count = 5 then
put "You sure do know your video games. You won 5000$!"
end if
end if
end if
end if
end if
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Tue Oct 31, 2006 1:26 pm   Post subject: (No subject)

Quote:

end if
end if
end if
end if
end if

amazing.

Check out the [Turing Walkthrough] for Loops and Functions
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Carey




PostPosted: Tue Oct 31, 2006 2:16 pm   Post subject: (No subject)

try using:
code:

if [whatever] then
    [whatever]
elsif [whatever] then
    [whatever]
else
    [whatever]


properly indenting your code makes it easy to read. so do code tags Very Happy
bruized




PostPosted: Tue Oct 31, 2006 7:59 pm   Post subject: Re: Trivia

Loves to Spooge wrote:

if ans = "B" then
put "That is correct" ..
put " Press any key to continue"
count := count + 1
getch (key)
else
if ans = "A" then
put "That is not correct. The correct answer was B " ..
put " Press any key to continue"
getch (key)
elsif
ans = "C" then
put "That is not correct the correct answer was B" ..
put " Press any key to continue"
getch (key)
elsif
ans = "D" then
put "That is not correct the correct answer was B" ..
put " Press any key to continue"
getch (key)
end if


I'm pretty sure that that part you can get rid of all the if statements and use it only under the else. Especially since the output is always the same. That way Turing checks if the answer is right. If it is anything else it puts the "else" message. In other words it would look like this:

code:

else
put "That is not correct the correct answer was B " ..
put " Press any key to continue"
getch (key)


This just saves time and space. Also it makes it more appealing (as in its nicer to read).

Also:

Loves to Spooge wrote:

if ans = "A" then
put "That is correct" ..
put " Press any key to continue"
getch (key)
else
if ans = "D" then
put "That is not correct the correct answer was A" ..
put " Press any key to continue"
count := count + 1
getch (key)
...


The count variable counts the amount of questions you got right does it not? Then how come it increases by one when you get the wrong answer? I assume it should be in the previous statement (if ans = A ...)

Just a few things I should say. I hope it helped.

Oh, and on a side note... (I don't mean to nitpick)

Loves to Spooge wrote:

if count = 1 then
put "You won 1000$"
put "batter luck next time"
else
color (0)
colorback (7)


Shouldn't that say "better" Razz
abysspell




PostPosted: Wed Nov 01, 2006 10:44 am   Post subject: (No subject)

Nice program!
I think that you could've used some fonts to make it look better though.
The questions are well thought out. Work on your spelling.
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  [ 5 Posts ]
Jump to:   


Style:  
Search: