Skip to content

Commit

Permalink
Removed features marked as deprecated in 16.2.
Browse files Browse the repository at this point in the history
  • Loading branch information
tturocy committed Nov 22, 2023
1 parent 368babb commit 0aa8a11
Show file tree
Hide file tree
Showing 9 changed files with 6 additions and 651 deletions.
30 changes: 0 additions & 30 deletions src/pygambit/action.pxi
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
from deprecated import deprecated

@cython.cclass
class Action:
Expand All @@ -40,27 +39,6 @@ class Action:
def __hash__(self) -> int:
return cython.cast(cython.long, self.action.deref())

@deprecated(version='16.1.0',
reason='Use Game.delete_action instead of Action.delete.',
category=FutureWarning)
def delete(self):
"""Deletes this action from its information set. The subtrees which
are rooted at nodes that follow the deleted action are also deleted.
.. deprecated:: 16.1.0
Use `Game.delete_action` instead of `Action.delete`.
Raises
------
UndefinedOperationError
If the action is the only action at its information set
"""
if len(self.infoset.actions) == 1:
raise UndefinedOperationError(
"It is not possible to delete the last action of an infoset"
)
self.action.deref().DeleteAction()

def precedes(self, node: Node) -> bool:
"""Returns whether `node` precedes this action in the
extensive game.
Expand Down Expand Up @@ -95,10 +73,6 @@ class Action:
"""
Get the probability a chance action is played.

.. deprecated:: 16.1.0
Setting individual chance action probabilities is no longer supported.
Use `Game.set_chance_probs()` instead.

Raises
------
UndefinedOperationError
Expand All @@ -114,7 +88,3 @@ class Action:
return decimal.Decimal(py_string.decode('ascii'))
else:
return Rational(py_string.decode('ascii'))

@prob.setter
def prob(self, value: typing.Any) -> None:
raise UndefinedOperationError("use Game.set_chance_probs() to set probabilities at chance information sets")
27 changes: 0 additions & 27 deletions src/pygambit/game.pxi
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import itertools
import pathlib

import numpy as np
from deprecated import deprecated

import pygambit.gte
import pygambit.gameiter
Expand All @@ -44,21 +43,6 @@ class Outcomes(Collection):
c.outcome = self.game.deref().GetOutcome(outc+1)
return c

@deprecated(version='16.1.0',
reason='Use Game.add_outcome() instead of Game.outcomes.add()',
category=FutureWarning)
def add(self, label="") -> Outcome:
"""Add a new outcome to the game.

.. deprecated:: 16.1.0
Use `Game.add_outcome` instead of `Outcomes.add`.
"""
c = Outcome()
c.outcome = self.game.deref().NewOutcome()
if label != "":
c.label = str(label)
return c


@cython.cclass
class Players(Collection):
Expand All @@ -76,17 +60,6 @@ class Players(Collection):
p.player = self.game.deref().GetPlayer(pl+1)
return p

@deprecated(version='16.1.0',
reason='Use Game.add_player() instead of Game.players.add()',
category=FutureWarning)
def add(self, label="") -> Player:
"""Adds a new player to the game."""
p = Player()
p.player = self.game.deref().NewPlayer()
if label != "":
p.label = str(label)
return p

@property
def chance(self) -> Player:
"""Returns the chance player associated with the game."""
Expand Down
58 changes: 0 additions & 58 deletions src/pygambit/infoset.pxi
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
from deprecated import deprecated

@cython.cclass
class Members(Collection):
Expand All @@ -45,25 +44,6 @@ class Actions(Collection):
"""The set of actions which are available at an information set."""
infoset = cython.declare(c_GameInfoset)

@deprecated(version='16.1.0',
reason='Use Game.add_action instead of Actions.add.',
category=FutureWarning)
def add(self, action=None):
"""Add an action at the information set. If `action` is not null, the new action
is inserted before `action`.
.. deprecated:: 16.1.0
Use `Game.add_action` instead of `Actions.add`.
"""
if action is None:
self.infoset.deref().InsertAction(cython.cast(c_GameAction, NULL))
elif isinstance(action, Action):
if cython.cast(Infoset, action.infoset).infoset != self.infoset:
raise MismatchError("The new action should be from the same infoset")
self.infoset.deref().InsertAction(cython.cast(Action, action).action)
else:
raise TypeError("insert_action takes an Action object as its input")

def __len__(self):
"""The number of actions at the information set."""
return self.infoset.deref().NumActions()
Expand Down Expand Up @@ -97,44 +77,6 @@ class Infoset:
"""Return whether this information set precedes `node` in the game tree."""
return self.infoset.deref().Precedes(cython.cast(Node, node).node)

@deprecated(version='16.1.0',
reason='Use Game.reveal instead of Infoset.game.',
category=FutureWarning)
def reveal(self, player: Player) -> None:
"""Reveal the move made at the information set to `player`.

Revealing the move modifies all subsequent information sets for `player` such
that any two nodes which are successors of two different actions at this
information set are placed in different information sets for `player`.

Revelation is a one-shot operation; it is not enforced with respect to any
revisions made to the game tree subsequently.

.. deprecated:: 16.1.0
Use `Game.reveal` instead of `Infoset.reveal`.

Parameters
----------
player : Player
The player to which to reveal the move at this information set.

Raises
------
TypeError
on passing an object that is not a :py:class:`Player`.
MismatchError
on revealing to a player that is from a different game.
"""
if not isinstance(player, Player):
raise TypeError(
f"player must be of type Player, not {player.__class__.__name__}"
)
if player.game != self.game:
raise MismatchError(
"player must belong to the same game as the information set"
)
self.infoset.deref().Reveal(cython.cast(Player, player).player)

@property
def game(self) -> Game:
"""The ``Game`` to which the information set belongs."""
Expand Down
Loading

0 comments on commit 0aa8a11

Please sign in to comment.