Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Tarot
tarot
Commits
b73bf50c
Commit
b73bf50c
authored
Mar 11, 2018
by
Vivien Kraus
Browse files
Add ONE check
parent
401f20e2
Pipeline
#42291
passed with stage
in 2 minutes and 23 seconds
Changes
42
Pipelines
1
Expand all
Hide whitespace changes
Inline
Side-by-side
.dir-locals.el.in
View file @
b73bf50c
...
...
@@ -22,4 +22,4 @@
(eval
. (setq company-clang-arguments
(split-string
"-I@abs_top_srcdir@ -I@abs_top_builddir@ @CFLAGS@ @CPPFLAGS@ @ASAN_CFLAGS@ -I@abs_top_srcdir@/src -I@abs_top_builddir@/src -I@abs_top_srcdir@/src/core -I@abs_top_builddir@/src/core -I@abs_top_srcdir@/src/guile -I@abs_top_builddir@/src/guile @GUILE_2_0_CFLAGS@ -I@abs_top_srcdir@/src/scm -I@abs_top_builddir@/src/scm ")))))
"-I@abs_top_srcdir@ -I@abs_top_builddir@ @CFLAGS@ @CPPFLAGS@ @ASAN_CFLAGS@ -I@abs_top_srcdir@/src -I@abs_top_builddir@/src -I@abs_top_srcdir@/src/core -I@abs_top_builddir@/src/core -I@abs_top_srcdir@/src/guile -I@abs_top_builddir@/src/guile
-I@abs_top_srcdir@/src/guile -I@abs_top_builddir@/src/guile
@GUILE_2_0_CFLAGS@ -I@abs_top_srcdir@/src/scm -I@abs_top_builddir@/src/scm ")))))
.gitignore
View file @
b73bf50c
...
...
@@ -53,6 +53,7 @@ configure
depcomp
doc/tarot.html
doc/tarot.info
games/*.c
install-sh
libtool
ltmain.sh
...
...
@@ -87,6 +88,7 @@ src/liblibtarot.la
src/libtarot.pc
src/scm/tarot
src/scm/tarot-resource-compiler
src/status/check
stamp-h1
stamp-vti
tarot-*.tar.gz
...
...
ChangeLog
View file @
b73bf50c
2018-03-11 Vivien Kraus <vivien@planete-kraus.eu>
* .gitignore: Ignore the generated .c resources for .tarot.
* Dockerfile: Do not package a version of the resource compiler.
* deploy.sh: First install the resource compiler.
2017-10-29 gettextize <bug-gnu-gettext@gnu.org>
* m4/gettext.m4: Upgrade to gettext-0.19.8.1.
...
...
Dockerfile
View file @
b73bf50c
...
...
@@ -7,5 +7,6 @@ RUN apt-get install -y --no-install-recommends nettle-dev libgtk-3-dev libgirepo
RUN
apt-get
install
-y
--no-install-recommends
emacs org-mode indent doxygen graphviz lcov dejagnu check
RUN
apt-get
install
-y
--no-install-recommends
libxml2-utils xsltproc
RUN
apt-get
install
-y
--no-install-recommends
guile-2.0-dev
RUN
apt-get
install
-y
--no-install-recommends
wget
RUN
apt-get upgrade
-y
MAINTAINER
framagit.org/gugurumbe/tarot
\ No newline at end of file
Makefile.am
View file @
b73bf50c
...
...
@@ -34,6 +34,7 @@ ACLOCAL_AMFLAGS = -I m4
EXTRA_DIST
=
\
.gitignore
\
.git/hooks/pre-commit
\
hooks/ChangeLog
\
hooks/pre-commit.sh
\
deploy.sh
\
README.org
\
...
...
@@ -56,11 +57,13 @@ CLEANFILES =
include
doc/Makefile.am
include
src/Makefile.am
include
games/Makefile.am
TESTS
=
$(check_PROGRAMS)
TESTS_ENVIRONMENT
=
LANG
=
"C"
indent_verbose
=
$
(
indent_verbose_@AM_V@
)
indent_verbose_
=
$
(
indent_verbose_@AM_DEFAULT_V@
)
indent_verbose_0
=
@echo
" INDENT
$<
"
;
indent_verbose_0
=
@echo
" INDENT "
;
.PHONY
:
indent
indent
:
$(INDENTED)
$(indent_verbose)
$(INDENT)
$(INDENTED)
...
...
@@ -91,5 +94,11 @@ githook_setup_verbose_0 = @echo "ORG-EXPORT $@";
$(srcdir)
/.git/hooks/pre-commit
\
&&
chmod
ugo+x
$(srcdir)
/.git/hooks/pre-commit
)
SUFFIXES
+=
.tarot
trc_verbose
=
$
(
trc_verbose_@AM_V@
)
trc_verbose_
=
$
(
trc_verbose_@AM_DEFAULT_V@
)
trc_verbose_0
=
@echo
" RESOURCE
$<
"
;
.tarot.c
:
$(trc_verbose)
$(TAROT_RESOURCE_COMPILER)
$<
-o
$@
$(trc_verbose)
$(TAROT_RESOURCE_COMPILER)
\
-n
"_tarot_load_
$
$(
basename
-s .tarot
$<
)
"
\
$<
\
-o
$@
deploy.sh
View file @
b73bf50c
#!/bin/sh
gnulib-tool
--import
--libtool
malloc-gnu gettext-h
||
exit
1
gnulib-tool
--import
--libtool
malloc-gnu gettext-h
snprintf
||
exit
1
autoreconf
-vif
||
exit
1
cp
/usr/share/gettext/gettext.h src/
||
exit
1
./configure
CFLAGS
=
"-Wall -Wextra -Werror -g -O0"
\
# First, install on the system
./configure
CFLAGS
=
"-Wall -Wextra -g -O0"
\
YFLAGS
=
"--report=all"
\
GUILE_2_0_CFLAGS
=
"
$(
/usr/bin/guile-config compile
)
"
\
GUILE_2_0_LIBS
=
"
$(
/usr/bin/guile-config
link
)
"
\
--enable-silent-rules
=
yes
\
||
exit
1
make
-j
16
# Do not dist nor check!
make
-j
16
install
# Then, use the installed resource compiler!
export
PATH
=
"
$PATH
:/usr/local/bin"
./configure
CFLAGS
=
"-Wall -Wextra -g -O0"
\
YFLAGS
=
"--report=all"
\
GUILE_2_0_CFLAGS
=
"
$(
/usr/bin/guile-config compile
)
"
\
GUILE_2_0_LIBS
=
"
$(
/usr/bin/guile-config
link
)
"
\
...
...
doc/Makefile.am
View file @
b73bf50c
...
...
@@ -29,6 +29,7 @@ info_TEXINFOS += %reldir%/tarot.texi
%reldir%/game/cards.texi
\
%reldir%/game/steps.texi
\
%reldir%/fdl.texi
\
%reldir%/game/steps/ChangeLog
\
%reldir%/game/steps/libtarot.texi
\
%reldir%/game/steps/deal.texi
\
%reldir%/game/steps/bids.texi
\
...
...
doc/game/steps/ChangeLog
0 → 100644
View file @
b73bf50c
2018-03-11 Vivien Kraus <vivien@planete-kraus.eu>
* tricks.texi (Tricks): Make it clear that hint_card does not keep
the hint allocated if it returns false.
* handful.texi (Handful): Make it clear that hint_handful does not
keep the hints allocated if it returns false.
* discard.texi (Discard): Make it clear that hint_discard does not
keep things allocated if false.
2018-03-10 Vivien Kraus <vivien@planete-kraus.eu>
* tricks.texi (Tricks): Document the has_taker and team_taker
fields in TarotTrickInfo.
doc/game/steps/discard.texi
View file @
b73bf50c
...
...
@@ -94,7 +94,11 @@ the taker, @var{n} to the total number of cards to discard, from the
@var{prio} cards and - only if @var{n} is strictly less than
@var{prio->n} - complete with cards from @var{additional}. If
@var{allocator} is @code{NULL}, then both @code{@var{*prio}} and
@code{@var{*additional}} must be free.
@code{@var{*additional}} must be freed, if not @code{NULL}. If the
return value is 0, then both @code{@var{*prio}} and
@code{@var{*additional}} are set to @code{NULL}. Otherwise, the
allocation order is @var{prio} and then @var{additional} so the
de-allocation should be @var{additional} and the @var{prio}.
Return whether there is a discard to do.
...
...
doc/game/steps/handful.texi
View file @
b73bf50c
...
...
@@ -58,9 +58,13 @@ shown in @var{game}. You should then show all priority cards, and add
cards from the additional set to complete it. Set @var{p} to the next
player to show a handful, @var{size} to the number of cards for a
simple, double or triple handful. Set @var{prio} and @var{additional}
to the cards of the priority and additional set. If @var{allocator} is
@code{NULL}, then both @code{*@var{prio}} and @code{*@var{additional}}
must be free.
to the cards of the priority and additional set. If @var{allocator}
is @code{NULL}, then both @code{*@var{prio}} and
@code{*@var{additional}} must be freed, if not @code{NULL}. If the
return value is 0, then both @code{@var{*prio}} and
@code{@var{*additional}} are set to @code{NULL}. Otherwise, the
allocation order is @var{prio} and then @var{additional} so the
de-allocation should be @var{additional} and the @var{prio}.
Return whether a handful can be shown or @var{p} does not have enough
trumps to show a handful.
...
...
doc/game/steps/tricks.texi
View file @
b73bf50c
...
...
@@ -56,10 +56,11 @@ the strongest trump, in case a trump has been played;
the strongest card of the @emph{lead suit}.
@end enumerate
@deftp {struct} TarotTrickInfo @{TarotPlayer @var{leader}; int @var{has_lead_suit}; TarotSuit @var{lead_suit}; unsigned int @var{n_cards}; TarotPlayer @var{taker}@}
Holds the information about a trick: its @var{leader} and @var{taker},
whether it has a lead suit (@var{has_lead_suit}) and if so, the
@var{lead_suit}; and the number of cards played @var{n_cards}.
@deftp {struct} TarotTrickInfo @{TarotPlayer @var{leader}; int @var{has_lead_suit}; TarotSuit @var{lead_suit}; unsigned int @var{n_cards}; int @var{has_taker}; TarotPlayer @var{taker}; TarotTeam @var{taker_team};@}
Holds the information about a trick: its @var{leader} and @var{taker}
(only if @var{has_taker}) with its @var{taker_team}, whether it has a
lead suit (@var{has_lead_suit}) and if so, the @var{lead_suit}; and
the number of cards played @var{n_cards}.
@end deftp
@deftypefun {void} tarot_game_trick (const TarotGame *@var{game}, unsigned int @var{i}, TarotTrickInfo *@var{dest})
...
...
@@ -76,7 +77,8 @@ Return the card played by @var{p} in the @var{i_trick}-th trick in
Fill @var{dest} with the cards that can be played in @var{game}, and
@var{p} to the next player to play. Return whether there is a card to
play in @var{game}. If @var{allocator} is @code{NULL}, then
@code{*@var{dest}} should be free.
@code{*@var{dest}} should be freed, if not @code{NULL}. If the return
value is 0, then @code{@var{*dest}} is set to @code{NULL}.
If we do not know @var{p}'s cards, then we hint to 0 cards.
Otherwise, the AI would be very slow.
...
...
games/Makefile.am
0 → 100644
View file @
b73bf50c
# Makefile.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%/artificial_combo.tarot
games/artificial_combo.tarot
0 → 100644
View file @
b73bf50c
; Well this game is sooooo artificial, but I guess it's difficult to
; find a game where a defendant takes all tricks with the excuse in
; the last trick
N_PLAYERS = 5
WITH_CALL = yes
PLAYER = P5
DEAL = (19, 18, 17, 16, 15, 14, 13, 12, 11) of trumps, excuse, \
(king, queen, knight, jack, 10) of hearts
BID = take
BID = pass
BID = pass
BID = pass
BID = pass ; Clearly we would be able to do better
DECL = no
DECL = no
DECL = no
DECL = no
DECL = yes
CALL = king of clubs
DOG = (6, 7, 8) of hearts
DISCARD = (ace, 2, 3) of hearts
; First trick (not realistic)
HANDFUL = excuse, (11, 12, 13, 14, 15, 16, 17, 18, 19) of trumps
CARD = 19 of trumps
HANDFUL = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10) of trumps
CARD = 10 of trumps
CARD = 20 of trumps
CARD = 21 of trumps
CARD = 6 of clubs
CARD = ace of clubs
CARD = 7 of clubs
CARD = 11 of trumps
CARD = 9 of trumps
CARD = 10 of clubs
CARD = king of hearts
CARD = 4 of hearts
CARD = 10 of diamonds
CARD = 2 of clubs
CARD = 9 of hearts
CARD = queen of hearts
CARD = 5 of hearts
CARD = jack of clubs
CARD = 3 of clubs
CARD = 8 of clubs
CARD = knight of hearts
CARD = 6 of hearts
CARD = jack of diamonds
CARD = 4 of clubs
CARD = 9 of clubs
CARD = jack of hearts
CARD = 7 of hearts
CARD = jack of spades
CARD = 5 of clubs
CARD = 6 of diamonds
CARD = 10 of hearts
CARD = 8 of hearts
CARD = knight of clubs
CARD = ace of diamonds
CARD = 7 of diamonds
CARD = 18 of trumps
CARD = 8 of trumps
CARD = knight of diamonds
CARD = 2 of diamonds
CARD = 8 of diamonds
CARD = 17 of trumps
CARD = 7 of trumps
CARD = knight of spades
CARD = 3 of diamonds
CARD = 9 of diamonds
CARD = 16 of trumps
CARD = 6 of trumps
CARD = queen of clubs
CARD = 4 of diamonds
CARD = 5 of spades
CARD = 15 of trumps
CARD = 5 of trumps
CARD = queen of diamonds
CARD = 5 of diamonds
CARD = 6 of spades
CARD = 14 of trumps
CARD = 4 of trumps
CARD = queen of spades
CARD = ace of spades
CARD = 7 of spades
CARD = 13 of trumps
CARD = 3 of trumps
CARD = king of diamonds
CARD = 2 of spades
CARD = 8 of spades
CARD = 12 of trumps
CARD = 2 of trumps
CARD = king of spades
CARD = 3 of spades
CARD = 9 of spades
CARD = excuse
CARD = petit
CARD = king of clubs
CARD = 4 of spades
CARD = 10 of spades
; The attackers have nothing but the discard, i.e. 1.5 points
; No oudlers, which means 56 points to reach -> -54.5
; Failed, -25 -> -79.5 -> -80
; Petit au bout -> -90
; take -> -90
; slam -> -490
; 2 * double handfuls -> -550
; Local Variables:
; mode: conf-windows
; End:
hooks/ChangeLog
0 → 100644
View file @
b73bf50c
2018-03-11 Vivien Kraus <vivien@planete-kraus.eu>
* pre-commit.sh (tmpdir): Install in $tmpdir/installation to use
the resource compiler.
hooks/pre-commit.sh
View file @
b73bf50c
...
...
@@ -10,10 +10,24 @@ git diff --staged | patch -p1 -d "$tmpdir/original" || exit 1
cp
-R
"
$tmpdir
/original"
"
$tmpdir
/rebuilt"
cd
"
$tmpdir
/rebuilt"
||
exit
1
gnulib-tool
--import
--libtool
malloc-gnu gettext-h
||
exit
1
gnulib-tool
--import
--libtool
malloc-gnu gettext-h
snprintf
||
exit
1
autoreconf
-vif
||
exit
1
cp
/usr/share/gettext/gettext.h src/
||
exit
1
./configure
CFLAGS
=
"-Wall -Wextra -Werror -g -O0"
\
# First, install on the system
./configure
CFLAGS
=
"-Wall -Wextra -g -O0"
\
YFLAGS
=
"--report=all"
\
GUILE_2_0_CFLAGS
=
"
$(
/usr/bin/guile-config compile
)
"
\
GUILE_2_0_LIBS
=
"
$(
/usr/bin/guile-config
link
)
"
\
--enable-silent-rules
=
yes
\
--prefix
=
"
$tmpdir
/installation"
\
||
exit
1
make
-j
16
# Do not dist nor check!
make
-j
16
install
export
PATH
=
"
$PATH
:
$tmpdir
/installation/bin"
./configure
CFLAGS
=
"-Wall -Wextra -g -O0"
\
YFLAGS
=
"--report=all"
\
GUILE_2_0_CFLAGS
=
"
$(
/usr/bin/guile-config compile
)
"
\
GUILE_2_0_LIBS
=
"
$(
/usr/bin/guile-config
link
)
"
\
...
...
po/POTFILES.in
View file @
b73bf50c
...
...
@@ -17,3 +17,5 @@
# <http://www.gnu.org/licenses/>.
src/core/_tarot_malloc.c
src/status/_tarot_status_string.c
src/status/check.c
\ No newline at end of file
po/fr.po
View file @
b73bf50c
This diff is collapsed.
Click to expand it.
po/tarot.pot
View file @
b73bf50c
...
...
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: tarot devel\n"
"Report-Msgid-Bugs-To: vivien@planete-kraus.eu\n"
"POT-Creation-Date: 2018-0
2
-1
3 22:08
+0100\n"
"POT-Creation-Date: 2018-0
3
-1
1 13:53
+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
...
...
@@ -17,7 +17,697 @@ msgstr ""
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
#: src/
core
/_tarot_
malloc.c:29
#: src/
status
/_tarot_
status_string.c:115
#, c-format
msgid "Dynamic memory exhausted.\n"
msgid "This is a game for %u players, with call.\n"
msgstr ""
#: src/status/_tarot_status_string.c:121
#, c-format
msgid "This is a game for %u players.\n"
msgstr ""
#: src/status/_tarot_status_string.c:138
#, c-format
msgid "Waiting for the deal.\n"
msgstr ""
#: src/status/_tarot_status_string.c:141
#, c-format
msgid "Now bidding.\n"
msgstr ""
#: src/status/_tarot_status_string.c:144
#, c-format
msgid "Now declaring.\n"
msgstr ""
#: src/status/_tarot_status_string.c:147
#, c-format
msgid "Now calling a partner.\n"
msgstr ""
#: src/status/_tarot_status_string.c:150
#, c-format
msgid "Waiting for the dog.\n"
msgstr ""
#: src/status/_tarot_status_string.c:153
#, c-format
msgid "Now discarding cards.\n"
msgstr ""
#: src/status/_tarot_status_string.c:160
#, c-format
msgid "Now playing and showing handfuls.\n"
msgstr ""
#: src/status/_tarot_status_string.c:164
#, c-format
msgid "Now playing.\n"
msgstr ""
#: src/status/_tarot_status_string.c:168
#, c-format
msgid "The game is finished.\n"
msgstr ""
#: src/status/_tarot_status_string.c:207
msgid "ace of hearts"
msgstr ""
#: src/status/_tarot_status_string.c:210
msgid "two of hearts"
msgstr ""
#: src/status/_tarot_status_string.c:213
msgid "three of hearts"
msgstr ""
#: src/status/_tarot_status_string.c:216
msgid "four of hearts"
msgstr ""
#: src/status/_tarot_status_string.c:219
msgid "five of hearts"
msgstr ""
#: src/status/_tarot_status_string.c:222
msgid "six of hearts"
msgstr ""
#: src/status/_tarot_status_string.c:225
msgid "seven of hearts"
msgstr ""
#: src/status/_tarot_status_string.c:228
msgid "eight of hearts"
msgstr ""
#: src/status/_tarot_status_string.c:231
msgid "nine of hearts"
msgstr ""
#: src/status/_tarot_status_string.c:234
msgid "ten of hearts"
msgstr ""
#: src/status/_tarot_status_string.c:237
msgid "jack of hearts"
msgstr ""
#: src/status/_tarot_status_string.c:240
msgid "knight of hearts"
msgstr ""
#: src/status/_tarot_status_string.c:243
msgid "queen of hearts"
msgstr ""
#: src/status/_tarot_status_string.c:246
msgid "king of hearts"
msgstr ""
#: src/status/_tarot_status_string.c:249
msgid "ace of clubs"
msgstr ""
#: src/status/_tarot_status_string.c:252
msgid "two of clubs"
msgstr ""
#: src/status/_tarot_status_string.c:255
msgid "three of clubs"
msgstr ""
#: src/status/_tarot_status_string.c:258
msgid "four of clubs"
msgstr ""
#: src/status/_tarot_status_string.c:261
msgid "five of clubs"
msgstr ""
#: src/status/_tarot_status_string.c:264
msgid "six of clubs"
msgstr ""
#: src/status/_tarot_status_string.c:267
msgid "seven of clubs"
msgstr ""
#: src/status/_tarot_status_string.c:270
msgid "eight of clubs"
msgstr ""
#: src/status/_tarot_status_string.c:273
msgid "nine of clubs"
msgstr ""
#: src/status/_tarot_status_string.c:276
msgid "ten of clubs"
msgstr ""
#: src/status/_tarot_status_string.c:279
msgid "jack of clubs"
msgstr ""
#: src/status/_tarot_status_string.c:282
msgid "knight of clubs"
msgstr ""
#: src/status/_tarot_status_string.c:285
msgid "queen of clubs"
msgstr ""
#: src/status/_tarot_status_string.c:288
msgid "king of clubs"
msgstr ""
#: src/status/_tarot_status_string.c:291
msgid "ace of diamonds"
msgstr ""
#: src/status/_tarot_status_string.c:294
msgid "two of diamonds"
msgstr ""
#: src/status/_tarot_status_string.c:297
msgid "three of diamonds"
msgstr ""
#: src/status/_tarot_status_string.c:300
msgid "four of diamonds"
msgstr ""
#: src/status/_tarot_status_string.c:303
msgid "five of diamonds"
msgstr ""
#: src/status/_tarot_status_string.c:306
msgid "six of diamonds"
msgstr ""
#: src/status/_tarot_status_string.c:309
msgid "seven of diamonds"
msgstr ""
#: src/status/_tarot_status_string.c:312
msgid "eight of diamonds"
msgstr ""
#: src/status/_tarot_status_string.c:315
msgid "nine of diamonds"
msgstr ""
#: src/status/_tarot_status_string.c:318
msgid "ten of diamonds"
msgstr ""
#: src/status/_tarot_status_string.c:321
msgid "jack of diamonds"
msgstr ""
#: src/status/_tarot_status_string.c:324
msgid "knight of diamonds"
msgstr ""
#: src/status/_tarot_status_string.c:327
msgid "queen of diamonds"
msgstr ""
#: src/status/_tarot_status_string.c:330
msgid "king of diamonds"
msgstr ""
#: src/status/_tarot_status_string.c:333
msgid "ace of spades"
msgstr ""
#: src/status/_tarot_status_string.c:336
msgid "two of spades"
msgstr ""
#: src/status/_tarot_status_string.c:339
msgid "three of spades"
msgstr ""
#: src/status/_tarot_status_string.c:342
msgid "four of spades"
msgstr ""
#: src/status/_tarot_status_string.c:345
msgid "five of spades"
msgstr ""
#: src/status/_tarot_status_string.c:348