diff --git a/kodiak.tal b/kodiak.tal index f0d8afd..f55b2ef 100644 --- a/kodiak.tal +++ b/kodiak.tal @@ -44,8 +44,13 @@ #00c0 .Screen/h DEO2 init-rng-from-datetime - init-stock init-waste init-foundation - shuffle-stock deal-tableau + init-stock + .waste #18 initialize + .foundation #04 initialize + .tableau #85 initialize + .held #0d initialize + shuffle-stock + deal-tableau ( for now, we'll deal the first 3 cards to the waste for testing ) ( TODO: implement deal-waste ) @@ -62,6 +67,14 @@ ( ;on-key .Controller/vect DEO2 ) BRK +@not-holding-cards ( -> bool^ ) .held LDZ #00 EQU JMP2r +@holding-cards ( -> bool^ ) .held LDZ #00 NEQ JMP2r + +@initialize ( start^ count^ -> ) + OVR ADD SWP STH2 #00 ( 0^ [lim=start+count^ start^] ) + &loop DUP STHkr STZ INCr GTHkr STHr ?&loop ( 0^ [lim^ pos^] ) + POP POP2r JMP2r ( ) + @init-stock ( -> ) LITr -stock #8000 #4e41 &outer DUP2 @@ -69,16 +82,6 @@ POP2 #1010 ADD2 GTH2k ?&outer POP2 POP2 POPr JMP2r -@init-waste ( -> ) - #00 LITr -waste LITr 18 OVRr ADDr SWPr - &loop DUP STHkr STZ INCr GTHkr STHr ?&loop - POP POP2r JMP2r - -@init-foundation - #00 .foundation - STZk INC STZk INC STZk INC STZk POP2 - JMP2r - @shuffle-stock ( -> ) .stock #33 OVR ADD SWP ( last^ start^ ) &loop ( last^ pos^ )