Matching card game problems. 
	 
	
		| Author | 
		Message | 
	 
		 
		lollipopgirl
 
 
 
    
		 | 
		
		
			
				  Posted: Tue Jan 17, 2006 6:09 pm    Post subject: Matching card game problems.  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				k...i am done half part of my match card but I dun know how to add score to the matched card and made those wrong matched card disappear..Itz due tmr and i stilll haf no idea how to fix it..plz help and this is my program so far..
 
 
 
Martin says: Fixed the title. Carry on.
		
	
  
          
							 
	
	
		
	 
	
		|  Description: | 
		
			
		 | 
		  Download | 
	 
	
		|  Filename: | 
		 matchcard.txt | 
	 
	
		|  Filesize: | 
		 5.91 KB | 
	 
	
		|  Downloaded: | 
		 170 Time(s) | 
	 
	 
	 
		
 | 
			 
			
				 | 
			 
		  | 
	 
	 
		 | 
		
		 | 
	 
	  
		  | 
	 
		 
		Sponsor Sponsor 
		 
  
		 | 
		
 | 
	 
	 
		  | 
	 
				 
		lollipopgirl
 
 
 
    
		 | 
		
		
			
				  Posted: Tue Jan 17, 2006 6:25 pm    Post subject: I posted it here  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				i posted it here
 
 
	  | code: | 	 		  var player1, player2, first : string
 
var mark : array 1 .. 3, 1 .. 4 of int
 
var winid, midx, midy, counter, z, px, py : int := 0
 
 
var p1mark := 0
 
setscreen ("graphics:800;500")
 
 
var x := 300
 
var y := 300
 
var colo := 38
 
var vx, vy := 100
 
 
proc choice
 
    counter += 1
 
 
 
end choice
 
 
for a : 1 .. 3
 
    for b : 1 .. 4
 
        mark (a, b) := 0
 
    end for
 
end for
 
 
 
%Play Board
 
 
for a : 1 .. 3
 
    for b : 1 .. 4
 
        drawfillbox (x, y, x + 100, y + 100, colo)
 
        x += vx
 
        colo += 2
 
    end for
 
    x := 300
 
    drawfillbox (x, y, x + 100, y + 100, colo)
 
    y -= vy
 
end for
 
 
drawfilloval (350, 350, 40, 40, 1)
 
drawfilloval (450, 350, 40, 40, 6)
 
drawfilloval (550, 350, 40, 40, 9)
 
drawfilloval (650, 350, 40, 40, 36)
 
 
drawfilloval (350, 250, 40, 40, 9)
 
drawfilloval (450, 250, 40, 40, 11)
 
drawfilloval (550, 250, 40, 40, 36)
 
drawfilloval (650, 250, 40, 40, 6)
 
 
drawfilloval (350, 150, 40, 40, 5)
 
drawfilloval (450, 150, 40, 40, 1)
 
drawfilloval (550, 150, 40, 40, 11)
 
drawfilloval (650, 150, 40, 40, 5)
 
 
delay (2000)
 
cls
 
x := 300
 
y := 300
 
colo := 38
 
for a : 1 .. 3
 
    for b : 1 .. 4
 
        drawfillbox (x, y, x + 100, y + 100, colo)
 
        x += vx
 
        colo += 2
 
    end for
 
    x := 300
 
    drawfillbox (x, y, x + 100, y + 100, colo)
 
    y -= vy
 
