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

Username:   Password: 
 RegisterRegister   
 Connect 4 CHECK Problems....
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
ZeppelinManiac




PostPosted: Thu May 31, 2007 8:24 am   Post subject: Connect 4 CHECK Problems....

alright, now the mouse.where is all figured out (thanks to the guys that helped me out Very Happy), but now i need help on a check, its a long program (sorry im kinda new at this) any help would be awesome, thanks guys.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% CONNECT 4 %
% By: Joey Newell %
% ICS 3M1 %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% VARIABLES %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

const Rows := 5
const Columns := 5
var counter : int


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% TITLE AND INSTRUCTIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

proc Instructions
put " Connect 4 for Turing"
put " By: Joey Newell"
put ""
put ""
put ""
put " 2 Player Connect 4!"
put ""
put " Get 4 of the same colour in a"
put " row!"
put ""
put " Remember not to click on a box"
put " someone has already clicked on!"
put ""
put " HAVE FUN!"
end Instructions
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% GAMEBOARD %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

proc GameBoard
Draw.Box (5, 5, 355, 355, black)
Draw.Line (75, 5, 75, 355, black)
Draw.Line (145, 5, 145, 355, black)
Draw.Line (215, 5, 215, 355, black)
Draw.Line (285, 5, 285, 355, black)
Draw.Line (5, 75, 355, 75, black)
Draw.Line (5, 145, 355, 145, black)
Draw.Line (5, 215, 355, 215, black)
Draw.Line (5, 285, 355, 285, black)
end GameBoard

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% MOUSE INPUT %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
proc DrawRed
var x, y, b: int
loop
Mouse.Where (x, y, b)

if b=1 and x > 5 and x < 75
and y > 5 and y < 75 then
Draw.FillOval (40, 40, 30, 30, red)
exit when b=1

elsif b=1 and x > 75 and x < 145
and y > 5 and y < 75 then
Draw.FillOval (110, 40, 30, 30, red)
exit when b=1

elsif b=1 and x > 145 and x < 215
and y > 5 and y < 75 then
Draw.FillOval (180, 40, 30, 30, red)
exit when b=1

elsif b=1 and x > 215 and x < 285
and y > 5 and y< 75 then
Draw.FillOval (250, 40, 30, 30, red)
exit when b=1

elsif b=1 and x > 285 and x < 355
and y > 5 and y < 75 then
Draw.FillOval (320, 40, 30, 30, red)
exit when b=1

elsif b=1 and x > 5 and x < 75
and y > 75 and y < 145 then
Draw.FillOval (40, 110, 30, 30, red)
exit when b=1

elsif b=1 and x > 75 and x < 145
and y > 75 and y < 145 then
Draw.FillOval (110, 110, 30, 30, red)
exit when b=1

elsif b=1 and x > 145 and x < 215
and y > 75 and y < 145 then
Draw.FillOval (180, 110, 30, 30, red)
exit when b=1

elsif b=1 and x > 215 and x < 285
and y > 75 and y < 145 then
Draw.FillOval (250, 110, 30, 30, red)
exit when b=1

elsif b=1 and x > 285 and x < 355
and y > 75 and y < 145 then
Draw.FillOval (320, 110, 30, 30, red)
exit when b=1

elsif b=1 and x > 5 and x < 75
and y > 145 and y < 215 then
Draw.FillOval (40, 180, 30, 30, red)
exit when b=1

elsif b=1 and x > 75 and x < 145
and y > 145 and y < 215 then
Draw.FillOval (110, 180, 30, 30, red)
exit when b=1

elsif b=1 and x > 145 and x < 215
and y > 145 and y < 215 then
Draw.FillOval (180, 180, 30, 30, red)
exit when b=1

elsif b=1 and x > 215 and x < 285
and y > 145 and y < 215 then
Draw.FillOval (250, 180, 30, 30, red)
exit when b=1

