global points, pootimer, win, tableau, stock, redeals, basecard, rightlist, leftlist
on checkwin
if points = (104 * 10) then
win = "yes"
pootimer = timeout("poo").new(150, #gotoit)
else
checklose()
end if
end
on checklose
if stock.cards.count = 0 then
if redeals = 1 then
repeat with shit = 12 to 12
if sprite(12).member.name = "empty" then
next repeat
end if
repeat with fit = 21 to 24
if sprite(fit).member.name = "empty" then
if (getValue(sprite(shit).member.name) = (getOff(basecard.rank) + 1)) and not leftlist.findPos(getSuit(sprite(shit).member.name)) then
abort()
end if
next repeat
end if
if (getValue(sprite(shit).member.name) = 1) and (getValue(sprite(fit).member.name) = 13) and (getSuit(sprite(shit).member.name) = getSuit(sprite(fit).member.name)) then
abort()
end if
end repeat
repeat with fit = 25 to 28
if sprite(fit).member.name = "empty" then
if (getValue(sprite(shit).member.name) = (getOff(basecard.rank) - 1)) and not rightlist.findPos(getSuit(sprite(shit).member.name)) then
abort()
else
if (getValue(sprite(shit).member.name) = 12) and (getValue(sprite(fit).member.name) = 1) and (getSuit(sprite(shit).member.name) = getSuit(sprite(fit).member.name)) then
abort()
end if
end if
next repeat
end if
if (getValue(sprite(shit).member.name) = (getValue(sprite(fit).member.name) - 1)) and (getSuit(sprite(shit).member.name) = getSuit(sprite(fit).member.name)) then
abort()
end if
end repeat
repeat with fit = 38 to 38
if getValue(sprite(shit).member.name) = getOff(basecard.rank) then
abort()
end if
end repeat
repeat with fit in [40, 54, 68, 82]
if sprite(fit).member.name = "empty" then
abort()
next repeat
end if
if ((getValue(sprite(shit).member.name) = (getValue(sprite(tableau[sprite(fit).row].getlastcard().spnum).member.name) - 1)) or (getValue(sprite(shit).member.name) = (getValue(sprite(tableau[sprite(fit).row].getlastcard().spnum).member.name) + 1))) and (getSuit(sprite(shit).member.name) = getSuit(sprite(tableau[sprite(fit).row].getlastcard().spnum).member.name)) then
abort()
next repeat
end if
if (((getValue(sprite(shit).member.name) = 1) and (getValue(sprite(tableau[sprite(fit).row].getlastcard().spnum).member.name) = 13)) or ((getValue(sprite(shit).member.name) = 13) and (getValue(sprite(tableau[sprite(fit).row].getlastcard().spnum).member.name) = 1))) and (getSuit(sprite(shit).member.name) = getSuit(sprite(tableau[sprite(fit).row].getlastcard().spnum).member.name)) then
abort()
end if
end repeat
end repeat
repeat with shit = 38 to 38
repeat with fit = 21 to 24
if sprite(fit).member.name = "empty" then
if (getValue(sprite(shit).member.name) = (getOff(basecard.rank) + 1)) and not leftlist.findPos(getSuit(sprite(shit).member.name)) then
abort()
end if
next repeat
end if
if (getValue(sprite(shit).member.name) = 1) and (getValue(sprite(fit).member.name) = 13) and (getSuit(sprite(shit).member.name) = getSuit(sprite(fit).member.name)) then
abort()
end if
end repeat
repeat with fit = 25 to 28
if sprite(fit).member.name = "empty" then
if (getValue(sprite(shit).member.name) = (getOff(basecard.rank) - 1)) and not rightlist.findPos(getSuit(sprite(shit).member.name)) then
abort()
else
if (getValue(sprite(shit).member.name) = 12) and (getValue(sprite(fit).member.name) = 1) and (getSuit(sprite(shit).member.name) = getSuit(sprite(fit).member.name)) then
abort()
end if
end if
next repeat
end if
if (getValue(sprite(shit).member.name) = (getValue(sprite(fit).member.name) - 1)) and (getSuit(sprite(shit).member.name) = getSuit(sprite(fit).member.name)) then
abort()
end if
end repeat
repeat with fit in [40, 54, 68, 82]
if sprite(fit).member.name = "empty" then
abort()
next repeat
end if
if ((getValue(sprite(shit).member.name) = (getValue(sprite(tableau[sprite(fit).row].getlastcard().spnum).member.name) - 1)) or (getValue(sprite(shit).member.name) = (getValue(sprite(tableau[sprite(fit).row].getlastcard().spnum).member.name) + 1))) and (getSuit(sprite(shit).member.name) = getSuit(sprite(tableau[sprite(fit).row].getlastcard().spnum).member.name)) then
abort()
next repeat
end if
if (((getValue(sprite(shit).member.name) = 1) and (getValue(sprite(tableau[sprite(fit).row].getlastcard().spnum).member.name) = 13)) or ((getValue(sprite(shit).member.name) = 13) and (getValue(sprite(tableau[sprite(fit).row].getlastcard().spnum).member.name) = 1))) and (getSuit(sprite(shit).member.name) = getSuit(sprite(tableau[sprite(fit).row].getlastcard().spnum).member.name)) then
abort()
end if
end repeat
end repeat
repeat with shit in [40, 54, 68, 82]
if sprite(shit).member.name = "empty" then
abort()
end if
repeat with fit = 21 to 24
if sprite(fit).member.name = "empty" then
if (getValue(sprite(tableau[sprite(shit).row].getlastcard().spnum).member.name) = (getOff(basecard.rank) + 1)) and not leftlist.findPos(getSuit(sprite(tableau[sprite(shit).row].getlastcard().spnum).member.name)) then
abort()
end if
next repeat
end if
if (getValue(sprite(tableau[sprite(shit).row].getlastcard().spnum).member.name) = 1) and (getValue(sprite(fit).member.name) = 13) and (getSuit(sprite(tableau[sprite(shit).row].getlastcard().spnum).member.name) = getSuit(sprite(fit).member.name)) then
abort()
end if
end repeat
repeat with fit = 25 to 28
if sprite(fit).member.name = "empty" then
if (getValue(sprite(tableau[sprite(shit).row].getlastcard().spnum).member.name) = (getOff(basecard.rank) - 1)) and not rightlist.findPos(getSuit(sprite(tableau[sprite(shit).row].getlastcard().spnum).member.name)) then
abort()
else
if (getValue(sprite(tableau[sprite(shit).row].getlastcard().spnum).member.name) = 12) and (getValue(sprite(fit).member.name) = 1) and (getSuit(sprite(tableau[sprite(shit).row].getlastcard().spnum).member.name) = getSuit(sprite(fit).member.name)) then
abort()
end if
end if
next repeat
end if
if (getValue(sprite(tableau[sprite(shit).row].getlastcard().spnum).member.name) = (getValue(sprite(fit).member.name) - 1)) and (getSuit(sprite(tableau[sprite(shit).row].getlastcard().spnum).member.name) = getSuit(sprite(fit).member.name)) then
abort()
end if
end repeat
repeat with fit = 38 to 38
if getValue(sprite(tableau[sprite(shit).row].getlastcard().spnum).member.name) = getOff(basecard.rank) then
abort()
end if
end repeat
repeat with fit in [40, 54, 68, 82]
if shit = fit then
next repeat
end if
if sprite(fit).member.name = "empty" then
abort()
next repeat
end if
if ((getValue(sprite(tableau[sprite(shit).row].getlastcard().spnum).member.name) = (getValue(sprite(tableau[sprite(fit).row].getlastcard().spnum).member.name) - 1)) or (getValue(sprite(tableau[sprite(shit).row].getlastcard().spnum).member.name) = (getValue(sprite(fit).member.name) + 1))) and (getSuit(sprite(tableau[sprite(shit).row].getlastcard().spnum).member.name) = getSuit(sprite(tableau[sprite(fit).row].getlastcard().spnum).member.name)) then
abort()
next repeat
end if
if (((getValue(sprite(tableau[sprite(shit).row].getlastcard().spnum).member.name) = 1) and (getValue(sprite(tableau[sprite(fit).row].getlastcard().spnum).member.name) = 13)) or ((getValue(sprite(tableau[sprite(shit).row].getlastcard().spnum).member.name) = 13) and (getValue(sprite(tableau[sprite(fit).row].getlastcard().spnum).member.name) = 1))) and (getSuit(sprite(tableau[sprite(shit).row].getlastcard().spnum).member.name) = getSuit(sprite(tableau[sprite(fit).row].getlastcard().spnum).member.name)) then
abort()
end if
end repeat
end repeat
win = "no"
pootimer = timeout("poo").new(130, #gotoit)
end if
end if
end
on gotoit
pootimer.forget()
go("gameover")
end
on getValue arg
if (arg contains "hearts") or (arg contains "spades") then