Commit 38646bdc authored by Vivien Kraus's avatar Vivien Kraus
Browse files

Remove the Gtk+ app and rename tarot-cli to tarot

parent 71c92ab2
......@@ -24,7 +24,7 @@ mkdir -p host-config || exit 1
&& (cd lib-library && make -j) \
&& (cd lib-program && make -j) \
&& make -j flatpak \
&& (echo "pass" ; echo "pass") | flatpak-builder --run build-dir ../tarot-$VERSION/eu.planete_kraus.Tarot.json tarot-cli) \
&& (echo "pass" ; echo "pass") | flatpak-builder --run build-dir ../tarot-$VERSION/eu.planete_kraus.Tarot.json tarot) \
|| exit 1
cat > tarot.flatpakrepo <<EOF
[Flatpak Repo]
......
......@@ -603,11 +603,11 @@ the previously computed amount. Then the defendant have added
A new game can then begin, with the new first player being the
previous second.
* The tarot program
The command-line interface =tarot-cli= has two modes: either it
The command-line interface =tarot= has two modes: either it
processes an XML game doing one game action, or it opens a shell to
quickly play a game.
** Invoking tarot-cli
#+texinfo: @include invoke-tarot-cli-body.texi
** Invoking tarot
#+texinfo: @include invoke-tarot-body.texi
** The shell
The shell will guide you. You will first have to bid, then do a slam
declaration, then a call (only if you chose =--call-allowed=), then a
......
......@@ -24,12 +24,12 @@ dist_tarotfigures_DATA = \
%canon_reldir%_tarot_TEXINFOS = \
%reldir%/fdl.texi \
%reldir%/invoke-tarot-cli-body.texi
%reldir%/invoke-tarot-body.texi
EXTRA_DIST += \
%reldir%/tarot-figures/example.eps \
%reldir%/tarot-figures/example-tree.eps \
%reldir%/invoke-tarot-cli-body.texi \
%reldir%/invoke-tarot-body.texi \
$(srcdir)/%reldir%/example-status.txt
MAINTAINERCLEANFILES += \
......@@ -37,7 +37,7 @@ MAINTAINERCLEANFILES += \
$(srcdir)/%reldir%/tarot-figures/example.eps \
$(srcdir)/%reldir%/tarot-figures/example-tree.png \
$(srcdir)/%reldir%/tarot-figures/example-tree.eps \
$(srcdir)/%reldir%/invoke-tarot-cli-body.texi \
$(srcdir)/%reldir%/invoke-tarot-body.texi \
$(srcdir)/%reldir%/example-status.txt
$(srcdir)/%reldir%/tarot.info: \
......@@ -66,9 +66,9 @@ generate_verbose_0 = @echo " GENERATE " $@;
if ENABLE_GENERATOR
if WITH_GOBJECT
if WITH_CAIRO
$(srcdir)/%reldir%/example-status.txt: src/tarot-cli
$(generate_verbose) src/tarot-cli --generate -n 5 -c \
| src/tarot-cli --status -o $(srcdir)/%reldir%/example-status.txt
$(srcdir)/%reldir%/example-status.txt: src/tarot
$(generate_verbose) src/tarot --generate -n 5 -c \
| src/tarot --status -o $(srcdir)/%reldir%/example-status.txt
else # not WITH_CAIRO
$(srcdir)/%reldir%/example-status.txt:
@echo "A game needs to be re-generated. You need to enable the cairo bindings."
......
......@@ -33,8 +33,8 @@ tree_render_verbose_0 = @echo " TREE " $@;
if ENABLE_RENDERER
if WITH_GOBJECT
if WITH_CAIRO
$(srcdir)/%reldir%/example.xml.png: %reldir%/example.xml src/tarot-cli
$(render_verbose) src/tarot-cli --render -i $(srcdir)/%reldir%/example.xml -o $(srcdir)/%reldir%/example.xml.png
$(srcdir)/%reldir%/example.xml.png: %reldir%/example.xml src/tarot
$(render_verbose) src/tarot --render -i $(srcdir)/%reldir%/example.xml -o $(srcdir)/%reldir%/example.xml.png
else # not WITH_CAIRO
$(srcdir)/%reldir%/example.xml.png: %reldir%/example.xml
@echo "A game needs to be re-rendered. You need to enable the cairo bindings."
......@@ -52,10 +52,10 @@ $(srcdir)/%reldir%/example.xml.png: %reldir%/example.xml
endif # not ENABLE_RENDERER
if ENABLE_TREE_RENDERER
$(srcdir)/doc/tarot-figures/example-tree.png: %reldir%/example.xml src/tarot-cli
$(srcdir)/doc/tarot-figures/example-tree.png: %reldir%/example.xml src/tarot
@$(MKDIR_P) $(srcdir)/doc/tarot-figures
$(tree_render_verbose) src/tarot-cli --impute < $(srcdir)/%reldir%/example.xml \
| src/tarot-cli --mcts-tree \
$(tree_render_verbose) src/tarot --impute < $(srcdir)/%reldir%/example.xml \
| src/tarot --mcts-tree \
| $(XSLTPROC) $(srcdir)/%reldir%/render_mcts_tree.xsl - \
| $(FDP) -Tpng -o $(srcdir)/doc/tarot-figures/example-tree.png
else # not ENABLE_TREE_RENDERER
......
......@@ -3,5 +3,5 @@ src/tarot_cli.vala
src/engine/application.vala
src/engine/pretty_status.vala
src/engine/solo.vala
src/tarot-cli-opts.h
src/tarot-cli-opts.c
\ No newline at end of file
src/tarot-opts.h
src/tarot-opts.c
\ No newline at end of file
......@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: tarot 0.4.2.83-ebdc-dirty\n"
"Report-Msgid-Bugs-To: vivien@planete-kraus.eu\n"
"POT-Creation-Date: 2019-01-31 00:06+0100\n"
"POT-Creation-Date: 2019-01-31 20:21+0100\n"
"PO-Revision-Date: 2019-01-30 23:22+0100\n"
"Last-Translator: Vivien Kraus <vivien@planete-kraus.eu>\n"
"Language-Team: French\n"
......@@ -514,37 +514,37 @@ msgstr "Cette poignée n'est pas possible.\n"
msgid "play> "
msgstr "jeu> "
#: src/tarot-cli-opts.c:159
#: src/tarot-opts.c:159
#, c-format
msgid "ERROR: could not open the output file '%s'.\n"
msgstr "ERREUR : n'a pas pu ouvrir le fichier de sortie '%s'.\n"
#: src/tarot-cli-opts.c:210
#: src/tarot-opts.c:210
#, c-format
msgid "Error: this does not start with a card, '%s'\n"
msgstr "Erreur : ça ne commence pas par une carte, '%s'\n"
#: src/tarot-cli-opts.c:259
#: src/tarot-opts.c:259
#, c-format
msgid "Error: this does not start with a player, '%s'\n"
msgstr "Erreur : ça ne commence pas par un joueur, '%s'\n"
#: src/tarot-cli-opts.c:265
#: src/tarot-opts.c:265
#, c-format
msgid "Error: player is not followed by a comma, but by '%s'\n"
msgstr "Erreur : le joueur n'est pas suivi par une virgule, mais par '%s'\n"
#: src/tarot-cli-opts.c:293
#: src/tarot-opts.c:293
#, c-format
msgid "Error: the argument should be of form P%u=cards..., not P%u'%s'\n"
msgstr "Erreur : l'argument doit être de la forme P%u=cartes..., pas P%u'%s'\n"
#: src/tarot-cli-opts.c:1548 src/tarot-cli-opts.c:1591
#: src/tarot-opts.c:1547 src/tarot-opts.c:1590
#, c-format
msgid "Error: expected a card, not '%s'\n"
msgstr "Erreur : carte attendue, pas '%s'\n"
#: src/tarot-cli-opts.c:1742
#: src/tarot-opts.c:1741
msgid "No memory for duping translated strings\n"
msgstr "Pas assez de mémoire pour traduire les chaînes\n"
......@@ -552,11 +552,11 @@ msgstr "Pas assez de mémoire pour traduire les chaînes\n"
#.
#. The following dummy function was crated solely so that xgettext can
#. extract the correct strings. These strings are actually referenced
#. by a field name in the tarot_cliOptions structure noted in the
#. comments below. The literal text is defined in tarot_cli_opt_strs.
#. by a field name in the tarotOptions structure noted in the
#. comments below. The literal text is defined in tarot_opt_strs.
#.
#. NOTE: the strings below are segmented with respect to the source string
#. tarot_cli_opt_strs. The strings above are handed off for translation
#. tarot_opt_strs. The strings above are handed off for translation
#. at run time a paragraph at a time. Consequently, they are presented here
#. for translation a paragraph at a time.
#.
......@@ -564,144 +564,144 @@ msgstr "Pas assez de mémoire pour traduire les chaînes\n"
#. by name. These are set off with apostrophe quotes (I hope). Do not
#. translate option names.
#.
#. referenced via tarot_cliOptions.pOptDesc->pzText
#: src/tarot-cli-opts.c:1818
#. referenced via tarotOptions.pOptDesc->pzText
#: src/tarot-opts.c:1817
msgid "Create a new game"
msgstr "Crée une nouvelle partie"
#: src/tarot-cli-opts.c:1821
#: src/tarot-opts.c:1820
msgid "Deal cards to a player, with argument like P5=AH,2H,3H,..."
msgstr ""
"Distribue les cartes à un joueur, avec un argument de la forme "
"P5=AH,2H,3H,..."
#: src/tarot-cli-opts.c:1824
#: src/tarot-opts.c:1823
msgid "Deal for all players, with one player number for each card"
msgstr ""
"Distribue pour tous les joueurs, avec un numéro de joueur pour chaque carte"
#: src/tarot-cli-opts.c:1827
#: src/tarot-opts.c:1826
msgid "Deal at random"
msgstr "Distribue au hasard"
#: src/tarot-cli-opts.c:1830
#: src/tarot-opts.c:1829
msgid "Impute the game"
msgstr "Impute la partie"
#: src/tarot-cli-opts.c:1833
#: src/tarot-opts.c:1832
msgid "Play the next move with MCTS"
msgstr "Joue le prochain coup avec MCTS"
#: src/tarot-cli-opts.c:1836
#: src/tarot-opts.c:1835
msgid "Debug the next move with MCTS"
msgstr "Débogue le prochain coup de MCTS"
#: src/tarot-cli-opts.c:1839
#: src/tarot-opts.c:1838
msgid "Generate a full game til the end"
msgstr "Génère une partie entière jusqu'à la fin"
#: src/tarot-cli-opts.c:1842
#: src/tarot-opts.c:1841
msgid "Add a bid to the game"
msgstr "Ajoute une enchère à la partie"
#: src/tarot-cli-opts.c:1845
#: src/tarot-opts.c:1844
msgid "Add a slam declaration to the game"
msgstr "Ajoute une déclaration de chelem à la partie"
#: src/tarot-cli-opts.c:1848
#: src/tarot-opts.c:1847
msgid "Call a card"
msgstr "Appelle une carte"
#: src/tarot-cli-opts.c:1851
#: src/tarot-opts.c:1850
msgid "Reveal the dog, as \"AH,2H,3H,...\""
msgstr "Révèle le chien, comme \"AH,2H,3H,...\""
#: src/tarot-cli-opts.c:1854
#: src/tarot-opts.c:1853
msgid "Reveal the discard, as \"AH,2H,3H,...\""
msgstr "Fait un écart, comme \"AH,2H,3H,...\""
#: src/tarot-cli-opts.c:1857
#: src/tarot-opts.c:1856
msgid "Show a handful, as \"1T,2T,3T,...\""
msgstr "Montre une poignée, comme \"1T,2T,3T,...\""
#: src/tarot-cli-opts.c:1860
#: src/tarot-opts.c:1859
msgid "Play a card"
msgstr "Joue une carte"
#: src/tarot-cli-opts.c:1863
#: src/tarot-opts.c:1862
msgid "Render a game to a PNG file"
msgstr "Effectue un rendu de la partie dans un fichier PNG"
#: src/tarot-cli-opts.c:1866
#: src/tarot-opts.c:1865
msgid "Print the status of a game"
msgstr "Affiche le statut de la partie"
#: src/tarot-cli-opts.c:1869
#: src/tarot-opts.c:1868
msgid "Number of players"
msgstr "Nombre de joueurs"
#: src/tarot-cli-opts.c:1872
#: src/tarot-opts.c:1871
msgid "Allow a call in the game"
msgstr "Autorise un appel durant la partie"
#: src/tarot-cli-opts.c:1875
#: src/tarot-opts.c:1874
msgid "Random seed"
msgstr "Graine aléatoire"
#: src/tarot-cli-opts.c:1878
#: src/tarot-opts.c:1877
msgid "Number of times to retry a random action that may fail"
msgstr "Nombre de fois où l'on réessaye une action aléatoire qui peut échouer"
#: src/tarot-cli-opts.c:1881
#: src/tarot-opts.c:1880
msgid "Number of iterations for the MCTS"
msgstr "Nombre d'itérations pour le MCTS"
#: src/tarot-cli-opts.c:1884
#: src/tarot-opts.c:1883
msgid "Output file to write"
msgstr "Fichier de sortie à écrire"
#: src/tarot-cli-opts.c:1887
#: src/tarot-opts.c:1886
msgid "Input file to read"
msgstr "Fichier d'entrée à lire"
#: src/tarot-cli-opts.c:1890
#: src/tarot-opts.c:1889
msgid "Width of the output file"
msgstr "Largeur du fichier de sortie"
#: src/tarot-cli-opts.c:1893
#: src/tarot-opts.c:1892
msgid "Height of the output file"
msgstr "Hauteur du fichier de sortie"
#: src/tarot-cli-opts.c:1896
#: src/tarot-opts.c:1895
msgid "Print the version information and exit"
msgstr "Affiche l'information de version et quitte"
#: src/tarot-cli-opts.c:1899
#: src/tarot-opts.c:1898
msgid "display extended usage information and exit"
msgstr "Affiche plus d'information sur l'utilisation et quitte"
#: src/tarot-cli-opts.c:1902
#: src/tarot-opts.c:1901
msgid "extended usage information passed thru pager"
msgstr "plus d'information sur l'utilisation passée dans un pager"
#: src/tarot-cli-opts.c:1905
#: src/tarot-opts.c:1904
msgid "save the option state to a config file"
msgstr "sauve l'état des options vers un fichier de configuration"
#: src/tarot-cli-opts.c:1908
#: src/tarot-opts.c:1907
msgid "load options from a config file"
msgstr "charge les options depuis un fichier de configuration"
#: src/tarot-cli-opts.c:1911
#, c-format
#: src/tarot-opts.c:1910
#, fuzzy, c-format
msgid ""
"tarot-cli - The Amazing Rules Of TAROT -- batch command-line processing\n"
"tarot - The Amazing Rules Of TAROT\n"
"Usage: %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]...\n"
msgstr ""
"tarot-cli - The Amazing Rules Of TAROT -- traitement en ligne de commande\n"
"Utilisation : %s [ -<drapeau> [<val>] | --<nom>[{=| }<val>] ]...\n"
#: src/tarot-cli-opts.c:1915 src/tarot-cli-opts.c:1918
#: src/tarot-opts.c:1914 src/tarot-opts.c:1917
msgid "<<<NOT-FOUND>>>"
msgstr "<<<NON-TROUVÉ>>>"
......
......@@ -36,7 +36,6 @@ include %reldir%/cli/Makefile.am
include %reldir%/xml/Makefile.am
include %reldir%/layout/Makefile.am
include %reldir%/cairo/Makefile.am
include %reldir%/gtk/Makefile.am
include %reldir%/tree/Makefile.am
include %reldir%/mcts/Makefile.am
include %reldir%/simulation/Makefile.am
# Makefile.am
#
# Copyright (C) 2019 Vivien Kraus <vivien@planete-kraus.eu>
#
# This program is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see
# <http://www.gnu.org/licenses/>.
include %reldir%/tarot-application.am
include %reldir%/gresources.am
AM_VALAFLAGS += \
--pkg gtk+-3.0 \
--gresources %reldir%/tarot-resources.xml
# gresources.am
#
# Copyright (C) 2018 Vivien Kraus <vivien@planete-kraus.eu>
#
# This program is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see
# <http://www.gnu.org/licenses/>.
EXTRA_DIST += \
%reldir%/main_window.ui \
%reldir%/tarot-resources.xml \
%reldir%/tarot-resources.c
gresources_verbose = $(gresources_verbose_@AM_V@)
gresources_verbose_ = $(gresources_verbose_@AM_DEFAULT_V@)
gresources_verbose_0 = @echo " GRES " $@;
$(srcdir)/%reldir%/tarot-resources.c: %reldir%/tarot-resources.xml %reldir%/main_window.ui
$(gresources_verbose) cd $(srcdir)/%reldir% && $(GLIB_COMPILE_RESOURCES) --generate-source \
--target tarot-resources.c \
tarot-resources.xml \
&& touch tarot-resources.c
if WITH_GTK
%canon_reldir%_tarot_SOURCES += %reldir%/tarot-resources.c
endif # WITH_GTK
MAINTAINERCLEANFILES += $(srcdir)/%reldir%/tarot-resources.c
#+title: The tarot-playing application
#+language: en
#+author: Vivien Kraus
#+email: vivien@planete-kraus.eu
* Introduction
We already have a library to paint some /Tarot.Card/'s on a cairo
surface. How do we transform that into a useful application? This
document is here to implement exactly that in vala.
At its core, the program is simply a wrapper around a /Tarot.Game/,
dealt at random, for a given number of players.
* The application engine
The engine s a class that takes window inputs, and controls the game.
It can also play asynchronously.
#+name: engine-class
#+BEGIN_SRC vala
public struct Assignment {
public Tarot.CardArray my_cards;
public Tarot.CardArray[] cards_adversaries;
public Tarot.CardArray cards_trick;
public Tarot.CardArray cards_foreground;
public Tarot.Player myself;
}
public class Engine: GLib.Object {
private Tarot.Game full_game = new Tarot.Game.alloc ();
private Tarot.Game restricted_game = new Tarot.Game.alloc ();
private Tarot.Assignment _assignment;
public Tarot.Assignment assignment { get { return _assignment; } }
public size_t n_players { get { return full_game.n_players (); } }
public signal void render ();
public signal void ask_n_players (bool ask);
public signal void ask_bid (bool ask, bool take_enabled, bool push_enabled,
bool strk_enabled, bool dblk_enabled);
public int n_iterations = 100;
public string seed = "default";
private char[] seed_bytes () {
char[] ret = new char[seed.length];
for (int i = 0; i < seed.length; i++) {
ret[i] = seed[i];
}
return ret;
}
public uint taker {
get {
Tarot.Player ret;
full_game.get_taker (out ret);
return ret;
}
}
private Tarot.GameEvent run_mcts () {
var mcts = new Tarot.Mcts.alloc ();
if (mcts.set_base (full_game) != 0) {
stderr.printf ("Could not play in this game.\n");
GLib.Process.abort ();
}
if (mcts.run (n_iterations, seed_bytes ()) != 0) {
stderr.printf ("Could not explore this game.\n");
GLib.Process.abort ();
}
var ret = new Tarot.GameEvent.alloc ();
if (mcts.get_best (ret) != 0) {
stderr.printf ("No exploration has been performed.\n");
GLib.Process.abort ();
}
return ret;
}
private void send_redraw (Tarot.Card[] center) {
size_t n_players = restricted_game.n_players ();
_assignment.my_cards = new Tarot.CardArray.alloc ();
_assignment.cards_adversaries = new Tarot.CardArray[n_players- 1];
_assignment.cards_trick = new Tarot.CardArray.alloc ();
var current_trick = restricted_game.current_trick ();
var n_tricks = restricted_game.n_tricks ();
_assignment.cards_foreground = new Tarot.CardArray.alloc ();
_assignment.myself = 0;
Tarot.Card trick_card = 78;
bool cnf, cno, cnu;
if (_assignment.cards_trick.resize (n_players) != 0) {
GLib.Process.abort ();
}
for (size_t i = 0; i < n_players; i++) {
_assignment.cards_trick[i] = 79; // Not painted
}
if (restricted_game.get_cards (_assignment.myself, _assignment.my_cards) != 0) {
// Fill with backs
size_t n = restricted_game.count_cards (_assignment.myself);
if (_assignment.my_cards.resize (n) != 0) {
GLib.Process.abort ();
}
for (int i = 0; i < n; i++) {
_assignment.my_cards[i] = 78;
}
}
if (current_trick > 0
&& restricted_game.trick_count_cards (current_trick) == 0) {
// uninteresting empty trick
current_trick--;
}
if (current_trick < n_tricks
&& restricted_game.get_trick_card_of (current_trick, _assignment.myself, out trick_card,
out cnf, out cno, out cnu) == 0) {
_assignment.cards_trick[0] = trick_card;
}
for (int i = 0; i + 1 < n_players; i++) {
var cards = new Tarot.CardArray.alloc ();
Tarot.Player p = (Tarot.Player) (((size_t) (_assignment.myself + i + 1)) % n_players);
size_t n = restricted_game.count_cards (p);
if (cards.resize (n) != 0) {
GLib.Process.abort ();
}
for (int j = 0; j < n; j++) {
cards[j] = 78;
}
_assignment.cards_adversaries[i] = cards;
if (current_trick < n_tricks
&& restricted_game.get_trick_card_of (current_trick, p, out trick_card,
out cnf, out cno, out cnu) == 0) {
_assignment.cards_trick[i + 1] = trick_card;
}
}
_assignment.cards_foreground.resize (center.length);
for (int i = 0; i < center.length; i++) {
_assignment.cards_foreground[i] = center[i];
}
render ();
}
public void select_n_players (size_t n_players, bool with_call) {
Tarot.GameEvent e = new Tarot.GameEvent.alloc ();
if (e.set_setup (n_players, with_call) != 0) {
stderr.printf ("ICI 0\n");
GLib.Process.abort ();
}
add_event (e);
var seed = "Deal!";
var seed_bytes = new char[seed.length];
for (int i = 0; i < seed.length; i++) {
seed_bytes[i] = seed[i];
}
if (e.set_deal_all_random (n_players, seed_bytes) != 0) {
GLib.Process.abort ();
}
if (full_game.add_event (e) != 0) {
stderr.printf ("Wrong seed\n");
GLib.Process.abort ();
}
var my_cards = new Tarot.CardArray.alloc ();
if (full_game.get_deal_of (_assignment.myself, my_cards) != 0
|| e.set_deal (_assignment.myself, my_cards) != 0
|| restricted_game.add_event (e) != 0) {
GLib.Process.abort ();
}
run ();
ask_n_players (false);
send_redraw ({});
}
public void select_bid (Tarot.Bid bid) {
Tarot.GameEvent e = new Tarot.GameEvent.alloc ();
if (e.set_bid (bid) != 0) {
GLib.Process.abort ();
}
add_event (e);
run ();
ask_bid (false, false, false, false, false);
send_redraw ({});
}
private void add_event (Tarot.GameEvent e) {
if (e.type () == Tarot.GameEventT.DISCARD_EVENT) {
var cards = new Tarot.CardArray.alloc ();
if (e.get_discard (cards) != 0) {
GLib.Process.abort ();
}
set_discard (cards);
}
if (full_game.add_event (e) != 0
|| restricted_game.add_event (e) != 0) {
stderr.printf ("Cannot add this event\n");
GLib.Process.abort ();
}
}
private void set_discard (Tarot.CardArray discard) {
var e = new Tarot.GameEvent.alloc ();
if (e.set_discard (discard) != 0) {
stderr.printf ("Cannot define the discard\n");
GLib.Process.abort ();
}
if (full_game.add_event (e) != 0) {
stderr.printf ("Cannot add the discard\n");
GLib.Process.abort ();
}
var restricted = new Tarot.CardArray.alloc ();
if (full_game.get_discard_according_to (_assignment.myself, restricted) != 0) {
stderr.printf ("Impossible.\n");
GLib.Process.abort ();
}
if (e.set_discard (restricted) != 0) {
stderr.printf ("Cannot define the discard\n");
GLib.Process.abort ();
}
if (restricted_game.add_event (e) != 0) {
stderr.printf ("Cannot add the restricted\n");
GLib.Process.abort ();
}
}
public void run () {
var dog = new Tarot.CardArray.alloc ();
if (dog.resize (6) != 0) {
GLib.Process.abort ();
}
if (full_game.can_autoreveal (dog)) {
var e = new Tarot.GameEvent.alloc ();
if (e.set_dog (dog) != 0) {
GLib.Process.abort ();
}
add_event (e);
}
if (full_game.has_next () && full_game.next () != _assignment.myself) {
add_event (run_mcts ());
run ();
} else if (full_game.has_next ()) {
Tarot.Bid mini;
Tarot.Player next;
if (restricted_game.hint_bid (out next, out mini) == 0) {
assert (next == _assignment.myself);
ask_bid (true,
mini <= Tarot.Bid.TAKE,