<commit_before># Giles: poison.py
# Copyright 2015 <NAME>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero 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 Affero General Public License for more details.

# You should have received a copy of the GNU Affero General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

import random

from giles.utils import get_plural_str
from giles.state import State
from giles.games.seated_game import SeatedGame
from giles.games.seat import Seat

# Minimums and maximums.
MIN_ANTIDOTE_COUNT = 1
MAX_ANTIDOTE_COUNT = 8

MIN_POISON_COUNT = 1
MAX_POISON_COUNT = 8

MIN_GOAL = 1
MAX_GOAL = 8

TAGS = ["bluff", "random", "3p", "4p", "5p", "6p", "7p", "8p", "9p", "10p"]

_ANTIDOTE_LIST = ('antidote', 'anti', 'a')
_POISON_LIST = ('poison', 'pois', 'poi', 'p')

class Poison(SeatedGame):
    """An implementation of 'Skull' by <NAME>, without any of the
    gorgeous artwork, sadly.
    """

    def __init__(self, server, table_name):

        super(Poison, self).__init__(server, table_name)

        self.game_display_name = "Poison"
        self.game_name = "poison"
        self.seats = [
            Seat("Alpha"),
            Seat("Bravo"),
            Seat("Charlie"),
            Seat("Delta"),
            Seat("Echo"),
            Seat("Foxtrot"),
            Seat("Golf"),
            Seat("Hotel"),
            Seat("India"),
            Seat("Juliet")
        ]
        self.state = State("need_players")
        self.prefix = "(^RPoison^~) "
        self.log_prefix = "%s/%s: " % (self.table_display_name, self.game_display_name)
        self.min_players = 3
        self.max_players = 10

        # Default configuration.
        self.antidote_count = 3
        self.poison_count = 1
        self.goal = 2

        # Mutable information.
        self.turn = None
        self.highest_bidder = None

    def get_color_code(self, seat):
        color_index = self.seats.index(seat) % 4

        if color_index == 0:
            return "^R"
        elif color_index == 1:
            return "^Y"
        elif color_index == 2:
            return "^M"
        else:
            return "^C"

    def get_sp_str(self, seat):
        return "^G%s^~ (%s%s^~)" % (seat.player_name, self.get_color_code(seat), seat)

    def next_seat(self, seat, bidding=False):

        # Skip players that are dead and, if bidding, have passed.
        player_count = len(self.seats)
        index = (self.seats.index(seat) + 1) % player_count
        done = False
        while not done:
            index = (index + 1) % player_count
            this_seat = self.seats[index]
            if not this_seat.data.is_dead:<commit_msg>Poison: Correctly handle player order.<commit_after># Giles: poison.py
# Copyright 2015 <NAME>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero 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 Affero General Public License for more details.

# You should have received a copy of the GNU Affero General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

import random

from giles.utils import get_plural_str
from giles.state import State
from giles.games.seated_game import SeatedGame
from giles.games.seat import Seat

# Minimums and maximums.
MIN_ANTIDOTE_COUNT = 1
MAX_ANTIDOTE_COUNT = 8

MIN_POISON_COUNT = 1
MAX_POISON_COUNT = 8

MIN_GOAL = 1
MAX_GOAL = 8

TAGS = ["bluff", "random", "3p", "4p", "5p", "6p", "7p", "8p", "9p", "10p"]

_ANTIDOTE_LIST = ('antidote', 'anti', 'a')
_POISON_LIST = ('poison', 'pois', 'poi', 'p')

class Poison(SeatedGame):
    """An implementation of 'Skull' by <NAME>, without any of the
    gorgeous artwork, sadly.
    """

    def __init__(self, server, table_name):

        super(Poison, self).__init__(server, table_name)

        self.game_display_name = "Poison"
        self.game_name = "poison"
        self.seats = [
            Seat("Alpha"),
            Seat("Bravo"),
            Seat("Charlie"),
            Seat("Delta"),
            Seat("Echo"),
            Seat("Foxtrot"),
            Seat("Golf"),
            Seat("Hotel"),
            Seat("India"),
            Seat("Juliet")
        ]
        self.state = State("need_players")
        self.prefix = "(^RPoison^~) "
        self.log_prefix = "%s/%s: " % (self.table_display_name, self.game_display_name)
        self.min_players = 3
        self.max_players = 10

        # Default configuration.
        self.antidote_count = 3
        self.poison_count = 1
        self.goal = 2

        # Mutable information.
        self.turn = None
        self.highest_bidder = None

    def get_color_code(self, seat):
        color_index = self.seats.index(seat) % 4

        if color_index == 0:
            return "^R"
        elif color_index == 1:
            return "^Y"
        elif color_index == 2:
            return "^M"
        else:
            return "^C"

    def get_sp_str(self, seat):
        return "^G%s^~ (%s%s^~)" % (seat.player_name, self.get_color_code(seat), seat)

    def next_seat(self, seat, bidding=False):

        # Skip players that are dead and, if bidding, have passed.
        player_count = len(self.seats)
        index = self.seats.index(seat) % player_count
        done = False
        while not done:
            index = (index + 1) % player_count
            this_seat = self.seats[index]
            if not this_seat.data.is_dead:
{'fraction_non_alphanumeric': 0.11223656265316125, 'fraction_numerical': 0.01029243587649077, 'mean_word_length': 2.478409090909091, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4525899', 'n_tokens_mistral': 2038, 'n_tokens_neox': 1905, 'n_words': 584}