end for
 
 
loop
 
    loop
 
 
        Mouse.Where (x, y, z)
 
        if x >= 300 and y >= 300 and x <= 400 and y <= 400 and z = 1 and
 
                mark (1, 1) = 0 then
 
            midx := 330
 
            midy := 330
 
            choice
 
            drawfilloval (350, 350, 40, 40, 1)
 
 
            if counter mod 2 = 0 then
 
                mark (1, 1) := 2
 
 
            end if
 
 
        elsif x >= 400 and y >= 300 and x <= 500 and y <= 400 and z = 1
 
                and
 
                mark (1, 2) = 0 then
 
            midx := 390
 
            midy := 330
 
            choice
 
            drawfilloval (450, 350, 40, 40, 6)
 
            if mark (1, 1) = mark (3, 2) and mark (3, 2) not= 0 then
 
                p1mark := p1mark + 1
 
            end if
 
            if counter mod 2 = 0 then
 
                mark (1, 2) := 2
 
 
            end if
 
        elsif x >= 500 and y >= 300 and x <= 600 and y <= 400 and z = 1
 
                and
 
                mark (1, 3) = 0 then
 
            midx := 450
 
            midy := 330
 
            drawfilloval (550, 350, 40, 40, 9)
 
            choice
 
            if counter mod 2 = 0 then
 
                mark (1, 3) := 2
 
 
            end if
 
        elsif x >= 600 and y >= 300 and x <= 700 and y <= 400 and z = 1
 
                and
 
                mark (1, 4) = 0 then
 
            midx := 330
 
            midy := 270
 
            drawfilloval (650, 350, 40, 40, 36)
 
            choice
 
            if counter mod 2 = 0 then
 
                mark (1, 4) := 2
 
 
            end if
 
        elsif x >= 300 and y >= 200 and x <= 400 and y <= 300 and z = 1
 
                and
 
                mark (2, 1) = 0 then
 
            midx := 390
 
            midy := 270
 
            drawfilloval (350, 250, 40, 40, 9)
 
            choice
 
            if counter mod 2 = 0 then
 
                mark (2, 1) := 2
 
 
            end if
 
        elsif x >= 400 and y >= 200 and x <= 500 and y <= 300 and z = 1
 
                and
 
                mark (2, 2) = 0 then
 
            drawfilloval (450, 250, 40, 40, 11)
 
            midx := 450
 
            midy := 270
 
            choice
 
            if counter mod 2 = 0 then
 
                mark (2, 2) := 2
 
 
            end if
 
        elsif x >= 500 and y >= 200 and x <= 600 and y <= 300 and z = 1
 
                and
 
                mark (2, 3) = 0 then
 
            drawfilloval (550, 250, 40, 40, 36)
 
            midx := 330
 
            midy := 210
 
            choice
 
            if counter mod 2 = 0 then
 
                mark (2, 3) := 2
 
 
            end if
 
        elsif x >= 600 and y >= 200 and x <= 700 and y <= 300 and z = 1
 
                and
 
                mark (2, 4) = 0 then
 
            drawfilloval (650, 250, 40, 40, 6)
 
            midx := 390
 
            midy := 210
 
            choice
 
            if counter mod 2 = 0 then
 
                mark (2, 4) := 2
 
 
            end if
 
        elsif x >= 300 and y >= 100 and x <= 400 and y <= 200 and z = 1
 
                and
 
                mark (3, 1) = 0 then
 
            drawfilloval (350, 150, 40, 40, 5)
 
            midx := 450
 
            midy := 210
 
            choice
 
            if counter mod 2 = 0 then
 
                mark (3, 1) := 2
 
 
            end if
 
        elsif x >= 400 and y >= 100 and x <= 500 and y <= 200 and z = 1 and
 
                mark (3, 2) = 0 then
 
            drawfilloval (450, 150, 40, 40, 1)
 
            midx := 450
 
            midy := 210
 
            choice
 
            if counter mod 2 = 0 then
 
                mark (3, 2) := 2
 
 
            end if
 
 
        elsif x >= 500 and y >= 100 and x <= 600 and y <= 200 and z = 1
 
                and
 
                mark (3, 3) = 0 then
 
            drawfilloval (550, 150, 40, 40, 11)
 
            midx := 450
 
            midy := 210
 
            choice
 
            if counter mod 2 = 0 then
 
                mark (3, 3) := 2
 
 
            end if
 
        elsif x >= 600 and y >= 100 and x <= 700 and y <= 200 and z = 1
 
                and
 
                mark (3, 4) = 0 then
 
            drawfilloval (650, 150, 40, 40, 5)
 
            midx := 450
 
            midy := 210
 
            if counter mod 2 = 0 then
 
                mark (3, 4) := 2
 
            end if
 
        end if
 
        if mark (1, 1) = mark (3, 2) and mark (3, 2) not= 0 then
 
 
            p1mark := p1mark + 1
 
            locate (1, 1)
 
            put p1mark
 
 
        elsif
 
                mark (1, 1) not= mark (3, 2) and mark (1, 1) not= 0 and z
 
                not= 0 and mark (3, 2) = 0
 
                then
 
            drawfillbox (300, 300, 400, 400, blue)
 
 
        end if
 
    end loop
 
 
 
 
 
end loop  | 	  
		
 | 
			 
			
				 | 
			 
		  | 
	 
	 
		 | 
		
		 | 
	 
	  
		  | 
	 
				 
		Delos
 
  
 
    
		 | 
		
		
			
				  Posted: Tue Jan 17, 2006 7:14 pm    Post subject: (No subject)  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				OMG DON'T MAKE YOUR TITLES IN ALL CAPS.  Seriously, it's a little annoying.
 
 
Anyway, what you're looking at here is a case of matching variables.  I see you're using the array 'mark' to hold the values of the cards.  What you'll do is randomly assign numbers to mark.  For instance:
 
 
	  | code: | 	 		  
 
mark (1) := Rand.Int (1, 4)
 
 
% or, to use the more commonly taught yet less useful procedure:
 
 
randint (mark(1), 1, 4)
 
  | 	  
 
 
Once you've done that you'll draw all your circles using the value of each element of mark to determine what colour will be used.
 
 
The main challenge will come once all the circles have been covered up.  Here, you'll have to take sets of two mouse clicks.  Each will open up one of the boxes.  You will need to know which boxes have been opened (for your intents, this means having a second array that will hold values indicating 'open' or 'closed' - i.e. boolean).  If you don't understand booleans, or don't want to, just use numbers (something like '0 means closed', '1 means open' type thing).
 
Once both are open, compare the values in 'mark'.  If both numbers are the same, you're good.
 
 
So, to graphically summarize:
 
 
	  | code: | 	 		  
 
% Create numbers in mark:
 
1  4  2  3
 
2  6  5  4
 
1  3  6  5
 
 
% Circles will be drawn accordingly, and then covered up.
 
% Now, the 'openOrClose' array will look like:
 
0  0  0  0
 
0  0  0  0
 
0  0  0  0
 
 
% Now, click on a box:
 
0  1  0  0
 
0  0  0  0
 
0  0  0  0
 
% and a second box
 
0  1  0  0
 
0  0  1  0
 
0  0  0  0
 
 
% This translates to:
 
% mark (1,2) and mark (2,3)
 
% which is:
 
% 4 and 5
 
% They are not equal, hence you close up the boxes again and try again.
 
 
  | 	  
 
 
And there you go.  Try working around those ideas, and good luck.
		
 | 
			 
			
				 | 
			 
		  | 
	 
	 
		 | 
		
		 | 
	 
	  
		  | 
	 
				 
		lollipopgirl
 
 
 
    
		 | 
		
		
			
				  Posted: Tue Jan 17, 2006 7:36 pm    Post subject: (No subject)  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				| ok..i giave each pair a num, and i use a var named open to control the box is open or close, i am still confused about how do u do it.
		
 | 
			 
			
				 | 
			 
		  | 
	 
	 
		 | 
		
		 | 
	 
	  
		  | 
	 
				 
		Rasta Fella
 
  
 
    
		 | 
		
		
			
				  Posted: Tue Jan 17, 2006 7:45 pm    Post subject: (No subject)  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				Delos wrote: OMG DON'T MAKE YOUR TITLES IN ALL CAPS.  Seriously, it's a little annoying. 
 
