修复井字棋在平局结束游戏时不结算
This commit is contained in:
@@ -37,7 +37,6 @@ local function restart()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function checkBoard(b,p)
|
local function checkBoard(b,p)
|
||||||
for i=1,8 do
|
for i=1,8 do
|
||||||
for j=1,3 do
|
for j=1,3 do
|
||||||
@@ -49,9 +48,17 @@ local function checkBoard(b,p)
|
|||||||
::nextLine::
|
::nextLine::
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
local function full(L)
|
||||||
|
for i=1,9 do
|
||||||
|
if not L[i]then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return true
|
||||||
|
end
|
||||||
local function place(X,x)
|
local function place(X,x)
|
||||||
board[X][x]=round
|
board[X][x]=round
|
||||||
|
SFX.play("move")
|
||||||
lastX,lastx=X,x
|
lastX,lastx=X,x
|
||||||
curX,curx=nil
|
curX,curx=nil
|
||||||
placeTime=Timer()
|
placeTime=Timer()
|
||||||
@@ -59,25 +66,24 @@ local function place(X,x)
|
|||||||
score[X]=round
|
score[X]=round
|
||||||
if checkBoard(score,round)then
|
if checkBoard(score,round)then
|
||||||
gameover=round
|
gameover=round
|
||||||
|
SFX.play("win")
|
||||||
return
|
return
|
||||||
else
|
else
|
||||||
for i=1,9 do
|
if full(score)then
|
||||||
if not score[i]then
|
gameover=true
|
||||||
goto continueGame
|
return
|
||||||
end
|
|
||||||
end
|
end
|
||||||
gameover=true
|
|
||||||
do return end
|
|
||||||
::continueGame::
|
|
||||||
end
|
end
|
||||||
|
SFX.play("reach")
|
||||||
else
|
else
|
||||||
for i=1,9 do
|
if full(board[X])then
|
||||||
if not board[X][i]then
|
SFX.play("emit")
|
||||||
goto continueGame
|
score[X]=true
|
||||||
|
if full(score)then
|
||||||
|
gameover=true
|
||||||
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
score[X]=true
|
|
||||||
::continueGame::
|
|
||||||
end
|
end
|
||||||
if score[x]then
|
if score[x]then
|
||||||
target=false
|
target=false
|
||||||
@@ -89,10 +95,10 @@ end
|
|||||||
|
|
||||||
function sceneInit.UTTT()
|
function sceneInit.UTTT()
|
||||||
restart()
|
restart()
|
||||||
|
BGM.set("truth")
|
||||||
BG.set("bg2")
|
BG.set("bg2")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function Pnt.UTTT()
|
function Pnt.UTTT()
|
||||||
gc.push("transform")
|
gc.push("transform")
|
||||||
--origin pos:0,140; scale:4
|
--origin pos:0,140; scale:4
|
||||||
@@ -125,7 +131,7 @@ function Pnt.UTTT()
|
|||||||
elseif score[X]==1 then
|
elseif score[X]==1 then
|
||||||
gc.setColor(0,0,.5)
|
gc.setColor(0,0,.5)
|
||||||
else
|
else
|
||||||
gc.setColor(.5,.5,.5)
|
gc.setColor(0,0,0)
|
||||||
end
|
end
|
||||||
gc.rectangle("fill",(X-1)%3*30,int((X-1)/3)*30,30,30)
|
gc.rectangle("fill",(X-1)%3*30,int((X-1)/3)*30,30,30)
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user