Go Fish/J: Difference between revisions
m
Fixed syntax highlighting.
(Created page with "{{collection|Go Fish}} The essential portion of the program is a gerund of verbs action0`action1`...`actionn, one for each state of the game. Agenda @. drives ...") |
m (Fixed syntax highlighting.) |
||
(3 intermediate revisions by one other user not shown) | |||
Line 8:
next state. Thus verb go's guts are
<
g`e`r`u`n`d @. extract_state ^: non_terminal ^: _ choose_1st_player
cleanup
</syntaxhighlight>
Instruct <syntaxhighlight lang
The
Line 25:
unused verbs of the gerund.
<syntaxhighlight lang="cpp">
J CAPITAL, opponent lower.
Line 31 ⟶ 32:
end: no more fish in pond.
book -> fill ->
end
Line 63:
0be supply 0bf
0bf dumb 0b4
</syntaxhighlight>
Here is fish.ijs which includes some test code to demonstrate and of course test some of its verbs.
<syntaxhighlight lang="j">
load'~user/playingcards.ijs'
coinsert'rcpc'
Line 260:
pc=:newDeck''
shuffle__pc''
'HAND hand'=: 2 dealCards__pc 9 NB. deal two hands of
'BOOKS books' =: 0 NB. initialize the score
book
BOOK book''
if. fail =. books 13&~:@+ BOOKS do.
Line 275 ⟶ 274:
write books score BOOKS
)
</syntaxhighlight>
Sample
<syntaxhighlight lang="j">
go load'~user/fish.ijs'
Line 300 ⟶ 299:
You hold A♦ 4♣ 5♥ 5♠ 6♠ 7♣ 10♣ J♣ J♥ K♦
Your request please? a23456789tjqk
</syntaxhighlight>
|