elsif b=1 and x > 285 and x < 355
and y > 145 and y < 215 then
Draw.FillOval (320, 180, 30, 30, red)
exit when b=1

elsif b=1 and x > 5 and x < 75
and y > 215 and y < 285 then
Draw.FillOval (40, 250, 30, 30, red)
exit when b=1

elsif b=1 and x > 75 and x < 145
and y > 215 and y < 285 then
Draw.FillOval (110, 250, 30, 30, red)
exit when b=1

elsif b=1 and x > 145 and x < 215
and y > 215 and y < 285 then
Draw.FillOval (180, 250, 30, 30, red)
exit when b=1

elsif b=1 and x > 215 and x < 285
and y > 215 and y < 285 then
Draw.FillOval (250, 250, 30, 30, red)
exit when b=1

elsif b=1 and x > 285 and x < 355
and y > 215 and y < 285 then
Draw.FillOval (320, 250, 30, 30, red)
exit when b=1

elsif b=1 and x > 5 and x < 75
and y > 285 and y < 355 then
Draw.FillOval (40, 320, 30, 30, red)
exit when b=1

elsif b=1 and x > 75 and x < 145
and y > 285 and y < 355 then
Draw.FillOval (110, 320, 30, 30, red)
exit when b=1

elsif b=1 and x > 145 and x < 215
and y > 285 and y < 355 then
Draw.FillOval (180, 320, 30, 30, red)
exit when b=1

elsif b=1 and x > 215 and x < 285
and y > 285 and y < 355 then
Draw.FillOval (250, 320, 30, 30, red)
exit when b=1

elsif b=1 and x > 285 and x < 355
and y > 285 and y < 355 then
Draw.FillOval (320, 320, 30, 30, red)
exit when b=1
end if
end loop
end DrawRed

proc DrawBlack
var x, y, b: int
loop
Mouse.Where (x, y, b)

if b=1 and x > 5 and x < 75
and y > 5 and y < 75 then
Draw.FillOval (40, 40, 30, 30, black)
exit when b=1

elsif b=1 and x > 75 and x < 145
and y > 5 and y < 75 then
Draw.FillOval (110, 40, 30, 30, black)
exit when b=1

elsif b=1 and x > 145 and x < 215
and y > 5 and y < 75 then
Draw.FillOval (180, 40, 30, 30, black)
exit when b=1

elsif b=1 and x > 215 and x < 285
and y > 5 and y< 75 then
Draw.FillOval (250, 40, 30, 30, black)
exit when b=1

elsif b=1 and x > 285 and x < 355
and y > 5 and y < 75 then
Draw.FillOval (320, 40, 30, 30, black)
exit when b=1

elsif b=1 and x > 5 and x < 75
and y > 75 and y < 145 then
Draw.FillOval (40, 110, 30, 30, black)
exit when b=1

elsif b=1 and x > 75 and x < 145
and y > 75 and y < 145 then
Draw.FillOval (110, 110, 30, 30, black)
exit when b=1

elsif b=1 and x > 145 and x < 215
and y > 75 and y < 145 then
Draw.FillOval (180, 110, 30, 30, black)
exit when b=1

elsif b=1 and x > 215 and x < 285
and y > 75 and y < 145 then
Draw.FillOval (250, 110, 30, 30, black)
exit when b=1

elsif b=1 and x > 285 and x < 355
and y > 75 and y < 145 then
Draw.FillOval (320, 110, 30, 30, black)
exit when b=1

elsif b=1 and x > 5 and x < 75
and y > 145 and y < 215 then
Draw.FillOval (40, 180, 30, 30, black)
exit when b=1

elsif b=1 and x > 75 and x < 145
and y > 145 and y < 215 then
Draw.FillOval (110, 180, 30, 30, black)
exit when b=1

elsif b=1 and x > 145 and x < 215
and y > 145 and y < 215 then
Draw.FillOval (180, 180, 30, 30, black)
exit when b=1

