local gc=love.graphics local gc_translate=gc.translate local gc_setColor,gc_setLineWidth=gc.setColor,gc.setLineWidth local gc_rectangle=gc.rectangle local gc_print=gc.print local max,min=math.max,math.min local ins,rem=table.insert,table.remove local colorName={ m={'一','二','三','四','五','六','七','八','九'}, p={'①','②','③','④','⑤','⑥','⑦','⑧','⑨'}, s={'1','2','3','4','5','6','7','8','9'}, } local deck0={} local cardText={} for i=1,9 do for _=1,4 do ins(deck0,'m'..i) ins(deck0,'p'..i) ins(deck0,'s'..i) if i<=7 then ins(deck0,'z'..i)end end cardText['m'..i]={COLOR.lF,colorName.m[i]} cardText['p'..i]={COLOR.lB,colorName.p[i]} cardText['s'..i]={COLOR.lG,colorName.s[i]} end -- deck0[TABLE.find(deck0,'m5')]='m0' -- deck0[TABLE.find(deck0,'p5')]='p0' -- deck0[TABLE.find(deck0,'s5')]='s0' -- cardText['5m+']={COLOR.R,'五'} -- cardText['5p+']={COLOR.R,'⑤'} -- cardText['5s+']={COLOR.R,'5'} cardText['z1']={COLOR.Z,'東'} cardText['z2']={COLOR.Z,'南'} cardText['z3']={COLOR.Z,'西'} cardText['z4']={COLOR.Z,'北'} cardText['z5']={COLOR.Z,' '} cardText['z6']={COLOR.G,'發'} cardText['z7']={COLOR.R,'中'} local deck,hand,pool local selected local function _getPoolCardArea(i) local row=math.floor((i-1)/10) local col=i-row*10 return 240+70*col,45+95*row, 65,90 end local function _getHandCardArea(i) return 20+70*i+(i==14 and 30 or 0),480, 65,90 end local function _newGame() deck=TABLE.shift(deck0) hand={} pool={} for _=1,14 do ins(hand,(TABLE.popRandom(deck)))end table.sort(hand) end local function _checkWin() if #hand==14 then --??? end end local function _throwCard() if hand[selected]and #pool<40 then ins(pool,rem(hand,selected)) table.sort(hand) SFX.play('hold') SFX.play('lock') if #pool<40 then ins(hand,(TABLE.popRandom(deck))) end end end local scene={} function scene.sceneInit() _newGame() selected=false end function scene.mouseMove(x,y) selected=false for i=1,#hand do local cx,cy,cw,ch=_getHandCardArea(i) if x>cx and xcy and y