
-----------------------------------
blackviper
Sun Dec 02, 2007 2:27 pm

Turing Memory program
-----------------------------------
hey this is probably a really easy thing to do but i can seem to get the cards to stay in place when a button is clicked on.....i also want that when one button gets clicked and the other one is clicked and they are the same to cancel out and dissappear.....any help is appreciated.....i have been up for since 10:00 am working on this and its now 2:00 pm......i am very tired, in between ive done other homework but i cant figure this out any help is greatly appreciated

edit** the names for the cards when flipped are just tester names.....dont poke fun at them....lol

heres the code i have

% define 4 borders of button

setscreen ("graphics")
const xmin := 100
const ymin := 40
const xmax := 200
const ymax := 75
var xloc, yloc, button : int
drawbox (xmin, ymin, xmax, ymax, black)
drawfill (xmin + 1, ymin + 1, darkgray, black)
locatexy (xmin + 5, ymin + 13)
put "card 1" ..

const xmin2 := 300
const ymin2 := 40
const xmax2 := 400
const ymax2 := 75
var xloc2, yloc2 : int
drawbox (xmin2, ymin2, xmax2, ymax2, black)
drawfill (xmin2 + 1, ymin2 + 1, darkgray, black)

locatexy (xmin2 + 30, ymin2 + 13)
put "card 2" ..

const xmin3 := 500
const ymin3 := 40
const xmax3 := 600
const ymax3 := 75
var xloc3, yloc3 : int
drawbox (xmin3, ymin3, xmax3, ymax3, black)
drawfill (xmin3 + 1, ymin3 + 1, darkgray, black)

locatexy (xmin3 + 30, ymin3 + 13)
put "card 3" ..

const xmin4 := 100
const ymin4 := 100
const xmax4 := 200
const ymax4 := 140
var xloc4, yloc4 : int
drawbox (xmin4, ymin4, xmax4, ymax4, black)
drawfill (xmin4 + 1, ymin4 + 1, darkgray, black)

locatexy (xmin4 + 30, ymin4 + 13)
put "card 4" ..


const xmin5 := 300
const ymin5 := 100
const xmax5 := 400
const ymax5 := 140
var xloc5, yloc5 : int
drawbox (xmin5, ymin5, xmax5, ymax5, black)
drawfill (xmin5 + 1, ymin5 + 1, darkgray, black)

locatexy (xmin5 + 30, ymin5 + 13)
put "card 5" ..

const xmin6 := 500
const ymin6 := 100
const xmax6 := 600
const ymax6 := 140
var xloc6, yloc6 : int
drawbox (xmin6, ymin6, xmax6, ymax6, black)
drawfill (xmin6 + 1, ymin6 + 1, darkgray, black)

locatexy (xmin6 + 30, ymin6 + 13)
put "card 6" ..

const xmin7 := 100
const ymin7 := 150
const xmax7 := 200
const ymax7 := 200
var xloc7, yloc7 : int
drawbox (xmin7, ymin7, xmax7, ymax7, black)
drawfill (xmin7 + 1, ymin7 + 1, darkgray, black)

locatexy (xmin7 + 30, ymin7 + 13)
put "card 7" ..

const xmin8 := 300
const ymin8 := 150
const xmax8 := 400
const ymax8 := 200
var xloc8, yloc8 : int
drawbox (xmin8, ymin8, xmax8, ymax8, black)
drawfill (xmin8 + 1, ymin8 + 1, darkgray, black)

locatexy (xmin8 + 30, ymin8 + 13)
put "card 8" ..

const xmin9 := 500
const ymin9 := 150
const xmax9 := 600
const ymax9 := 200
var xloc9, yloc9 : int
drawbox (xmin9, ymin9, xmax9, ymax9, black)
drawfill (xmin9 + 1, ymin9 + 1, darkgray, black)

locatexy (xmin9 + 30, ymin9 + 13)
put "card 9" ..

const xmin10 := 100
const ymin10 := 230
const xmax10 := 200
const ymax10 := 260
var xloc10, yloc10 : int
drawbox (xmin10, ymin10, xmax10, ymax10, black)
drawfill (xmin10 + 1, ymin10 + 1, darkgray, black)

locatexy (xmin10 + 30, ymin10 + 13)
put "card 10" ..

const xmin11 := 300
const ymin11 := 230
const xmax11 := 400
const ymax11 := 260
var xloc11, yloc11 : int
drawbox (xmin11, ymin11, xmax11, ymax11, black)
drawfill (xmin11 + 1, ymin11 + 1, darkgray, black)

locatexy (xmin11 + 30, ymin11 + 13)
put "card 11" ..

const xmin12 := 500
const ymin12 := 230
const xmax12 := 600
const ymax12 := 260
var xloc12, yloc12 : int
drawbox (xmin12, ymin12, xmax12, ymax12, black)
drawfill (xmin12 + 1, ymin12 + 1, darkgray, black)

locatexy (xmin12 + 30, ymin12 + 13)
put "card 12" ..



