Beispiel #1
0
    def verify_prediction(self, hands, limit, turn, trump, predictions, row,
                          score):
        while hands == limit or not CLI.is_number(hands):
            CLI.overview(turn, trump, predictions, row, score, self._cards)
            print('You are the last, '+ self._name + ', \
                  select number, different from ', limit, ': ')
            hands = input('==> ')

        self._prediction = int(hands)
        return int(hands)
Beispiel #2
0
    def prediction_without_limit(self, turn, trump, predictions, row, score):
        CLI.overview(turn, trump, predictions, row, score, self._cards)

        print('How many hands you think you will make, ' + self._name + '?')
        hands = input('==> ')
        while not CLI.is_number(hands):
            CLI.overview(turn, trump, predictions, row, score, self._cards)
            print('Please, enter a number,' + self._name + '!')
            hands = input('==> ')
        self._prediction = int(hands)
        return int(hands)
Beispiel #3
0
    def verify_prediction(self, hands, limit, turn, trump, predictions, row,
                          score):
        while hands == limit or not CLI.is_number(hands):
            CLI.overview(turn, trump, predictions, row, score, self._cards)
            print(
                'You are the last, ' + self._name + ', \
                  select number, different from ', limit, ': ')
            hands = input('==> ')

        self._prediction = int(hands)
        return int(hands)
Beispiel #4
0
    def prediction_without_limit(self, turn, trump, predictions, row, score):
        CLI.overview(turn, trump, predictions, row, score, self._cards)

        print('How many hands you think you will make, ' + self._name + '?')
        hands = input('==> ')
        while not CLI.is_number(hands):
            CLI.overview(turn, trump, predictions, row, score, self._cards)
            print('Please, enter a number,' + self._name + '!')
            hands = input('==> ')
        self._prediction = int(hands)
        return int(hands)
Beispiel #5
0
    def start():
        CLI.clear_window()

        print()
        print('Hi, you might want to play Ohio?!')
        print()
        print('OK, how many people will play? (from 1 to 4)')
        number = input('==> ')
        while not CLI.is_number(number) or int(number) not in range(0, 5):
            CLI.clear_window()
            print()
            print('Hi, you might want to play Ohio?!')
            print()
            print('Please, enter a number from 1 to 4!')
            number = input('==> ')

        players = []
        number = int(number)
        for n in range(1, number + 1):
            CLI.clear_window()
            print()
            print('Please, enter a name for the ' + str(n) + ' player: ')
            name = input('==> ')
            players.append(RealPlayer(name))

        for n in range(1, 5 - number):
            players.append(AIPlayer('AIRobot' + str(n)))

        CLI.clear_window()
        print()
        print('Players are ready to play!')
        print()
        for player in players:
            print(player._name)

        game = Game(players)

        print()
        ok = input('Press any key to start the game...')

        game.start()
Beispiel #6
0
    def prediction_with_limit(self, turn, trump, predictions, row, score):
        all_hands = sum(
            [value for value in predictions.values() if value != None])

        if all_hands > turn:
            limit = -1
        else:
            limit = turn - all_hands

        if limit == -1:
            return self.prediction_without_limit(turn, trump, predictions, row,
                                                 score)

        CLI.overview(turn, trump, predictions, row, score, self._cards)
        hands = input('==> ')
        while not CLI.is_number(hands):
            CLI.overview(turn, trump, predictions, row, score, self._cards)
            print('Please, enter a number, ' + self._name + '!')
            hands = input('==> ')
        return self.verify_prediction(int(hands), limit, turn, trump,
                                      predictions, row, score)
Beispiel #7
0
    def prediction_with_limit(self, turn, trump, predictions, row, score):
        all_hands = sum([value for value in predictions.values()
                         if value != None])

        if all_hands > turn:
            limit = -1
        else:
            limit = turn - all_hands

        if limit == -1:
            return self.prediction_without_limit(turn, trump, predictions,
                                                 row, score)

        CLI.overview(turn, trump, predictions, row, score, self._cards)
        hands = input('==> ')
        while not CLI.is_number(hands):
            CLI.overview(turn, trump, predictions, row, score, self._cards)
            print('Please, enter a number, ' + self._name + '!')
            hands = input('==> ')
        return self.verify_prediction(int(hands), limit, turn, trump,
                                      predictions, row, score)