Accepting request 789263 from home:mnhauke:games

Initial package for morris

OBS-URL: https://build.opensuse.org/request/show/789263
OBS-URL: https://build.opensuse.org/package/show/games/morris?expand=0&rev=1
This commit is contained in:
Ferdinand Thiessen
2020-03-28 23:34:12 +00:00
committed by Git OBS Bridge
commit f25094f1be
10 changed files with 1710 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
.osc

115
boost-signals.patch Normal file
View File

@@ -0,0 +1,115 @@
Author: Reiner Herrmann <reiner@reiner-h.de>
Description: use signals2 instead of signals boost library
Bug-Debian: https://bugs.debian.org/950633
--- a/src/control.hh
+++ b/src/control.hh
@@ -21,7 +21,7 @@
#include <string>
#include <boost/shared_ptr.hpp>
-#include <boost/signals.hpp>
+#include <boost/signals2/signal.hpp>
#include "board.hh"
#include "player.hh"
@@ -148,11 +148,11 @@
// --- signals ---
- boost::signal<void (Player)>& getSignal_gameOver() { return m_signal_gameOver; }
- boost::signal<void (GameState)>& getSignal_changeState() { return m_signal_changeState; }
- boost::signal<void ()>& getSignal_changeBoard() { return m_signal_changeBoard; }
- boost::signal<void (player_ptr)>& getSignal_startMove() { return m_signal_startMove; }
- boost::signal<void (player_ptr)>& getSignal_endMove() { return m_signal_endMove; }
+ boost::signals2::signal<void (Player)>& getSignal_gameOver() { return m_signal_gameOver; }
+ boost::signals2::signal<void (GameState)>& getSignal_changeState() { return m_signal_changeState; }
+ boost::signals2::signal<void ()>& getSignal_changeBoard() { return m_signal_changeBoard; }
+ boost::signals2::signal<void (player_ptr)>& getSignal_startMove() { return m_signal_startMove; }
+ boost::signals2::signal<void (player_ptr)>& getSignal_endMove() { return m_signal_endMove; }
private:
rulespec_ptr m_ruleSpec;
@@ -180,12 +180,12 @@
// signals
- boost::signal<void (Player)> m_signal_gameOver;
- boost::signal<void (GameState)> m_signal_changeState;
- boost::signal<void ()> m_signal_changeBoard;
+ boost::signals2::signal<void (Player)> m_signal_gameOver;
+ boost::signals2::signal<void (GameState)> m_signal_changeState;
+ boost::signals2::signal<void ()> m_signal_changeBoard;
- boost::signal<void (player_ptr)> m_signal_startMove;
- boost::signal<void (player_ptr)> m_signal_endMove;
+ boost::signals2::signal<void (player_ptr)> m_signal_startMove;
+ boost::signals2::signal<void (player_ptr)> m_signal_endMove;
};
#endif
--- a/src/movelog.hh
+++ b/src/movelog.hh
@@ -19,7 +19,7 @@
#ifndef MOVELOG_HH
#define MOVELOG_HH
-#include <boost/signals.hpp>
+#include <boost/signals2/signal.hpp>
/* A window showing a log of all moves in the current game.
@@ -31,10 +31,10 @@
virtual void refresh() = 0;
- boost::signal<void ()>& getSignal_windowClosed() { return m_signal_windowClosed; }
+ boost::signals2::signal<void ()>& getSignal_windowClosed() { return m_signal_windowClosed; }
protected:
- boost::signal<void ()> m_signal_windowClosed;
+ boost::signals2::signal<void ()> m_signal_windowClosed;
};
#endif
--- a/src/gtk_movelog.hh
+++ b/src/gtk_movelog.hh
@@ -39,7 +39,7 @@
GtkListStore* liststore;
gulong destroyHandler;
- boost::signals::connection refreshConnection;
+ boost::signals2::connection refreshConnection;
void cbDestroy();
friend gboolean cbMoveLog_gtk_destroy(GtkWidget *widget, gpointer data);
--- a/src/mainapp.hh
+++ b/src/mainapp.hh
@@ -130,7 +130,7 @@
// --- signals ---
- boost::signal<void (bool)>& getSignal_pauseChanged() { return m_signal_pauseChanged; }
+ boost::signals2::signal<void (bool)>& getSignal_pauseChanged() { return m_signal_pauseChanged; }
private:
MainApp();
@@ -170,7 +170,7 @@
void startMove(player_ptr);
void endMove(player_ptr);
- boost::signal<void (bool)> m_signal_pauseChanged;
+ boost::signals2::signal<void (bool)> m_signal_pauseChanged;
};
#endif
--- a/configure.ac
+++ b/configure.ac
@@ -36,7 +36,6 @@
# libgnome-2.0 libgnomeui-2.0
AX_BOOST_BASE
-AX_BOOST_SIGNALS
# Checks for header files.
AC_CHECK_HEADERS([libintl.h locale.h stdlib.h string.h sys/time.h])

1303
gsettings-port.patch Normal file

File diff suppressed because it is too large Load Diff

13
localedir.patch Normal file
View File

@@ -0,0 +1,13 @@
diff --git a/po/Makefile.in.in b/po/Makefile.in.in
index 402a25f..2747b3d 100644
--- a/po/Makefile.in.in
+++ b/po/Makefile.in.in
@@ -34,7 +34,7 @@ datadir = @datadir@
datarootdir = @datarootdir@
libdir = @libdir@
DATADIRNAME = @DATADIRNAME@
-itlocaledir = $(prefix)/$(DATADIRNAME)/locale
+itlocaledir = $(prefix)/share/locale
subdir = po
install_sh = @install_sh@
# Automake >= 1.8 provides @mkdir_p@.

3
morris-0.2.tar.bz2 Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:f96c387c2bf98de4c6d4a3b687b8127d1de53f4f957df11ce5bc329a3562c38b
size 212066

131
morris.6 Normal file
View File

@@ -0,0 +1,131 @@
.\"
.TH "morris" "6" "0.2" "" "Games"
.SH "NAME"
morris \- Nine Men's Morris game for the Gnome desktop
.SH "SYNOPSIS"
.B morris
.SH "DESCRIPTION"
Morris is an implementation of the board game "Nine Men's Morris". Other names for this game are: Mills, Merrills, Morris, or Mühle in German. Nine Men's Morris, being probably 2000-3000 years old, appears to be one of the oldest board games, much older than chess. From the 12th to the 18th century, Nine Men's Morris was one of the most popular board games in Europe. However, it is still actively played today and exists in several variants, e.g., Morabaraba, which is particularly popular in South Africa.
This implementation of Nine Men's Morris supports not only the standard game, but also several rule-variants and different board layouts. You can play against the computer, or simply use the program to present the board, but play against another human opponent. The computer opponent learns from previous games and tries not to make the same mistake twice. This ensures enough variation in game-play, should you once have managed to beat the program.
.SH "FEATURES"
.P
Among others, the game plays the following variants:
.TP
- Lasker variant (moves are also allowed in the set-phase)
.TP
- The Möbius board (invented by Ingo Althöfer)
.TP
- The Windmill board
.TP
- The Windmill board
.TP
- Pentagon and Hexagon boards
.TP
- Morabaraba
.TP
- Six and Seven Men's Morris
.TP
- Tapatan, Achi, Nine Holes
.P
Furthermore, the game supports:
.TP
- Advanced AI controls to tweak AI playing style
.TP
- Giving hints for good moves
.TP
- Showing the principal variation
.TP
- Move takeback (undo and redo)
.TP
- Internationalization (English, German, Chinese)
.TP
- Many board and rule variations
.TP
- Free customization of rules
.TP
- Configurable display
.SH "STANDARD RULES"
Each player has nine pieces (hence the name, Nine Men's Morris) which are placed and moved on the line crossings of the board. Whenever three pieces of the same color are placed in a straight row, a mill is closed and one opponent piece may be removed. The goal of the game is to reduce the opponent to only two pieces (such that he cannot form a mill anymore), or to surround the opponent pieces in such a way that there are no valid moves for the opponent.
The game proceeds in three distinct phases (opening, midgame, and endgame). Unlike chess, these phases are distinguished by special rules for each phase.
.TP
.B Opening - Setting pieces
The white player begins. Each player places one piece on an unoccupied position on the board in turns. If a mill is closed by setting a piece, the player may take one of the opponent's pieces. Once all pieces are set, the midgame starts.
.PP
.TP
.B Midgame - Moving pieces
Each player moves one piece along the lines to a free, neighboring position. Again, if the move results in closing a mill, one of the opponent's pieces may be removed. Note that a player must move a piece in each turn. If there is no legal move, the player has lost.
.PP
.TP
.B Endgame - Flying
If a player has only three pieces left, he my jump (or fly) with one piece to any unoccupied position instead of moving only along the board lines.
.PP
.SH "RULE DETAILS AND GAME VARIATIONS"
Some of these rules are often interpreted differently, such that a variety of rule variants exist. This game tries to support most of them. In particular, the following rule variations are supported:
.TP
.B Taking from opponent mills
When a mill is closed, one opponent stone may be taken. However, usually, it is
not allowed to take a piece from an opponent's mill, if he still has pieces that are not part of a mill. If you want, you can also allow players to take pieces from an opponent's mill. Note that you can always take pieces from an opponent's mill, if all of his pieces are within mills.
.PP
.TP
.B Multiple mills
In the setting phase, it may happen that two mills are closed simultaneously. In the multiple-mills variations, the player may take two opponent pieces, in this case.
.PP
.TP
.B Flying
Some people prefer to omit the flying rule, such that only standard moves may be conducted, even when a player is down to only three pieces.
.PP
.TP
.B Lasker variant (proposed by the chess grandmaster Emanuel Lasker)
There is no difference between opening and midgame. I.e., a player may decide to move a piece instead of setting a new piece. Usually, this variant is played with 10 pieces instead of only 9.
.PP
.TP
.B Remis
If the same board situation appeared for N times (with N usually 3), the game is declared remis.
.PP
.SH "AI ALGORITHM"
The AI algorithm is a standard alpha-beta search in a NegaMax implementation using iterative deepening. It employs a transposition table to quickly find previously computed positions.
A special feature is the automatic learning capability: whenever the computer wins or loses a game, it will prefer to obtain or avoid similar situations in the future. This results in a better long-term motivation, since the computer will not make the same mistake twice and the gameplay will be more randomized.
The evaluation function is still quite basic and consists of four parts:
.TP
.B Material
The number of pieces each player has left
.PP
.TP
.B Freedom
The number of possible moves a player can conduct
.PP
.TP
.B Mills
The number of closed mills
.PP
.TP
.B Experience
The learning-bias from previous games.
.PP
.SH "SEE ALSO"
You can find more information at http://nine-mens-morris.net/
For bug reports, patches, or any kind of discussion, contact Dirk Farin <dirk.farin@gmail.com>

9
morris.changes Normal file
View File

@@ -0,0 +1,9 @@
-------------------------------------------------------------------
Sat Mar 28 09:48:14 UTC 2020 - Martin Hauke <mardnh@gmx.de>
- Initial package, version 0.2
Add patches:
* boost-signals.patch
* gsettings-port.patch
* localedir.patch
* workaround_autotools.patch

99
morris.spec Normal file
View File

@@ -0,0 +1,99 @@
#
# spec file for package morris
#
# Copyright (c) 2020, Martin Hauke <mardnh@gmx.de>
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
Name: morris
Version: 0.2
Release: 0
Summary: Nine men's morris game
License: GPL-3.0-only
Group: Amusements/Games/Strategy/Other
URL: http://nine-mens-morris.net/index.html
Source: http://nine-mens-morris.net/data/%{name}-%{version}.tar.bz2
Source1: morris.6
Patch0: boost-signals.patch
Patch1: gsettings-port.patch
Patch2: workaround_autotools.patch
Patch3: localedir.patch
BuildRequires: automake
BuildRequires: boost-devel
BuildRequires: gcc-c++
BuildRequires: gconf2
BuildRequires: intltool
BuildRequires: pkgconfig
BuildRequires: pkgconfig(glib-2.0)
BuildRequires: pkgconfig(gthread-2.0)
BuildRequires: pkgconfig(gtk+-2.0) >= 2.4
%description
Morris is an implementation of the board game "Nine Men's Morris".
Other names for this game are: Mills, Merrills, Morris, or Mühle in
German.
This implementation of Nine Men's Morris supports not only the
standard game, but also several rule-variants and different board
layouts. You can play against the computer, or simply use the
program to present the board, but play against another human
opponent. The computer opponent learns from previous games and
tries not to make the same mistake twice.
Among others, the game plays the following variants:
* Lasker variant (moves are also allowed in the set-phase)
* the Möbius board (invented by Ingo Althöfer)
* the Windmill board
* Pentagon and Hexagon boards
* Morabaraba
* Six and Seven Men's Morris
* Tapatan, Achi, Nine Holes
Furthermore, the game supports:
* advanced AI controls to tweak AI playing style
* giving hints for good moves
* showing the principal variation
* move takeback (undo and redo)
* internationalization (English, German, Chinese)
* many board and rule variations, as well as free customization
of rules
* configurable display
%prep
%setup -q
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%build
export CXXFLAGS="%{optflags} -Wno-return-type"
autoreconf -fiv
%configure
%make_build
%install
%make_install
install -Dpm 0644 %{SOURCE1} %{buildroot}%{_mandir}/man6/%{name}.6
%find_lang %{name}
%files -f %{name}.lang
%license COPYING
%doc AUTHORS ChangeLog README
%{_datadir}/glib-2.0/schemas/net.nine-mens-morris.gschema.xml
%{_bindir}/%{name}
%{_datadir}/applications/%{name}.desktop
%{_datadir}/pixmaps/%{name}.png
%{_mandir}/man6/%{name}.6%{?ext_man}
%changelog

View File

@@ -0,0 +1,13 @@
diff --git a/configure.ac b/configure.ac
index 18951eb..3366e43 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5,7 +5,7 @@ AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_SRCDIR([src/morris.cc])
AC_CONFIG_HEADERS([config.h])
-AM_INIT_AUTOMAKE([-Wall -Werror foreign dist-bzip2])
+AM_INIT_AUTOMAKE([-Wall foreign dist-bzip2])
#AM_MAINTAINER_MODE
#AC_CONFIG_MACRO_DIR([m4])