Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
Signed-off-by: jparisu <[email protected]>
  • Loading branch information
jparisu committed Feb 22, 2025
1 parent f7beac8 commit 6a16512
Show file tree
Hide file tree
Showing 18 changed files with 64 additions and 34 deletions.
14 changes: 9 additions & 5 deletions .github/workflows/install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,17 @@ jobs:
with:
python-version: '3.x'

# - name: Install dependencies
# run: |
# python -m pip install --upgrade pip
# pip install -r requirements.txt
- name: Extract branch name
id: branch
run: echo "BRANCH=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Install package from current branch
run: pip install --upgrade git+https://github.com/jparisu/sIArena.git@${GITHUB_REF#refs/heads/}
run: pip install --upgrade git+https://github.com/jparisu/sIArena.git@${BRANCH}

- name: Run tests
run: pytest
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,4 @@
:maxdepth: 2
:hidden:

/rst/appendixes/glossary
/src/appendixes/glossary
8 changes: 8 additions & 0 deletions docs/spelling/spelling_wordlist.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,10 @@
Colab
IArena
IGameRules
IMovement
IPosition
IPlayer
Tic
Tac
Toe
conda
26 changes: 26 additions & 0 deletions docs/src/appendixes/glossary.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@

.. _glossary:

########
Glossary
########

.. glossary::

Arena
A class that represents the game flow. Uses one GameRule and several players to play a game, returning the final score.

GameRule
A class that defines the rules of a game. It contains methods to help creating the game flow.

Movement
A class that represents a movement in a game. Along with GameRules, generates new Positions given a source one.

Player
A class that represents a player in a game. It contains the method to return a movement given a position.

Position
A class that represents a specific state of a game. Along with the GameRules, it defines the game.

Score
A class that represents the score of a terminated game. Each player has its own score.
6 changes: 3 additions & 3 deletions docs/src/games/games.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ The *IMovement* represents a movement of the game that goes from one position to

.. _rules:

------
IRules
------
----------
IGameRules
----------

Represent the rules of a game implementing the following methods:

Expand Down
1 change: 0 additions & 1 deletion docs/src/games/tutorials/coins.rst
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ A position is represented by an ``int`` describing the size of the remaining sta
Rules
=====

This games has every methods of :ref:`IRules <infrastructure_rules>`.

It counts with 2 methods to get the minimum and maximum number of coins that can be taken:

Expand Down
1 change: 0 additions & 1 deletion docs/src/games/tutorials/fieldwalk.rst
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ One indicates the x axis, other the y axis and the last one the cost to arrive t
Rules
=====

This games has every methods of :ref:`IRules <infrastructure_rules>`.

-----------
Constructor
Expand Down
1 change: 0 additions & 1 deletion docs/src/games/tutorials/hanoi.rst
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ The disks go from ``0`` to ``N-1`` in ascending order being ``0`` the highest di
Rules
=====

This games has every methods of :ref:`IRules <infrastructure_rules>`.

-----------
Constructor
Expand Down
3 changes: 1 addition & 2 deletions docs/src/games/tutorials/highestcard.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Highest Card

This game is a card game with ``N`` players and ``NxM`` cards.
The objective of the game is to guess the number of rounds that the player will win with its ``M`` cards.
Each player guesses in secret at the begining knowing only their ``M`` cards, for how many rounds it will win.
Each player guesses in secret at the beginning knowing only their ``M`` cards, for how many rounds it will win.
Then, ``M`` rounds are played in which each player plays its highest card.
The player that gets closer to the real number of rounds that it wins without passing it, wins the game.

Expand Down Expand Up @@ -84,7 +84,6 @@ Each player can get its cards from the position, and only its cards.
Rules
=====

This games has every methods of :ref:`IRules <infrastructure_rules>`.

It counts with 2 method to retrieve the values of the game

Expand Down
3 changes: 1 addition & 2 deletions docs/src/games/tutorials/mastermind.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ The goal is to guess the code in the fewest number of turns.

Some changes have been made to the original game:

- There is only a one player game (guesser) while the other player (codemaker) is the game itself.
- There is only a one player game (guesser) while the other player (password-maker) is the game itself.
- Instead of colors we use numbers.
- The clues of each guess is not only the number of appearance and correctness, but are linked with a direct position in the guess.
- Numbers could be repeated in the secret code.
Expand Down Expand Up @@ -105,7 +105,6 @@ or whether it is not present in the secret code (``0``).
Rules
=====

This games has every methods of :ref:`IRules <infrastructure_rules>`.

It counts with 2 methods to get the minimum and maximum number of coins that can be taken:

Expand Down
1 change: 0 additions & 1 deletion docs/src/games/tutorials/nim.rst
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ A position is represented by a ``list`` of ``int`` describing each row:
Rules
=====

This games has every methods of :ref:`IRules <infrastructure_rules>`.


-----------
Expand Down
1 change: 0 additions & 1 deletion docs/src/games/tutorials/nqueens.rst
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ Each movement represents the position of a queen in the board.
Rules
=====

This games has every methods of :ref:`IRules <infrastructure_rules>`.

Remember that using ``score`` method can give the current result of the game:

Expand Down
1 change: 0 additions & 1 deletion docs/src/games/tutorials/prisoner.rst
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ The rules are stored within the rules
Rules
=====

This games has every methods of :ref:`IRules <infrastructure_rules>`.

It counts with 1 method to retrieve the score matrix:

Expand Down
1 change: 0 additions & 1 deletion docs/src/games/tutorials/slicing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ It counts with the following methods:
Rules
=====

This games has every methods of :ref:`IRules <infrastructure_rules>`.


-----------
Expand Down
1 change: 0 additions & 1 deletion docs/src/games/tutorials/tictactoe.rst
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ Each position is represented by an integer, ``0`` for empty, ``1`` for player 1
Rules
=====

This games has every methods of :ref:`IRules <infrastructure_rules>`.


-----------
Expand Down
9 changes: 0 additions & 9 deletions docs/src/infraestructure.rst

This file was deleted.

17 changes: 13 additions & 4 deletions docs/src/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Installation
Google Colab
============

Using :ref:`Google Colab <https://colab.google>` is the easiest way to get started.
Using `Google Colab <https://colab.google>` is the easiest way to get started.
Just add in the first cell of your notebook:

.. code-block:: python
Expand All @@ -35,13 +35,22 @@ From a command prompt, you can install it in a conda environment inside Anaconda
.. code-block:: bash
conda install git
pip install --upgrade git+https://github.com/jparisu/[email protected]
pip install --upgrade git+https://github.com/jparisu/IArena.git
===========================
Install with pip
===========================

To install the package with ``pip``, you can use the following command:

.. code-block:: bash
pip install --upgrade git+https://github.com/jparisu/IArena.git
===========
Coming soon
===========

- Installation from source
- Installation via ``pip``
- Installation via ``conda``
2 changes: 2 additions & 0 deletions docs/src/players/players.rst
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,8 @@ Then, it decides the movement with the lower heuristic.

Remember that the best movement is the one with the lowest heuristic.


---------------------------------
Multiplayer game heuristic player
---------------------------------

Expand Down

0 comments on commit 6a16512

Please sign in to comment.