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

Username:   Password: 
 RegisterRegister   
 tic tac toe game
Index -> Programming, Turing -> Turing Help
Goto page Previous  1, 2
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
guruguru




PostPosted: Sat May 29, 2004 7:00 pm   Post subject: (No subject)

code:

questions (quiz) := "xxx"


This should be in the second if statement. Then when you finish the question, it can never be called again.

And what does the questions array do? You have a choices array, but it has no relation to questions. It should be something like...

code:

put questions(quiz)
for i : 1 .. 4
    put choices (quiz, i)
end for


... where choices is a 2d array of a total of 4 choices for each question.
Sponsor
Sponsor
Sponsor
sponsor
yan




PostPosted: Mon May 31, 2004 5:30 pm   Post subject: (No subject)

wat conditions should i put for that in the if statement then?n also.. i tried the drawing x but it doesnt go in the position i want it to. it always goes a bit higher and to the right.

procedure board
for i : 30 .. 220 by 70
for j : 30 .. 170 by 70
drawbox (i, j, i + 60, j + 60, 53)
end for
end for
end board
procedure draw (player : string, x, y : int)
drawline (x, y + 20, x + 40, y + 80, green)
drawline (x + 2, y + 22, x + 42, y + 81, green)
drawline (x + 4, y + 24, x + 44, y + 82, green)
drawline (x + 6, y + 26, x + 46, y + 83, green)
drawline (x, y + 80, x + 40, y + 20, green)
drawline (x + 1, y + 81, x + 41, y + 21, green)
drawline (x + 2, y + 82, x + 42, y + 22, green)
drawline (x + 3, y + 83, x + 43, y + 23, green)
end draw

procedure mouse (var x, y : int)
var button : int
loop %needs to be in a loop to keep on reading mouse data
Mouse.Where (x, y, button) %code to find data on mouse
%check to see if button is hit
if button = 1 and x <= 170 and x >= 30 and y >= 30 and y <= 220 then
locatexy (maxx div 2, maxy div 2)
draw (player, x, y)
delay (100)
exit
end if
end loop
end mouse
board
mouse(x,y)


thats not the entire program so, some variables mite not be declared.. bt then my main concern is that the X doesnt go in the spot i want it to.... i havent tried out the O yet.. i just thought i'd take it step by steph.. i need to get most of it done by thursday to hand in... n then i have my prom on friday...hehehe.. excited.. so, i dun really have much time.. please help
yan




PostPosted: Mon May 31, 2004 5:41 pm   Post subject: (No subject)

http://www.geocities.com/yan_media/program.doc
on second thoughts, to avoid complications, i just included my entire program.. its crappy. i no and it is not done yet...
yan




PostPosted: Mon May 31, 2004 5:48 pm   Post subject: (No subject)

and i have a problem.. u no how the questions come up one by one right? well.. sometimes the previous question can still be seen when the next question comes on... it overlaps and become confusing. how do i get rid of that?
guruguru




PostPosted: Mon May 31, 2004 6:10 pm   Post subject: (No subject)

I can't seem to find your program on your site. Just your Violence against Women essay. Pretty good Very Happy!

Quote:
i tried the drawing x but it doesnt go in the position i want it to. it always goes a bit higher and to the right.


You probally have you x, and y positions in the center of the square. Thise means that the X will appear up and to the right. To fix this, make the x coordinate equal to the center - (width of letter X div 2). And th y similar: center - (height of letter X div 2). That will align your X properly.

Quote:
well.. sometimes the previous question can still be seen when the next question comes on... it overlaps and become confusing. how do i get rid of that?


Well I don't know your code, but I am assuming you are not calling View.Update when you display your first question. It should look like this:

code:

% draw the first question
View.Update
% wait till answer is received and do whatever
cls
% draw the second question
View.Update
% wait till answer is received and do whatever


Etc...

Hope that answers your questions.
yan




PostPosted: Mon May 31, 2004 6:32 pm   Post subject: (No subject)

http://us.f2.yahoofs.com/bc/40bbbf2f_85bf/bc/My+Documents/program.doc?bf5T8uABmUmjFMdW
hope this works.. sry abt the previous one..haha
yan




PostPosted: Mon May 31, 2004 6:41 pm   Post subject: (No subject)

View.Update doesnt work. it doesnt recognize this name
btw.. wat coorodinate did u mean? the coordinate of the box?
cz if u look at my program... u'll c how i drew my box..haha. i got that frm smone...
Dan




PostPosted: Tue Jun 01, 2004 12:21 pm   Post subject: (No subject)

What verson of turing you have? Becuse View.Update dose not work on anything but turing 4.x
Computer Science Canada Help with programming in C, C++, Java, PHP, Ruby, Turing, VB and more!
Sponsor
Sponsor
Sponsor
sponsor
yan




PostPosted: Thu Jun 03, 2004 5:39 pm   Post subject: :?:

The one i got to use at home is an older version. View.Update works in the computers at school.

Uptil now, the questions work fine bt the X and O doesnt work.. at the same time, I have an indicator that tells the user whose turn it is.. bt its not working well.. cz at times it works and at other times, it stays at the same user for few questions before changing. And also, I've been trying to make that indicator appear before the first player take any turns bt then it didnt work and the indicator appears only after the first player takes a turn.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 2 of 2  [ 24 Posts ]
Goto page Previous  1, 2
Jump to:   


Style:  
Search: