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)
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)
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)
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)
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)