
-----------------------------------
ZeppelinManiac
Thu May 31, 2007 8:24 am

Connect 4 CHECK Problems....
-----------------------------------
alright, now the mouse.where is all figured out (thanks to the guys that helped me out :D), 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

-----------------------------------
ZeppelinManiac
Thu May 31, 2007 8:46 am

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
Fri Jun 01, 2007 8:09 am

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
Tue Jun 05, 2007 7:55 am

Re: Connect 4 CHECK Problems....
-----------------------------------
thanks a lot carey, i owe you one

-----------------------------------
Veladen
Fri Jun 08, 2007 6:51 am

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
Fri Jun 08, 2007 8:07 am

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!
