Go Fish/Aime: Difference between revisions
m
Fixed syntax highlighting.
(Created page with "{{collection|Go Fish}} The AI will randomly ask a rank known to be in the human's hand (a card in the AI's hand that the human has asked for before and the AI hasn't asked for...") |
m (Fixed syntax highlighting.) |
||
(2 intermediate revisions by one other user not shown) | |||
Line 1:
{{collection|Go Fish}}
The AI will randomly ask a rank known to be in the human's hand (a card in the AI's hand that the human has asked for before and the AI hasn't asked for before). If there are no known ranks, the AI will ask for the lowest rank it has (the strategy has the virtue of not giving away the player's hand).
<
shuffle(list l)
{
integer
for (, c in b_draft("SHDC")) {
i = 4;▼
while (i) {▼
l.p_text(drand(~l), data().append(e).append(c));
j -= 1;▼
▲ character("A23456789TJQK", j)));
}
}
Line 29 ⟶ 23:
i = 0;
s = pick;
while (
}
if (i == 4) {
}
}
}
Line 54 ⟶ 48:
deal(list deck, text name, record p, integer &p_books)
{
if (
}
▲ if (!compare(name, "player")) {
▲ check_book(deck, name, p, delete(s, 1), p_books);
}
}
Line 76 ⟶ 67:
text s;
▲ o_text(": ");
o_text(" books,");▼
if (!compare(player, "P")) {
o_(" ", s);
} else {
call_n(~p, o_text, " **");
▲ i -= 1;
}
Line 105 ⟶ 85:
integer h;
h =
if (h) {
}
}
Line 125 ⟶ 105:
while (1) {
▲ } else {
if (s[0] != pick[0]) {
▲ r_greater(u, pick, s);
} else {
}
}
t = draw(e, pick, s);
if (!t) {
} else {
}
}
Line 166 ⟶ 145:
text s;
▲ text t;
l.append(s);
}
}
if (
}
}
Line 190 ⟶ 167:
text pick, s;
# seemingly dumb choice: ask the first book
pick = delete(pick, 1);
# refine choice to something the user has asked for
mull(e, asked, pick);
t = !draw(u, pick, s);
if (t) {
} else {
}
}
Line 226 ⟶ 203:
u_turn = 1;
i = 9;
while (i) {
}
while (c_books + u_books != 13) {
}
}
return 0;
}
</syntaxhighlight>
|