Quite, hypocritical if you ask me. But Delos is right, lollipopgirl you should check and read over the Rules of this forum, that way more users will respect you.
 
 
I wonder how many people actually read the rules?..O well...
		
 | 
			 
			
				 | 
			 
		  | 
	 
	 
		 | 
		
		 | 
	 
	  
		  | 
	 
				 
		lollipopgirl
 
 
 
    
		 | 
		
		
			
				  Posted: Tue Jan 17, 2006 8:05 pm    Post subject: (No subject)  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				the mousewhere did not work sumhow
 
it work well b4
 
 
 
	  | code: | 	 		  var player1, player2, first : string
 
var mark : array 1 .. 3, 1 .. 4 of int
 
var winid, midx, midy, counter, win, z, px, py : int := 0
 
var OPEN : int
 
OPEN := 0
 
var p1mark := 0
 
setscreen ("graphics:800;500")
 
 
var x := 300
 
var y := 300
 
var colo := 38
 
var vx, vy := 100
 
 
proc choice
 
    counter += 1
 
 
 
end choice
 
 
for a : 1 .. 3
 
    for b : 1 .. 4
 
        mark (a, b) := 0
 
    end for
 
end for
 
 
 
%Play Board
 
 
 
mark (1, 1) := 1
 
mark (3, 2) := 1
 
mark (1, 2) := 2
 
mark (2, 4) := 2
 
mark (1, 3) := 3
 
mark (2, 1) := 3
 
mark (1, 4) := 4
 
mark (2, 3) := 4
 
mark (2, 2) := 5
 
mark (3, 3) := 5
 
mark (3, 1) := 6
 
mark (3, 4) := 6
 
for a : 1 .. 3
 
    for b : 1 .. 4
 
        drawfillbox (x, y, x + 100, y + 100, colo)
 
        x += vx
 
        colo += 2
 
    end for
 
    x := 300
 
    drawfillbox (x, y, x + 100, y + 100, colo)
 
    y -= vy
 
end for
 
 
drawfilloval (350, 350, 40, 40, 1)
 
drawfilloval (450, 350, 40, 40, 6)
 
drawfilloval (550, 350, 40, 40, 9)
 
drawfilloval (650, 350, 40, 40, 36)
 
 
drawfilloval (350, 250, 40, 40, 9)
 
drawfilloval (450, 250, 40, 40, 11)
 
drawfilloval (550, 250, 40, 40, 36)
 
drawfilloval (650, 250, 40, 40, 6)
 
 
drawfilloval (350, 150, 40, 40, 5)
 
drawfilloval (450, 150, 40, 40, 1)
 
drawfilloval (550, 150, 40, 40, 11)
 
drawfilloval (650, 150, 40, 40, 5)
 
 
delay (2000)
 
cls
 
x := 300
 
y := 300
 
colo := 38
 
for a : 1 .. 3
 
    for b : 1 .. 4
 
        drawfillbox (x, y, x + 100, y + 100, colo)
 
        x += vx
 
        colo += 2
 
    end for
 
    x := 300
 
    drawfillbox (x, y, x + 100, y + 100, colo)
 
    y -= vy
 
end for
 
 
 
 
loop
 
    loop
 
 
        Mouse.Where (x, y, z)
 
        if x >= 300 and y >= 300 and x <= 400 and y <= 400 and z = 1 and
 
                mark (1, 1) = 0 then
 
            midx := 330
 
            midy := 330
 
            choice
 
            drawfilloval (350, 350, 40, 40, 1)
 
            OPEN := 1
 
 
 
 
        elsif x >= 400 and y >= 300 and x <= 500 and y <= 400 and z = 1
 
                and
 
                mark (1, 2) = 0 then
 
            midx := 390
 
            midy := 330
 
            choice
 
            drawfilloval (450, 350, 40, 40, 6)
 
            OPEN := 1
 
 
        elsif x >= 500 and y >= 300 and x <= 600 and y <= 400 and z = 1
 
                and
 
                mark (1, 3) = 0 then
 
            midx := 450
 
            midy := 330
 
            drawfilloval (550, 350, 40, 40, 9)
 
            choice
 
            OPEN := 1
 
 
        elsif x >= 600 and y >= 300 and x <= 700 and y <= 400 and z = 1
 
                and
 
                mark (1, 4) = 0 then
 
            midx := 330
 
            midy := 270
 
            drawfilloval (650, 350, 40, 40, 36)
 
            choice
 
            OPEN := 1
 
 
        elsif x >= 300 and y >= 200 and x <= 400 and y <= 300 and z = 1
 
                and
 
                mark (2, 1) = 0 then
 
            midx := 390
 
            midy := 270
 
            drawfilloval (350, 250, 40, 40, 9)
 
            choice
 
            OPEN := 1
 
 
        elsif x >= 400 and y >= 200 and x <= 500 and y <= 300 and z = 1
 
                and
 
                mark (2, 2) = 0 then
 
            drawfilloval (450, 250, 40, 40, 11)
 
            midx := 450
 
            midy := 270
 
            choice
 
            OPEN := 1
 
 
        elsif x >= 500 and y >= 200 and x <= 600 and y <= 300 and z = 1
 
                and
 
                mark (2, 3) = 0 then
 
            drawfilloval (550, 250, 40, 40, 36)
 
            midx := 330
 
            midy := 210
 
            choice
 
            OPEN := 1
 
 
        elsif x >= 600 and y >= 200 and x <= 700 and y <= 300 and z = 1
 
                and
 
                mark (2, 4) = 0 then
 
            drawfilloval (650, 250, 40, 40, 6)
 
            midx := 390
 
            midy := 210
 
            choice
 
            OPEN := 1
 
 
        elsif x >= 300 and y >= 100 and x <= 400 and y <= 200 and z = 1
 
                and
 
                mark (3, 1) = 0 then
 
            drawfilloval (350, 150, 40, 40, 5)
 
            midx := 450
 
            midy := 210
 
            choice
 
            OPEN := 1
 
 
        elsif x >= 400 and y >= 100 and x <= 500 and y <= 200 and z = 1 
 
 
