[(h1 id=" ")]4色ならべ[(/h1)]

title.id=" ".text="4色ならべ"

+

[(p id="msg1")]先手さん[(/p)]

msg.id="msg1".text="先手さん"

+

[(p id="msg2")]どうぞ[(/p)]

msg.id="msg2".text="どうぞ"

+

[(div)][(canvas width="640" height="640")][(/canvas)][(/div)]

canvas.width="640".height="640"

+

var str1="あなたの勝ちです"

?str1="あなたの勝ちです"

+

var str2=" "

?str2=" "

+

var num1=0

?num1=0

+

var num2=0

?num2=0

+

var num3=0

?num3=0

+

var num4=0

?num4=0

+

var x1=0

?x1=0

+

var y1=0

?y1=0

+

var arr1=[]

?arr1[ ][ ]=+

+

var msg1=$("#msg1")

?msg1=id.msg1

+

var msg2=$("#msg2")

?msg2=id.msg2

+

var ctx=$("canvas")

?ctx=canvas+

+

var posX=0

?posX=0

+

var posY=0

?posY=0

+

ctx.on("touchstart mousedown",function(e){ e.preventDefault(); var offset=ctx.offset()

?ctx.click.function

+

posX=(e.clientX || e.originalEvent.changedTouches[0].clientX)-offset.left; posY=(e.clientY || e.originalEvent.changedTouches[0].clientY)-offset.top

?posX=click.positionX

1

?posY=click.positionY

posX=posX-posX%80

?posX=?posX-?posX%80+

+

posY=posY-posY%80

?posY=?posY-?posY%80+

+

num3=num1%4

?num3=?num1%4+

+

y1=posY/80

?y1=?posY/80+

+

x1=posX/80

?x1=?posX/80+

+

switch(num3){

switch?num3==case

case 0:

case:0+

+

str2="red"

in

?str2="red"+

+

arr1[y1][x1]=1

in

?arr1[?y1][?x1]=1+

+

break

break

case 1:

case:1+

+

str2="blue"

in

?str2="blue"+

+

arr1[y1][x1]=10

in

?arr1[?y1][?x1]=10+

+

break

break

case 2:

case:2+

+

str2="green"

in

?str2="green"+

+

arr1[y1][x1]=100

in

?arr1[?y1][?x1]=100+

+

break

break

case 3:

case:3+

+

str2="yellow"

in

?str2="yellow"+

+

arr1[y1][x1]=1000

in

?arr1[?y1][?x1]=1000+

+

break

break

}

}

ctx.drawRect({layer:true, width:80, height:80, x:posX, y:posY, fillStyle:str2, strokeWidth:0, strokeStyle:"black", cornerRadius:0, fromCenter:false,})

?ctx.drawRect (W:80.H:80.x:?posX.y:?posY.fillColor:?str2.lineW:0.lineColor:"black".cornerR:"0".center:"false".)+

+

for(var i=0; i<=6; i++){

for?i=06do

for(var j=0; j<=6; j++){

for?j=06do

num4=arr1[i][j]+arr1[i+1][j]+arr1[i][j+1]+arr1[i+1][j+1]

?num4=?arr1[?i][?j]+?arr1[?i+1][?j]+?arr1[?i][?j+1]+?arr1[?i+1][?j+1]+

+

if(num4==1111){

if?num4==1111+

+

msg2.text(str1)

in

?msg2.text=?str1+

+

num1=num1+1

in

?num1=?num1+1+

+

}

}

}

?j+++loop

1

+

}

?i+++loop

num2=num1%2

?num2=?num1%2+

+

num1=num1+1

?num1=?num1+1+

+

if(num2==0){

if?num2==0+

+

msg1.text("後手さん")

in

?msg1.text="後手さん"+

+

}

}

else if(num2==1){

else if?num2==1+

+

msg1.text("先手さん")

in

?msg1.text="先手さん"+

+

}

}

})

end.function

+