elsif b=1 and x > 215 and x < 285
and y > 145 and y < 215 then
Draw.FillOval (250, 180, 30, 30, black)
exit when b=1

elsif b=1 and x > 285 and x < 355
and y > 145 and y < 215 then
Draw.FillOval (320, 180, 30, 30, black)
exit when b=1

elsif b=1 and x > 5 and x < 75
and y > 215 and y < 285 then
Draw.FillOval (40, 250, 30, 30, black)
exit when b=1

elsif b=1 and x > 75 and x < 145
and y > 215 and y < 285 then
Draw.FillOval (110, 250, 30, 30, black)
exit when b=1

elsif b=1 and x > 145 and x < 215
and y > 215 and y < 285 then
Draw.FillOval (180, 250, 30, 30, black)
exit when b=1

elsif b=1 and x > 215 and x < 285
and y > 215 and y < 285 then
Draw.FillOval (250, 250, 30, 30, black)
exit when b=1

elsif b=1 and x > 285 and x < 355
and y > 215 and y < 285 then
Draw.FillOval (320, 250, 30, 30, black)
exit when b=1

elsif b=1 and x > 5 and x < 75
and y > 285 and y < 355 then
Draw.FillOval (40, 320, 30, 30, black)
exit when b=1

elsif b=1 and x > 75 and x < 145
and y > 285 and y < 355 then
Draw.FillOval (110, 320, 30, 30, black)
exit when b=1

elsif b=1 and x > 145 and x < 215
and y > 285 and y < 355 then
Draw.FillOval (180, 320, 30, 30, black)
exit when b=1

elsif b=1 and x > 215 and x < 285
and y > 285 and y < 355 then
Draw.FillOval (250, 320, 30, 30, black)
exit when b=1

elsif b=1 and x > 285 and x < 355
and y > 285 and y < 355 then
Draw.FillOval (320, 320, 30, 30, black)
exit when b=1
end if
end loop
end DrawBlack


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% CHECKS FOR A "CONNECT 4" %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% PROCEDURE CALLS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Instructions
GameBoard

loop
DrawRed
delay (200)
DrawBlack
delay (200)
end loop
Sponsor
Sponsor
Sponsor
sponsor
ZeppelinManiac




PostPosted: Thu May 31, 2007 8:46 am   Post subject: Re: Connect 4 CHECK Problems....

EDIT: take out the variables at the top, sorry, i was just trying out something but forgot to take them out.
Carey




PostPosted: Fri Jun 01, 2007 8:09 am   Post subject: Re: Connect 4 CHECK Problems....

See the thread i just posted. It should have the answer to your problem. (A win function ported from Java)
ZeppelinManiac




PostPosted: Tue Jun 05, 2007 7:55 am   Post subject: Re: Connect 4 CHECK Problems....

thanks a lot carey, i owe you one
Veladen




PostPosted: Fri Jun 08, 2007 6:51 am   Post subject: Re: Connect 4 CHECK Problems....

do this for the instructions so they dont appear behind the game the whole time.

proc Instructions
put " Connect 4 for Turing"
delay (500)
put " By: Joey Newell"
put ""
put ""
put ""
delay (500)
put " 2 Player Connect 4!"
put ""
delay (500)
put " Get 4 of the same colour in a"
put " row!"
put ""
delay (500)
put " Remember not to click on a box"
put " someone has already clicked on!"
put ""
delay (500)
put " HAVE FUN!"
delay (5000)
cls
end Instructions
ZeppelinManiac




PostPosted: Fri Jun 08, 2007 8:07 am   Post subject: Re: Connect 4 CHECK Problems....

yeah when i created my instructions in turing, rather than locating the text, i did it the cheap way and just put a whole lot of spaces in my put statements lol. but for some reason when i copy and pasted it onto this website it didn't put in the spaces. thanks anyways!
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 1 of 1  [ 6 Posts ]
Jump to:   


Style:  
Search: