Commit ba0e21c9 authored by Vivien Kraus's avatar Vivien Kraus
Browse files

Check that it works

parent 3ab1acd4
Pipeline #128592 failed with stages
in 3 minutes and 8 seconds
......@@ -66,6 +66,7 @@ INTROSPECTED_SOURCES =
EXTRA_DIST =
BUILT_SOURCES =
CLEANFILES =
DISTCLEANFILES =
MAINTAINERCLEANFILES =
AM_DISTCHECK_CONFIGURE_FLAGS =
AM_CPPFLAGS =
......
......@@ -8,8 +8,8 @@ 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-04-16 22:55+0200\n"
"PO-Revision-Date: 2019-04-16 22:57+0200\n"
"POT-Creation-Date: 2019-04-19 23:59+0200\n"
"PO-Revision-Date: 2019-04-19 23:53+0200\n"
"Last-Translator: Vivien Kraus <vivien@planete-kraus.eu>\n"
"Language-Team: French\n"
"Language: fr\n"
......@@ -470,18 +470,18 @@ msgid "bid> "
msgstr "enchère> "
#: src/engine/solo.vala:82 src/engine/solo.vala:83 src/engine/solo.vala:103
#: src/engine/solo.vala:104 src/main.vala:243 src/main.vala:260
#: src/engine/solo.vala:104 src/main.vala:249 src/main.vala:266
#: src/gui/widget.vala:419 src/gui/widget.ui:16 src/gui/widget.ui:17
#: src/gui/widget.ui:21 src/gui/widget.ui:22 src/gui/widget.ui:23
msgid "pass"
msgstr "passe"
#: src/engine/solo.vala:84 src/engine/solo.vala:85 src/main.vala:245
#: src/engine/solo.vala:84 src/engine/solo.vala:85 src/main.vala:251
#: src/gui/widget.vala:423
msgid "take"
msgstr "petite"
#: src/engine/solo.vala:86 src/engine/solo.vala:87 src/main.vala:247
#: src/engine/solo.vala:86 src/engine/solo.vala:87 src/main.vala:253
#: src/gui/widget.vala:426
msgid "push"
msgstr "garde"
......@@ -507,7 +507,7 @@ msgstr ""
msgid "declare> "
msgstr "déclaration> "
#: src/engine/solo.vala:105 src/engine/solo.vala:106 src/main.vala:262
#: src/engine/solo.vala:105 src/engine/solo.vala:106 src/main.vala:268
#: src/gui/widget.vala:446
msgid "slam"
msgstr "chelem"
......@@ -566,51 +566,51 @@ msgstr "Cette poignée n'est pas possible.\n"
msgid "play> "
msgstr "jeu> "
#: src/main.vala:153
#: src/main.vala:156
msgid "new-game"
msgstr "nouvelle-partie"
#: src/main.vala:153
#: src/main.vala:156
msgid "Create a new game"
msgstr "Crée une nouvelle partie"
#: src/main.vala:154
#: src/main.vala:157
msgid "deal-random"
msgstr "distribuer-hasard"
#: src/main.vala:154
#: src/main.vala:157
msgid "Deal the cards at random"
msgstr "Distribue les cartes au hasard"
#: src/main.vala:155
#: src/main.vala:158
msgid "deal-to"
msgstr "distribuer-à"
#: src/main.vala:155
#: src/main.vala:158
msgid "Deal cards to a specific player"
msgstr "Distribue les cartes d'un joueur"
#: src/main.vala:155
#: src/main.vala:158
msgid "PN=CARD,CARD,..."
msgstr "JN=CARTE,CARTE,..."
#: src/main.vala:156
#: src/main.vala:159
msgid "deal-all"
msgstr "distribuer-tous"
#: src/main.vala:156
#: src/main.vala:159
msgid "Deal the cards to all players at once"
msgstr "Distribue les cartes de tous les joueurs à la fois"
#: src/main.vala:156
#: src/main.vala:159
msgid "OWNER1,OWNER2,..."
msgstr "J1,J2,..."
#: src/main.vala:157
#: src/main.vala:160
msgid "bid"
msgstr "enchère"
#: src/main.vala:157
#: src/main.vala:160
msgid ""
"Add a bid to the game: 'pass', 'take', 'push', 'straight-keep', or 'double-"
"keep'"
......@@ -618,206 +618,218 @@ msgstr ""
"Ajoute une enchère à la partie : 'passe', 'petite', 'garde', 'garde-sans', "
"'garde-contre'"
#: src/main.vala:157
#: src/main.vala:160
msgid "BID"
msgstr "ENCHÈRE"
#: src/main.vala:158
#: src/main.vala:161
msgid "declare"
msgstr "déclare"
#: src/main.vala:158
#: src/main.vala:161
msgid "Add a slam declaration to the game"
msgstr "Ajoute une déclaration de chelem à la partie"
#: src/main.vala:158
#: src/main.vala:161
msgid "'pass'/'slam'"
msgstr "« passe » / « chelem »"
#: src/main.vala:159
#: src/main.vala:162
msgid "call"
msgstr "appeler"
#: src/main.vala:159
#: src/main.vala:162
msgid "Call a card"
msgstr "Appelle une carte"
#: src/main.vala:159 src/main.vala:163
#: src/main.vala:162 src/main.vala:166
msgid "CARD"
msgstr "CARTE"
#: src/main.vala:160
#: src/main.vala:163
msgid "dog"
msgstr "chien"
#: src/main.vala:160
#: src/main.vala:163
msgid "Reveal the dog"
msgstr "Révèle le chien"
#: src/main.vala:160
#: src/main.vala:163
msgid "CARD,CARD..."
msgstr "CARTE,CARTE,..."
#: src/main.vala:161
#: src/main.vala:164
msgid "discard"
msgstr "écarter"
#: src/main.vala:161
#: src/main.vala:164
msgid "The discard is done"
msgstr "L'écart est fait"
#: src/main.vala:161 src/main.vala:162
#: src/main.vala:164 src/main.vala:165
msgid "'' or CARD,CARD..."
msgstr "« » ou CARTE,CARTE,..."
#: src/main.vala:162
#: src/main.vala:165
msgid "handful"
msgstr "poignée"
#: src/main.vala:162
#: src/main.vala:165
msgid "Show a handful"
msgstr "Montre une poignée"
#: src/main.vala:163
#: src/main.vala:166
msgid "play"
msgstr "jouer"
#: src/main.vala:163
#: src/main.vala:166
msgid "Play a card"
msgstr "Joue une carte"
#: src/main.vala:164
#: src/main.vala:167
msgid "status"
msgstr "statut"
#: src/main.vala:164
#: src/main.vala:167
msgid "Print the status of the game"
msgstr "Affiche le statut de la partie"
#: src/main.vala:165
#: src/main.vala:168
msgid "generate"
msgstr "générer"
#: src/main.vala:165
#: src/main.vala:168
msgid "Generate an entire game with MCTS moves"
msgstr "Génère une partie entière avec des coups de MCTS"
#: src/main.vala:166
#: src/main.vala:169
msgid "mcts"
msgstr "mcts"
#: src/main.vala:166
#: src/main.vala:169
msgid "Play the next move with MCTS"
msgstr "Joue le prochain coup avec MCTS"
#: src/main.vala:167
#: src/main.vala:170
msgid "mcts-tree"
msgstr "arbre-mcts"
#: src/main.vala:167
#: src/main.vala:170
msgid "Print the MCTS tree for the next move"
msgstr "Affiche l'arbre MCTS pour le prochain coup"
#: src/main.vala:168
#: src/main.vala:171
msgid "impute"
msgstr "imputer"
#: src/main.vala:168
#: src/main.vala:171
msgid "Impute the missing cards"
msgstr "Impute les cartes manquantes"
#: src/main.vala:169
#: src/main.vala:172
msgid "render"
msgstr "rendu"
#: src/main.vala:169
#: src/main.vala:172
msgid "Render a game as PNG"
msgstr "Effectue un rendu de la partie comme PNG"
#: src/main.vala:170
#: src/main.vala:173
msgid "dbus-server"
msgstr "serveur-dbus"
#: src/main.vala:170
#: src/main.vala:173
msgid "Run as a DBus server"
msgstr "Exécuter un serveur DBus"
#: src/main.vala:171
#: src/main.vala:174
msgid "dbus-mcts"
msgstr "mcts-dbus"
#: src/main.vala:174
msgid "Run the MCTS as a DBus client"
msgstr "Exécuter le MCTS en tant que client DBus"
#: src/main.vala:174
msgid "SEAT_PATH"
msgstr "CHEMIN_VERS_SIÈGE"
#: src/main.vala:175
msgid "input"
msgstr "entrée"
#: src/main.vala:171
#: src/main.vala:175
msgid "Input file to read (defaults to stdin)"
msgstr "Fichier d'entrée à lire (par défaut, l'entrée standard)"
#: src/main.vala:171 src/main.vala:172
#: src/main.vala:175 src/main.vala:176
msgid "FILE"
msgstr "FICHIER"
#: src/main.vala:172
#: src/main.vala:176
msgid "output"
msgstr "sortie"
#: src/main.vala:172
#: src/main.vala:176
msgid "Output file to write (defaults to stdout)"
msgstr "Fichier de sortie à écrire (par défaut, la sortie standard)"
#: src/main.vala:173
#: src/main.vala:177
msgid "n-player"
msgstr "n-joueurs"
#: src/main.vala:173
#: src/main.vala:177
msgid "Specify the number of players for a new game"
msgstr "Spécifie le noombre de joueurs pour une nouvelle partie"
#: src/main.vala:173 src/main.vala:176 src/main.vala:177 src/main.vala:182
#: src/main.vala:183
#: src/main.vala:177 src/main.vala:180 src/main.vala:181 src/main.vala:186
#: src/main.vala:187
msgid "N"
msgstr "N"
#: src/main.vala:174
#: src/main.vala:178
msgid "call-allowed"
msgstr "appel-autorisé"
#: src/main.vala:174
#: src/main.vala:178
msgid "The new game can have a call"
msgstr "La partie peut avoir un appel"
#: src/main.vala:175
#: src/main.vala:179
msgid "seed"
msgstr "graine"
#: src/main.vala:175
#: src/main.vala:179
msgid "The random seed for MCTS-related operations (defaults to 'default')"
msgstr ""
"La graine aléatoire pour les opérations liées à MCTS (par défaut, "
"« default » -- défaut en anglais)"
#: src/main.vala:175
#: src/main.vala:179
msgid "NON-EMPTY"
msgstr "NON-VIDE"
#: src/main.vala:176
#: src/main.vala:180
msgid "retry"
msgstr "réessayer"
#: src/main.vala:176
#: src/main.vala:180
msgid "Number of times to retry an operation that may fail out of bad luck"
msgstr "Nombre de fois où l'on réessaye une action aléatoire qui peut échouer"
#: src/main.vala:177
#: src/main.vala:181
msgid "n-iterations"
msgstr "n-itérations"
#: src/main.vala:177
#: src/main.vala:181
msgid "Number of iterations for the MCTS exploration (defaults to 100)"
msgstr "Nombre d'itérations pour l'exploration du MCTS (par défaut, 100)"
#: src/main.vala:178
#: src/main.vala:182
msgid "mcts-parameter"
msgstr "mcts-paramètre"
#: src/main.vala:178
#: src/main.vala:182
msgid ""
"Parameter value for the MCTS algorithm. Pass a negative value to use the "
"maintainer's default"
......@@ -825,15 +837,15 @@ msgstr ""
"Valeur du paramètre pour l'algorithme MCTS. Passer une valeur négative pour "
"utiliser la valeur par défaut du mainteneur"
#: src/main.vala:178 src/main.vala:179 src/main.vala:180
#: src/main.vala:182 src/main.vala:183 src/main.vala:184
msgid "VALUE"
msgstr "VALEUR"
#: src/main.vala:179
#: src/main.vala:183
msgid "mcts-simulation-agreed"
msgstr "mcts-simulation-concertée"
#: src/main.vala:179
#: src/main.vala:183
msgid ""
"Tendency for the MCTS to use an agreed simulation. Pass a negative value to "
"use the maintainer's default"
......@@ -841,11 +853,11 @@ msgstr ""
"Tendance du MCTS à utiliser une simulation concertée. Passer une valeur "
"négative pour utiliser la valeur par défaut du mainteneur"
#: src/main.vala:180
#: src/main.vala:184
msgid "mcts-simulation-random"
msgstr "mcts-simulation-aléatoire"
#: src/main.vala:180
#: src/main.vala:184
msgid ""
"Tendency for the MCTS to use a random simulation. Pass a negative value to "
"use the maintainer's default"
......@@ -853,64 +865,77 @@ msgstr ""
"Tendance du MCTS à utiliser une simulation aléatoire. Passer une valeur "
"négative pour utiliser la valeur par défaut du mainteneur"
#: src/main.vala:181
#: src/main.vala:185
msgid "no-window"
msgstr "sans-fenêtre"
#: src/main.vala:181
#: src/main.vala:185
msgid "Do not open a graphical window"
msgstr "N'ouvre pas de fenêtre graphique"
#: src/main.vala:182
#: src/main.vala:186
msgid "width"
msgstr "largeur"
#: src/main.vala:182
#: src/main.vala:186
msgid "PNG width (defaults to 640)"
msgstr "largeur du PNG (par défaut, 640)"
#: src/main.vala:183
#: src/main.vala:187
msgid "height"
msgstr "hauteur"
#: src/main.vala:183
#: src/main.vala:187
msgid "PNG height (defaults to 480)"
msgstr "Hauteur du PNG (par défaut, 480)"
#: src/main.vala:184
#: src/main.vala:188
msgid "anonymous-dbus"
msgstr "dbus-anonyme"
#: src/main.vala:184
#: src/main.vala:188
msgid "Set this option if you want to run the D-Bus service anonymously."
msgstr "Utiliser cette option pour lancer le service D-Bus anonymement."
#: src/main.vala:185
#: src/main.vala:189
#, c-format
msgid "Override the DBus server owned name (default: %s)"
msgstr "Change le nom du serveur DBus (par défaut : %s)"
#: src/main.vala:190
msgid "dbus-server-name"
msgstr "nom-serveur-dbus"
#: src/main.vala:190
msgid "DBUS_NAME"
msgstr "NOM_DBUS"
#: src/main.vala:191
msgid "version"
msgstr "version"
#: src/main.vala:185
#: src/main.vala:191
msgid "Print version information and exit"
msgstr "Affiche l'information de version et quitte"
#: src/main.vala:190
#: src/main.vala:196
msgid "- Tarot command-line options"
msgstr "- Ligne de commande de Tarot"
#: src/main.vala:249
#: src/main.vala:255
msgid "straight-keep"
msgstr "garde-sans"
#: src/main.vala:251
#: src/main.vala:257
msgid "double-keep"
msgstr "garde-contre"
#: src/main.vala:309 src/main.vala:319
#: src/main.vala:315 src/main.vala:326
#, c-format
msgid "Could not register the D-Bus server, sorry: %s.\n"
msgstr "Impossible d'enregistrer le serveur D-Bus, désolé : %s.\n"
#: src/gui/window.vala:271
#: src/gui/window.vala:210
#, c-format
msgid "Error: could not set up the game: %s\n"
msgstr "Erreur : impossible de mettre en place la partie : %s\n"
......
......@@ -17,8 +17,6 @@
# <http://www.gnu.org/licenses/>.
AM_TESTS_ENVIRONMENT += \
LANG="C" \
LD_LIBRARY_PATH="src/.libs:$$LD_LIBRARY_PATH" \
./pre-inst-env \
$(LIBTOOL) --mode=execute
......
......@@ -19,5 +19,6 @@
include %reldir%/tarot-cli-program.am
include %reldir%/gettext-h.am
include %reldir%/dbus-service.am
include %reldir%/check-dbus.am
AM_CPPFLAGS += -I $(srcdir)/%reldir% -I %reldir%
#!/bin/sh
rm -rf bus-name
mkfifo bus-name || exit 1
>&2 echo "Starting the server..."
(tarot --dbus-server --anonymous-dbus > bus-name) &
BUS_NAME=$(head -n 1 bus-name)
>&2 echo "Connecting to bus $BUS_NAME"
GAME_ID=$(dbus-send --print-reply --dest="$BUS_NAME" /eu/planete_kraus/Tarot/Server/v1 eu.planete_kraus.Tarot.Server.CreateRandom uint32:5 boolean:true string:hello \
| tail -n 1 \
| xargs echo \
| cut -d ' ' -f 2- \
)
>&2 echo "The table id is $GAME_ID"
rm -rf final-score
mkfifo final-score || exit 1
for i in 0 $(seq 4)
do
>&2 echo "Starting player $i"
(tarot --dbus-mcts="/eu/planete_kraus/Tarot/Server/Games/$GAME_ID/seat/$i" --dbus-server-name="$BUS_NAME" >> final-score) &
done
SCORE=$(head -n 5 final-score | tee final-score-file)
if test "x$(wc -l final-score-file)" = "x5 final-score-file"
then
rm -f bus-name
rm -f final-score
rm -f final-score-file
else
>&2 echo "Failed: I got:"
>&2 echo "$SCORE"
exit 1
fi
# check-dbus.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/>.
dist_noinst_SCRIPTS += %reldir%/check-dbus
TESTS += %reldir%/check-dbus
......@@ -19,12 +19,14 @@
dbusdir = $(datadir)/dbus-1
servicesdbusdir = $(dbusdir)/services
servicesdbus_DATA += %reldir%/eu.planete_kraus.Tarot.service
servicesdbus_DATA = %reldir%/eu.planete_kraus.Tarot.service
$(srcdir)/%reldir%/eu.planete_kraus.Tarot.service: config.h %reldir%/dbus-service.am
DISTCLEANFILES += %reldir%/eu.planete_kraus.Tarot.service
%reldir%/eu.planete_kraus.Tarot.service: config.h %reldir%/dbus-service.am
$(AM_V_GEN) (echo "[D-BUS Service]" ; \
echo "Names=eu.planete_kraus.Tarot" ; \
echo "Exec=LANG=C $(bindir)/tarot --dbus-server") \
> $(srcdir)/%reldir%/eu.planete_kraus.Tarot.service-t
@mv $(srcdir)/%reldir%/eu.planete_kraus.Tarot.service-t \
$(srcdir)/%reldir%/eu.planete_kraus.Tarot.service
> %reldir%/eu.planete_kraus.Tarot.service-t
@mv %reldir%/eu.planete_kraus.Tarot.service-t \
%reldir%/eu.planete_kraus.Tarot.service
......@@ -143,7 +143,8 @@ namespace Tarot {
string? has_play = null;
bool has_render = false;
bool has_dbus_server = false;
string server_bus_name = "eu.planete_kraus.Tarot";
string default_server_bus_name = strdup ("eu.planete_kraus.Tarot");
string server_bus_name = default_server_bus_name;
string? has_dbus_mcts = null;
bool has_anonymous_dbus = false;
bool no_window = false;
......@@ -185,7 +186,8 @@ namespace Tarot {
options += create_option_int (_ ("width"), 'w', ref width, _ ("PNG width (defaults to 640)"), _ ("N"));
options += create_option_int (_ ("height"), 'h', ref height, _ ("PNG height (defaults to 480)"), _ ("N"));
options += create_option_none (_ ("anonymous-dbus"), 0, ref has_anonymous_dbus, _ ("Set this option if you want to run the D-Bus service anonymously."));
options += create_option_string (_ ("dbus-server-name"), 0, ref server_bus_name, _ ("Override the DBus server owned name (default: %s)").printf (server_bus_name), _ ("DBUS_NAME"));
string doc = _ ("Override the DBus server owned name (default: %s)").printf (default_server_bus_name);
options += create_option_string (_ ("dbus-server-name"), 0, ref server_bus_name, doc, _ ("DBUS_NAME"));
options += create_option_none (_ ("version"), 'v', ref print_version, _ ("Print version information and exit"));
GLib.OptionEntry final = { null };
options += final;
......@@ -318,6 +320,7 @@ namespace Tarot {
try {
var conn = Bus.get_sync (BusType.SESSION);
stdout.printf ("%s\n", conn.unique_name);
stdout.flush ();
conn.register_object (main_object_name, new Server (conn));
} catch (IOError e) {
stderr.printf (_ ("Could not register the D-Bus server, sorry: %s.\n"), e.message);
......@@ -342,6 +345,7 @@ namespace Tarot {
mcts.simulation_random = mparams.simulation_random;
mcts.finished.connect ((score) => {
stdout.printf ("%d\n", score);
stdout.flush ();
loop.quit ();
});
} catch (IOError e) {
......
......@@ -73,6 +73,8 @@ namespace Tarot {
}
}
private bool subscribed = false;
public MctsGame (Seat seat) {
m_game = new Tarot.Game.alloc ();
m_mcts = new Tarot.Mcts.alloc (2 * 1024 * 1024);
......@@ -130,7 +132,50 @@ namespace Tarot {
}
finished (scores[me]);
});
event_bid.connect (bid => {
try {
seat.bid (bid);
} catch (GLib.Error e) {