Go Fish/J: Difference between revisions

Content added Content deleted
mNo edit summary
m (http://jsoftware.com/pipermail/chat/2011-January/004085.html)
Line 260: Line 260:
pc=:newDeck''
pc=:newDeck''
shuffle__pc''
shuffle__pc''
'HAND hand'=: 2 dealCards__pc 9 NB. deal two hands of five cards
'HAND hand'=: 2 dealCards__pc 9 NB. deal two hands of nine cards
'BOOKS books' =: 0 NB. initialize the score
'BOOKS books' =: 0 NB. initialize the score
book `fill `end `draw `BOOK `ask `RESPOND`FISH `SUPPLY `FILL `ASK `respond`Fish `DRAW `supply `dumb @. ] ^: (0b2&~:) ^: _ (0b4*?2)
book`fill`end`draw`BOOK`ask`RESPOND`FISH`SUPPLY`FILL`ASK`respond`Fish`DRAW`supply`dumb@.]^:(0b2&~:)^:_(?2){0b0 0b4

BOOK book''
BOOK book''
if. fail =. books 13&~:@+ BOOKS do.
if. fail =. books 13&~:@+ BOOKS do.