and
 
                mark (3, 2) = 0 then
 
            drawfilloval (450, 150, 40, 40, 1)
 
            midx := 450
 
            midy := 210
 
            choice
 
            OPEN := 1
 
 
 
        elsif x >= 500 and y >= 100 and x <= 600 and y <= 200 and z = 1
 
                and
 
                mark (3, 3) = 0 then
 
            drawfilloval (550, 150, 40, 40, 11)
 
            midx := 450
 
            midy := 210
 
            choice
 
            OPEN := 1
 
 
        elsif x >= 600 and y >= 100 and x <= 700 and y <= 200 and z = 1
 
                and
 
                mark (3, 4) = 0 then
 
            drawfilloval (650, 150, 40, 40, 5)
 
            midx := 450
 
            midy := 210
 
            OPEN := 1
 
 
        end if
 
 
    end loop
 
 
 
 
 
end loop  | 	  
 
 
Martin says: Added code tags  
		
 | 
			 
			
				 | 
			 
		  | 
	 
	 
		 | 
		
		 | 
	 
	  
		  | 
	 
				 
		lollipopgirl
 
 
 
    
		 | 
		
		
			
				  Posted: Tue Jan 17, 2006 8:06 pm    Post subject: (No subject)  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				the mousewhere did not work,
 
i m sure i work well b4
 
 
	  | code: | 	 		  var player1, player2, first : string
 
var mark : array 1 .. 3, 1 .. 4 of int
 
var winid, midx, midy, counter, win, z, px, py : int := 0
 
var OPEN : int
 
OPEN := 0
 
var p1mark := 0
 
setscreen ("graphics:800;500")
 
 
var x := 300
 
var y := 300
 
var colo := 38
 
var vx, vy := 100
 
 
proc choice
 
    counter += 1
 
 
 
end choice
 
 
for a : 1 .. 3
 
    for b : 1 .. 4
 
        mark (a, b) := 0
 
    end for
 
end for
 
 
 
%Play Board
 
 
 
mark (1, 1) := 1
 
mark (3, 2) := 1
 
mark (1, 2) := 2
 
mark (2, 4) := 2
 
mark (1, 3) := 3
 
mark (2, 1) := 3
 
mark (1, 4) := 4
 
mark (2, 3) := 4
 
mark (2, 2) := 5
 
mark (3, 3) := 5
 
mark (3, 1) := 6
 
mark (3, 4) := 6
 
for a : 1 .. 3
 
    for b : 1 .. 4
 
        drawfillbox (x, y, x + 100, y + 100, colo)
 
        x += vx
 
        colo += 2
 
    end for
 
    x := 300
 
    drawfillbox (x, y, x + 100, y + 100, colo)
 
    y -= vy
 
end for
 
 
drawfilloval (350, 350, 40, 40, 1)
 
drawfilloval (450, 350, 40, 40, 6)
 
drawfilloval (550, 350, 40, 40, 9)
 
drawfilloval (650, 350, 40, 40, 36)
 
 
drawfilloval (350, 250, 40, 40, 9)
 
drawfilloval (450, 250, 40, 40, 11)
 
drawfilloval (550, 250, 40, 40, 36)
 
drawfilloval (650, 250, 40, 40, 6)
 
 
drawfilloval (350, 150, 40, 40, 5)
 
drawfilloval (450, 150, 40, 40, 1)
 
drawfilloval (550, 150, 40, 40, 11)
 
drawfilloval (650, 150, 40, 40, 5)
 
 
delay (2000)
 
cls
 
x := 300
 
y := 300
 
colo := 38
 
for a : 1 .. 3
 
    for b : 1 .. 4
 
        drawfillbox (x, y, x + 100, y + 100, colo)
 
        x += vx
 
        colo += 2
 
    end for
 
    x := 300
 
    drawfillbox (x, y, x + 100, y + 100, colo)
 
    y -= vy
 
end for
 
 
 
 
loop
 
    loop
 
 
        Mouse.Where (x, y, z)
 
        if x >= 300 and y >= 300 and x <= 400 and y <= 400 and z = 1 and
 
                mark (1, 1) = 0 then
 
            midx := 330
 
            midy := 330
 
            choice
 
            drawfilloval (350, 350, 40, 40, 1)
 
            OPEN := 1
 
 
 
 
        elsif x >= 400 and y >= 300 and x <= 500 and y <= 400 and z = 1
 
                and
 
                mark (1, 2) = 0 then
 
            midx := 390
 
            midy := 330
 
            choice
 
            drawfilloval (450, 350, 40, 40, 6)
 
            OPEN := 1
 
 
        elsif x >= 500 and y >= 300 and x <= 600 and y <= 400 and z = 1
 
                and
 
                mark (1, 3) = 0 then
 
            midx := 450
 
            midy := 330
 
            drawfilloval (550, 350, 40, 40, 9)
 
            choice
 
            OPEN := 1
 
 
        elsif x >= 600 and y >= 300 and x <= 700 and y <= 400 and z = 1
 
                and
 
                mark (1, 4) = 0 then
 
            midx := 330
 
            midy := 270
 
            drawfilloval (650, 350, 40, 40, 36)
 
            choice
 
            OPEN := 1
 
 
        elsif x >= 300 and y >= 200 and x <= 400 and y <= 300 and z = 1
 
                and
 
                mark (2, 1) = 0 then
 
            midx := 390
 
            midy := 270
 
            drawfilloval (350, 250, 40, 40, 9)
 
            choice
 
            OPEN := 1
 
 
        elsif x >= 400 and y >= 200 and x <= 500 and y <= 300 and z = 1
 
                and
 
                mark (2, 2) = 0 then
 
            drawfilloval (450, 250, 40, 40, 11)
 
            midx := 450
 
            midy := 270
 
            choice
 
            OPEN := 1
 
 
        elsif x >= 500 and y >= 200 and x <= 600 and y <= 300 and z = 1
 
                and
 
                mark (2, 3) = 0 then
 
            drawfilloval (550, 250, 40, 40, 36)
 
            midx := 330
 
            midy := 210
 
            choice
 
            OPEN := 1
 
 
        elsif x >= 600 and y >= 200 and x <= 700 and y <= 300 and z = 1
 
                and
 
                mark (2, 4) = 0 then
 
            drawfilloval (650, 250, 40, 40, 6)
 
            midx := 390
 
            midy := 210
 
            choice
 
            OPEN := 1
 
 
        elsif x >= 300 and y >= 100 and x <= 400 and y <= 200 and z = 1
 
                and
 
                mark (3, 1) = 0 then
 
            drawfilloval (350, 150, 40, 40, 5)
 
            midx := 450
 
            midy := 210
 
            choice
 
            OPEN := 1
 
 
        elsif x >= 400 and y >= 100 and x <= 500 and y <= 200 and z = 1 
 
 
