Go Fish: Difference between revisions
Content deleted Content added
Line 80:
=={{header|Racket}}==
{{incorrect|Racket|link broken.}}
See [https://github.com/plt/racket/blob/master/pkgs/games/gofish/gofish.rkt gofish.rkt].
Documentation: [http://docs.racket-lang.org/games/gofish.html?q=fish Go Fish].
|
Revision as of 22:53, 4 February 2019
![Task](http://static.miraheze.org/rosettacodewiki/thumb/b/ba/Rcode-button-task-crushed.png/64px-Rcode-button-task-crushed.png)
You are encouraged to solve this task according to the task description, using any language you may know.
Write a program to let the user play Go Fish against a computer opponent. Use the following rules:
- Each player is dealt nine cards to start with.
- On their turn, a player asks their opponent for a given rank (such as threes or kings). A player must already have at least one card of a given rank to ask for more.
- If the opponent has any cards of the named rank, they must hand over all such cards, and the requester can ask again.
- If the opponent has no cards of the named rank, the requester draws a card and ends their turn.
- A book is a collection of every card of a given rank. Whenever a player completes a book, they may remove it from their hand.
- If at any time a player's hand is empty, they may immediately draw a new card, so long as any new cards remain in the deck.
- The game ends when every book is complete. The player with the most books wins.
The game's AI need not be terribly smart, but it should use at least some strategy. That is, it shouldn't choose legal moves entirely at random.
You may want to use code from Playing Cards.
Aime
See Go Fish/Aime
AutoHotkey
C
See Go Fish/C
C++
See Go Fish/C++
D
See Go Fish/D
Erlang
See Go Fish/Erlang
Go
See Go Fish/Go
Haskell
See Go Fish/Haskell
Icon and Unicon
See Go Fish/Unicon
J
See Go Fish/J
Java
See Go Fish/Java
Julia
see Go Fish/Julia
Kotlin
See Go Fish/Kotlin
Locomotive Basic
Mathematica / Wolfram Language
OCaml
See Go Fish/OCaml
Perl 6
See Go Fish/Perl_6
Phix
See Go Fish/Phix
PicoLisp
See Go Fish/PicoLisp
PureBasic
Python
See Go Fish/Python
Racket
See gofish.rkt. Documentation: Go Fish.
![](http://static.miraheze.org/rosettacodewiki/thumb/5/54/Go-fish-racket.png/300px-Go-fish-racket.png)
Ruby
See Go Fish/Ruby
Tcl
See Go Fish/Tcl