loop

    mousewhere (xloc, yloc, button)
    mousewhere (xloc2, yloc2, button)
    mousewhere (xloc3, yloc3, button)
    mousewhere (xloc4, yloc4, button)
    mousewhere (xloc5, yloc5, button)
    mousewhere (xloc6, yloc6, button)
    mousewhere (xloc7, yloc7, button)
    mousewhere (xloc8, yloc8, button)
    mousewhere (xloc9, yloc9, button)
    mousewhere (xloc10, yloc10, button)
    mousewhere (xloc11, yloc11, button)
    mousewhere (xloc12, yloc12, button)
    if button = 1 and xloc > xmin and xloc < xmax and yloc > ymin and yloc < ymax then

        drawbox (xmin, ymin, xmax, ymax, black)
        drawfill (xmin + 1, ymin + 1, darkgray, black)
        cls
        drawbox (xmin, ymin, xmax, ymax, black)
        drawfill (xmin + 1, ymin + 1, darkgray, black)
        Draw.Text ("Hippo", 120, 50, defFontID, red)
        drawbox (xmin2, ymin2, xmax2, ymax2, black)
        drawfill (xmin2 + 1, ymin2 + 1, darkgray, black)
        Draw.Text ("card 2", 200, 50, defFontID, red)


    elsif button = 1 and xloc > xmin2 and xloc < xmax2 and yloc > ymin2 and yloc < ymax2 then
        drawbox (xmin, ymin, xmax, ymax, black)
        drawfill (xmin + 1, ymin + 1, darkgray, black)
        Draw.Text ("Tiger", 100, 30, defFontID, red)
        
 

    elsif button = 1 and xloc > xmin3 and xloc < xmax3 and yloc > ymin3 and yloc < ymax3 then
    drawbox (xmin, ymin, xmax, ymax, black)
        drawfill (xmin + 1, ymin + 1, darkgray, black)
        Draw.Text ("Duck", 100, 30, defFontID, red)
    
elsif button = 1 and xloc > xmin4 and xloc < xmax4 and yloc > ymin4 and yloc < ymax4 then
    drawbox (xmin, ymin, xmax, ymax, black)
        drawfill (xmin + 1, ymin + 1, darkgray, black)
        Draw.Text ("Man Bear Pig", 100, 30, defFontID, red)
        
elsif button = 1 and xloc > xmin4 and xloc < xmax4 and yloc > ymin4 and yloc < ymax4 then
    drawbox (xmin, ymin, xmax, ymax, black)
        drawfill (xmin + 1, ymin + 1, darkgray, black)
        Draw.Text ("Laser Beam Sharks", 100, 30, defFontID, red)


elsif button = 1 and xloc > xmin4 and xloc < xmax4 and yloc > ymin4 and yloc < ymax4 then
    drawbox (xmin, ymin, xmax, ymax, black)
        drawfill (xmin + 1, ymin + 1, darkgray, black)
        Draw.Text ("Duck", 100, 30, defFontID, red)

elsif button = 1 and xloc > xmin5 and xloc < xmax5 and yloc > ymin5 and yloc < ymax5 then
    drawbox (xmin, ymin, xmax, ymax, black)
        drawfill (xmin + 1, ymin + 1, darkgray, black)
        Draw.Text ("Hippopotamus", 100, 30, defFontID, red)
        
elsif button = 1 and xloc > xmin6 and xloc < xmax6 and yloc > ymin6 and yloc < ymax6 then
    drawbox (xmin, ymin, xmax, ymax, black)
        drawfill (xmin + 1, ymin + 1, darkgray, black)
        Draw.Text ("Tiger", 100, 30, defFontID, red)

elsif button = 1 and xloc > xmin7 and xloc < xmax7 and yloc > ymin7 and yloc < ymax7 then
    drawbox (xmin, ymin, xmax, ymax, black)
        drawfill (xmin + 1, ymin + 1, darkgray, black)
        Draw.Text ("Zebra", 100, 30, defFontID, red)


elsif button = 1 and xloc > xmin8 and xloc < xmax8 and yloc > ymin8 and yloc < ymax8 then
    drawbox (xmin, ymin, xmax, ymax, black)
        drawfill (xmin + 1, ymin + 1, darkgray, black)
        Draw.Text ("Man Bear Pig", 100, 30, defFontID, red)

elsif button = 1 and xloc > xmin9 and xloc < xmax9 and yloc > ymin9 and yloc < ymax9 then
    drawbox (xmin, ymin, xmax, ymax, black)
        drawfill (xmin + 1, ymin + 1, darkgray, black)
        Draw.Text ("Laser Beam Shark", 100, 30, defFontID, red)
        
        elsif button = 1 and xloc > xmin10 and xloc < xmax10 and yloc > ymin10 and yloc < ymax10 then
    drawbox (xmin, ymin, xmax, ymax, black)
        drawfill (xmin + 1, ymin + 1, darkgray, black)
        Draw.Text ("Ruffl", 100, 30, defFontID, red)
        
        elsif button = 1 and xloc > xmin11 and xloc < xmax11 and yloc > ymin11 and yloc < ymax11 then
    drawbox (xmin, ymin, xmax, ymax, black)
        drawfill (xmin + 1, ymin + 1, darkgray, black)
        Draw.Text ("lololo", 100, 30, defFontID, red)
        
        elsif button = 1 and xloc > xmin12 and xloc < xmax12 and yloc > ymin12 and yloc < ymax12 then
    drawbox (xmin, ymin, xmax, ymax, black)
        drawfill (xmin + 1, ymin + 1, darkgray, black)
        Draw.Text ("orange", 100, 30, defFontID, red)

%elsif button = 1 and xloc12 >= xmin12 then
     % and xloc12 = ymin12
   % and yloc12 