and
 
                mark (3, 2) = 0 then
 
            drawfilloval (450, 150, 40, 40, 1)
 
            midx := 450
 
            midy := 210
 
            choice
 
            OPEN := 1
 
 
 
        elsif x >= 500 and y >= 100 and x <= 600 and y <= 200 and z = 1
 
                and
 
                mark (3, 3) = 0 then
 
            drawfilloval (550, 150, 40, 40, 11)
 
            midx := 450
 
            midy := 210
 
            choice
 
            OPEN := 1
 
 
        elsif x >= 600 and y >= 100 and x <= 700 and y <= 200 and z = 1
 
                and
 
                mark (3, 4) = 0 then
 
            drawfilloval (650, 150, 40, 40, 5)
 
            midx := 450
 
            midy := 210
 
            OPEN := 1
 
 
        end if
 
 
    end loop
 
 
 
 
 
end loop
 
 
 
  | 	  
		
 | 
			 
			
				 | 
			 
		  | 
	 
	 
		 | 
		
		 | 
	 
	  
		  | 
	 
				 
		Delos
 
  
 
    
		 | 
		
		
			
				  Posted: Tue Jan 17, 2006 8:31 pm    Post subject: (No subject)  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				I guess you didn't quite understand what I was trying to say.  You don't want a single variable for 'OPEN'.  You want an array thereof.  This array is to match the array you already have for the circles, hence it will be able to tell you what state each box is in (open or closed, 1 or 0).
 
Now you can use those values to determine which boxes have been opened, and hence compare the correct set of numbers.  If they match, you could (for example) set their values in 'OPEN' to '2', or '-1', or '32' or some value to indicate that they are no longer in play.  If they do not match, simply close them (set their 'OPEN' value to 0 and redraw the box over them), and start the click-check again.
		
 | 
			 
			
				 | 
			 
		  | 
	 
	 
		 | 
		
		 | 
	 
	  
		  | 
	 
		 
		Sponsor Sponsor 
		 
  
		 | 
		
 | 
	 
	 
		  | 
	 
				 
		lollipopgirl
 
 
 
    
		 | 
		
		
			
				  Posted: Tue Jan 17, 2006 8:42 pm    Post subject: (No subject)  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				ok..i got it but what is the problem with my mousewhere...
 
	  | code: | 	 		  var player1, player2, first : string
 
var mark : array 1 .. 3, 1 .. 4 of int
 
var winid, midx, midy, counter, z, px, py : int := 0
 
var OPEN : array 1 .. 3, 1 .. 4 of int
 
 
var p1mark := 0
 
setscreen ("graphics:800;500")
 
 
var x := 300
 
var y := 300
 
var colo := 38
 
var vx, vy := 100
 
 
proc choice
 
    counter += 1
 
 
 
end choice
 
 
for a : 1 .. 3
 
    for b : 1 .. 4
 
        mark (a, b) := 0
 
    end for
 
end for
 
 
 
%Play Board
 
OPEN (1, 1) := 0
 
OPEN (1, 2) := 0
 
OPEN (1, 3) := 0
 
OPEN (1, 4) := 0
 
OPEN (2, 1) := 0
 
OPEN (2, 2) := 0
 
OPEN (2, 3) := 0
 
OPEN (2, 4) := 0
 
OPEN (3, 1) := 0
 
OPEN (3, 2) := 0
 
OPEN (3, 3) := 0
 
OPEN (3, 4) := 0
 
mark (1, 1) := 1
 
mark (3, 2) := 1
 
mark (1, 2) := 2
 
mark (2, 4) := 2
 
mark (1, 3) := 3
 
mark (2, 1) := 3
 
mark (1, 4) := 4
 
mark (2, 3) := 4
 
mark (2, 2) := 5
 
mark (3, 3) := 5
 
mark (3, 1) := 6
 
mark (3, 4) := 6
 
for a : 1 .. 3
 
    for b : 1 .. 4
 
        drawfillbox (x, y, x + 100, y + 100, colo)
 
        x += vx
 
        colo += 2
 
    end for
 
    x := 300
 
    drawfillbox (x, y, x + 100, y + 100, colo)
 
    y -= vy
 
end for
 
 
drawfilloval (350, 350, 40, 40, 1)
 
drawfilloval (450, 350, 40, 40, 6)
 
drawfilloval (550, 350, 40, 40, 9)
 
drawfilloval (650, 350, 40, 40, 36)
 
 
drawfilloval (350, 250, 40, 40, 9)
 
drawfilloval (450, 250, 40, 40, 11)
 
drawfilloval (550, 250, 40, 40, 36)
 
drawfilloval (650, 250, 40, 40, 6)
 
 
drawfilloval (350, 150, 40, 40, 5)
 
drawfilloval (450, 150, 40, 40, 1)
 
drawfilloval (550, 150, 40, 40, 11)
 
drawfilloval (650, 150, 40, 40, 5)
 
delay (2000)
 
cls
 
x := 300
 
y := 300
 
colo := 38
 
for a : 1 .. 3
 
    for b : 1 .. 4
 
        drawfillbox (x, y, x + 100, y + 100, colo)
 
        x += vx
 
        colo += 2
 
    end for
 
    x := 300
 
    drawfillbox (x, y, x + 100, y + 100, colo)
 
    y -= vy
 
end for
 
 
 
 
loop
 
 
    Mouse.Where (x, y, z)
 
    if x >= 300 and y >= 300 and x <= 400 and y <= 400 and z = 1 and
 
            mark (1, 1) = 0 then
 
        midx := 330
 
        midy := 330
 
        choice
 
        drawfilloval (350, 350, 40, 40, 1)
 
        OPEN (1, 1) := 1
 
 
 
 
    elsif x >= 400 and y >= 300 and x <= 500 and y <= 400 and z = 1
 
            and
 
            mark (1, 2) = 0 then
 
        midx := 390
 
        midy := 330
 
        choice
 
        drawfilloval (450, 350, 40, 40, 6)
 
        OPEN (1, 2) := 1
 
 
    elsif x >= 500 and y >= 300 and x <= 600 and y <= 400 and z = 1
 
            and
 
            mark (1, 3) = 0 then
 
        midx := 450
 
        midy := 330
 
        drawfilloval (550, 350, 40, 40, 9)
 
        choice
 
        OPEN (1, 3) := 1
 
 
    elsif x >= 600 and y >= 300 and x <= 700 and y <= 400 and z = 1
 
            and
 
            mark (1, 4) = 0 then
 
        midx := 330
 
        midy := 270
 
        drawfilloval (650, 350, 40, 40, 36)
 
        choice
 
        OPEN (1, 4) := 1
 
 
    elsif x >= 300 and y >= 200 and x <= 400 and y <= 300 and z = 1
 
            and
 
            mark (2, 1) = 0 then
 
        midx := 390
 
        midy := 270
 
        drawfilloval (350, 250, 40, 40, 9)
 
        choice
 
        OPEN (2, 1) := 1
 
 
    elsif x >= 400 and y >= 200 and x <= 500 and y <= 300 and z = 1
 
            and
 
            mark (2, 2) = 0 then
 
        drawfilloval (450, 250, 40, 40, 11)
 
        midx := 450
 
        midy := 270
 
        choice
 
        OPEN (2, 2) := 1
 
 
    elsif x >= 500 and y >= 200 and x <= 600 and y <= 300 and z = 1
 
            and
 
            mark (2, 3) = 0 then
 
        drawfilloval (550, 250, 40, 40, 36)
 
        midx := 330
 
        midy := 210
 
        choice
 
        OPEN (2, 3) := 1
 
 
    elsif x >= 600 and y >= 200 and x <= 700 and y <= 300 and z = 1
 
            and
 
            mark (2, 4) = 0 then
 
        drawfilloval (650, 250, 40, 40, 6)
 
        midx := 390
 
        midy := 210
 
        choice
 
        OPEN (2, 4) := 1
 
 
    elsif x >= 300 and y >= 100 and x <= 400 and y <= 200 and z = 1
 
            and
 
            mark (3, 1) = 0 then
 
        drawfilloval (350, 150, 40, 40, 5)
 
        midx := 450
 
        midy := 210
 
        choice
 
        OPEN (3, 1) := 1
 
 
    elsif x >= 400 and y >= 100 and x <= 500 and y <= 200 and z = 1 and
 
            mark (3, 2) = 0 then
 
        drawfilloval (450, 150, 40, 40, 1)
 
        midx := 450
 
        midy := 210
 
        choice
 
        OPEN (3, 2) := 1
 
 
 
 
    elsif x >= 500 and y >= 100 and x <= 600 and y <= 200 and z = 1
 
            and
 
            mark (3, 3) = 0 then
 
        drawfilloval (550, 150, 40, 40, 11)
 
        midx := 450
 
        midy := 210
 
        choice
 
        OPEN (3, 3) := 1
 
 
 
    elsif x >= 600 and y >= 100 and x <= 700 and y <= 200 and z = 1
 
            and
 
            mark (3, 4) = 0 then
 
        drawfilloval (650, 150, 40, 40, 5)
 
        midx := 450
 
        midy := 210
 
        OPEN (3, 4) := 1
 
 
 
    end if
 
    if mark (1, 1) = mark (3, 2) and
 
            OPEN (1, 1) not= 0 and OPEN (3, 2) not= 0 then
 
        p1mark := p1mark + 1
 
    elsif
 
            OPEN (1, 1) = 1 then
 
        drawfillbox (300, 300, 400, 400, blue)
 
 
    end if
 
 
 
 
 
end loop
 
  | 	  
		
 | 
			 
			
				 | 
			 
		  | 
	 
	 
		 | 
		
		 | 
	 
	  
		  | 
	 
				 
		lollipopgirl
 
 
 
    
		 | 
		
		
			
				  Posted: Tue Jan 17, 2006 8:55 pm    Post subject: (No subject)  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				i fixed my mousewhere but my matched pair wont add up score is this command right?
 
    if mark (1, 1) = mark (3, 2) and
 
            OPEN (1, 1) not= 0 and OPEN (3, 2) not= 0 then
 
        p1mark := p1mark + 1
 
        put p1mark
 
    elsif
 
            OPEN (1, 1) = 1 then
 
        drawfillbox (300, 300, 400, 400, blue)
 
    end if
		
 | 
			 
			
				 | 
			 
		  | 
	 
	 
		 | 
		
		 | 
	 
	  
		  | 
	 
				 
		Delos
 
  
 
    
		 | 
		
		
			
				  Posted: Tue Jan 17, 2006 9:16 pm    Post subject: (No subject)  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				You're getting the idea now.
 
 
- Remember that you'll want to be able to check the status of *all* boxes, not just (1,1) and (3,2).  So basically, you'll be using the values of OPEN to determine which boxes are open, then compare the values in 'mark' of those specific values.
 
- Don't forget to reset all values of OPEN if the player does not find a match (do this with two for loops (a nested for loop) instead of manually).
 
- Also, not too sure what the procedure 'choice' is supposed to be doing
		
 | 
			 
			
				 | 
			 
		  | 
	 
	 
		 | 
		
		 | 
	 
	  
		  | 
	 
				 
		lollipopgirl
 
 
 
    
		 | 
		
		
			
				  Posted: Wed Jan 18, 2006 10:19 am    Post subject: (No subject)  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				I got what ur r saying but i dun know how to do it in command..  
		
 | 
			 
			
				 | 
			 
		  | 
	 
	 
		 | 
		
		 | 
	 
	  
		  | 
	 
				 
		lollipopgirl
 
 
 
    
		 | 
		
		
			
				  Posted: Wed Jan 18, 2006 10:40 am    Post subject: (No subject)  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				i did this but it wont work..
 
 
	  | code: | 	 		   if OPEN (1, 1) := 1 or OPEN (1, 2) := 1 or OPEN (1, 3) := 1 or OPEN (1, 4) := 1 or OPEN (2, 1) := 1 or OPEN (2, 2) := 1 or
 
            OPEN (2, 3) := 1 or OPEN (2, 4) := 1 or OPEN (3, 1) := 1 or OPEN (3, 2) := 1 or OPEN (3, 3) := 1 or OPEN (3, 4) := 1 and
 
            OPEN (1, 1) := 1 or OPEN (1, 2) := 1 or OPEN (1, 3) := 1 or OPEN (1, 4) := 1 or OPEN (2, 1) := 1 or OPEN (2, 2) := 1 or
 
            OPEN (2, 3) := 1 or OPEN (2, 4) := 1 or OPEN (3, 1) := 1 or OPEN (3, 2) := 1 or OPEN (3, 3) := 1 or OPEN (3, 4) := 1 and
 
            mark (1, 1) := 1
 
        mark (3, 2) := 1
 
        mark (1, 2) := 2 or
 
            mark (2, 4) := 2
 
        mark (1, 3) := 3 or
 
            mark (2, 1) := 3
 
        mark (1, 4) := 4 or
 
            mark (2, 3) := 4
 
        mark (2, 2) := 5 or
 
            mark (3, 3) := 5
 
        mark (3, 1) := 6 or
 
            mark (3, 4) := 6 then
 
 
        p1mark := p1mark + 1
 
 
        put p1mark
 
 
    end if  | 	  
		
 | 
			 
			
				 | 
			 
		  | 
	 
	 
		 | 
		
		 | 
	 
	  
		  | 
	 
				 
		lollipopgirl
 
 
 
    
		 | 
		
		
			
				  Posted: Wed Jan 18, 2006 10:48 am    Post subject: (No subject)  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
					  | code: | 	 		  var player1, player2, first : string
 
var mark : array 1 .. 3, 1 .. 4 of int
 
var winid, midx, midy, counter, z, px, py : int := 0
 
var OPEN : array 1 .. 3, 1 .. 4 of int
 
 
var p1mark := 0
 
setscreen ("graphics:800;500")
 
 
var x := 300
 
var y := 300
 
var colo := 38
 
var vx, vy := 100
 
 
 
 
for a : 1 .. 3
 
    for b : 1 .. 4
 
        mark (a, b) := 0
 
    end for
 
end for
 
 
 
%Play Board
 
OPEN (1, 1) := 0
 
OPEN (1, 2) := 0
 
OPEN (1, 3) := 0
 
OPEN (1, 4) := 0
 
OPEN (2, 1) := 0
 
OPEN (2, 2) := 0
 
OPEN (2, 3) := 0
 
OPEN (2, 4) := 0
 
OPEN (3, 1) := 0
 
OPEN (3, 2) := 0
 
OPEN (3, 3) := 0
 
OPEN (3, 4) := 0
 
mark (1, 1) := 1
 
mark (3, 2) := 1
 
mark (1, 2) := 2
 
mark (2, 4) := 2
 
mark (1, 3) := 3
 
mark (2, 1) := 3
 
mark (1, 4) := 4
 
mark (2, 3) := 4
 
mark (2, 2) := 5
 
mark (3, 3) := 5
 
mark (3, 1) := 6
 
mark (3, 4) := 6
 
for a : 1 .. 3
 
    for b : 1 .. 4
 
        drawfillbox (x, y, x + 100, y + 100, colo)
 
        x += vx
 
        colo += 2
 
    end for
 
    x := 300
 
    drawfillbox (x, y, x + 100, y + 100, colo)
 
    y -= vy
 
end for
 
 
drawfilloval (350, 350, 40, 40, 1)
 
drawfilloval (450, 350, 40, 40, 6)
 
drawfilloval (550, 350, 40, 40, 9)
 
drawfilloval (650, 350, 40, 40, 36)
 
 
drawfilloval (350, 250, 40, 40, 9)
 
drawfilloval (450, 250, 40, 40, 11)
 
drawfilloval (550, 250, 40, 40, 36)
 
drawfilloval (650, 250, 40, 40, 6)
 
 
drawfilloval (350, 150, 40, 40, 5)
 
drawfilloval (450, 150, 40, 40, 1)
 
drawfilloval (550, 150, 40, 40, 11)
 
drawfilloval (650, 150, 40, 40, 5)
 
delay (2000)
 
cls
 
x := 300
 
y := 300
 
colo := 38
 
for a : 1 .. 3
 
    for b : 1 .. 4
 
        drawfillbox (x, y, x + 100, y + 100, colo)
 
        x += vx
 
        colo += 2
 
    end for
 
    x := 300
 
    drawfillbox (x, y, x + 100, y + 100, colo)
 
    y -= vy
 
end for
 
 
 
 
loop
 
    loop
 
        mousewhere (x, y, z)
 
 
        if x >= 300 and y >= 300 and x <= 400 and y <= 400 and z = 1 then
 
            midx := 330
 
            midy := 330
 
 
            drawfilloval (350, 350, 40, 40, 1)
 
            OPEN (1, 1) := 1
 
 
 
 
        elsif x >= 400 and y >= 300 and x <= 500 and y <= 400 and z = 1
 
                then
 
            midx := 390
 
            midy := 330
 
 
            drawfilloval (450, 350, 40, 40, 6)
 
            OPEN (1, 2) := 1
 
 
        elsif x >= 500 and y >= 300 and x <= 600 and y <= 400 and z = 1
 
                then
 
            midx := 450
 
            midy := 330
 
            drawfilloval (550, 350, 40, 40, 9)
 
 
            OPEN (1, 3) := 1
 
 
        elsif x >= 600 and y >= 300 and x <= 700 and y <= 400 and z = 1
 
                then
 
            midx := 330
 
            midy := 270
 
            drawfilloval (650, 350, 40, 40, 36)
 
 
            OPEN (1, 4) := 1
 
 
        elsif x >= 300 and y >= 200 and x <= 400 and y <= 300 and z = 1
 
                then
 
            midx := 390
 
            midy := 270
 
            drawfilloval (350, 250, 40, 40, 9)
 
 
            OPEN (2, 1) := 1
 
 
        elsif x >= 400 and y >= 200 and x <= 500 and y <= 300 and z = 1
 
                then
 
            drawfilloval (450, 250, 40, 40, 11)
 
            midx := 450
 
            midy := 270
 
 
            OPEN (2, 2) := 1
 
 
        elsif x >= 500 and y >= 200 and x <= 600 and y <= 300 and z = 1
 
                then
 
            drawfilloval (550, 250, 40, 40, 36)
 
            midx := 330
 
            midy := 210
 
 
            OPEN (2, 3) := 1
 
 
        elsif x >= 600 and y >= 200 and x <= 700 and y <= 300 and z = 1
 
                then
 
            drawfilloval (650, 250, 40, 40, 6)
 
            midx := 390
 
            midy := 210
 
 
            OPEN (2, 4) := 1
 
 
        elsif x >= 300 and y >= 100 and x <= 400 and y <= 200 and z = 1
 
                then
 
            drawfilloval (350, 150, 40, 40, 5)
 
            midx := 450
 
            midy := 210
 
 
            OPEN (3, 1) := 1
 
 
        elsif x >= 400 and y >= 100 and x <= 500 and y <= 200 and z = 1 then
 
            drawfilloval (450, 150, 40, 40, 1)
 
            midx := 450
 
            midy := 210
 
 
            OPEN (3, 2) := 1
 
 
 
 
        elsif x >= 500 and y >= 100 and x <= 600 and y <= 200 and z = 1
 
                then
 
            drawfilloval (550, 150, 40, 40, 11)
 
            midx := 450
 
            midy := 210
 
 
            OPEN (3, 3) := 1
 
 
 
        elsif x >= 600 and y >= 100 and x <= 700 and y <= 200 and z = 1
 
                then
 
            drawfilloval (650, 150, 40, 40, 5)
 
            midx := 450
 
            midy := 210
 
            OPEN (3, 4) := 1
 
 
 
        end if
 
    end loop
 
    if mark (1, 1) = mark (3, 2) and
 
            OPEN (1, 1) not= 0 and OPEN (3, 2) not= 0 then
 
        p1mark := p1mark + 1
 
        put p1mark
 
    elsif
 
            OPEN (1, 1) = 1 then
 
        drawfillbox (300, 300, 400, 400, blue)
 
    end if
 
 
 
        if OPEN (1, 1) not= 0 or OPEN (1, 2) not= 0 or OPEN (1, 3) not= 0 or OPEN (1, 4) not= 0 or OPEN (2, 1) not= 0 or OPEN (2, 2) not= 0 or
 
                OPEN (2, 3) not= 0 or OPEN (2, 4) not= 0 or OPEN (3, 1) not= 0 or OPEN (3, 2) not= 0 or OPEN (3, 3) not= 0 or OPEN (3, 4) not= 0 and
 
                mark (1, 1) = mark (3, 2) or
 
                mark (1, 2) = mark (2, 4) or
 
                mark (1, 3) = mark (2, 1) or
 
                mark (1, 4) = mark (2, 3) or
 
                mark (2, 2) = mark (3, 3) or
 
                mark (3, 1) = mark (3, 4) then
 
 
 
            p1mark := p1mark + 1
 
            put p1mark
 
 
        end if
 
 
 
end loop
 
 
 
  | 	  
 
newest code!   
		
 | 
			 
			
				 | 
			 
		  | 
	 
	 
		 | 
		
		 | 
	 
	  
		  | 
	 
				 
		Albrecd
 
 
 
    
		 | 
		
		
			
				  Posted: Wed Jan 18, 2006 5:30 pm    Post subject: (No subject)  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				| What you could do to make them disapear again is have a counter that one is added to every time a card is turned over, and if it = two then the program checks to see if the two circles are the same, and if they are not the same, it draws their respective boxes back on top of them.
		
 | 
			 
			
				 | 
			 
		  | 
	 
	 
		 | 
		
		 | 
	 
	  
		  | 
	 
				 
		 | 
	 
 
	
	
	 
	
	 |