def razplet(): dealer = model.spremeni_format_handa(game.roka.dealer_cards, game.roka.dealer_suits) player = model.spremeni_format_handa(game.roka.player_cards, game.roka.player_suits) if game.player_blackjack() and (game.roka.dealer_count != 21 or len(game.roka.dealer_cards) > 2): game.balance += 1.5 * game.roka.wager game.roka.wager = 0 return bottle.template('blackjack.tpl', player=player, dealer=dealer, stanje=game.balance) elif game.player_won(): game.balance += game.roka.wager game.roka.wager = 0 return bottle.template('player_won.tpl', player=player, dealer=dealer, stanje=game.balance) elif game.dealer_won(): game.balance -= game.roka.wager game.roka.wager = 0 return bottle.template('dealer_won.tpl', player=player, dealer=dealer, stanje=game.balance) else: return bottle.template('tie.tpl', player=player, dealer=dealer, stanje=game.balance)
def dealer_turn(): game.roka.dealer_hit() game.roka.update_counts() dealer = model.spremeni_format_handa(game.roka.dealer_cards, game.roka.dealer_suits) player = model.spremeni_format_handa(game.roka.player_cards, game.roka.player_suits) if game.roka.dealer_count >= 17: bottle.redirect('/razplet/') else: return bottle.template('dealer_turn.tpl', player=player, dealer=dealer, karte=game.roka)
def hand(): wager = bottle.request.forms['wager'] if not model.veljaven_odgovor(wager, game): return bottle.template('wager_1.tpl') game.roka.wager = float(wager) dealer = model.spremeni_format_handa(game.roka.dealer_cards, game.roka.dealer_suits) player = model.spremeni_format_handa(game.roka.player_cards, game.roka.player_suits) if game.roka.player_count == 21: bottle.redirect('/razplet/') if model.can_double(game): return bottle.template('hand_double.tpl', player=player, dealer=dealer, karte=game.roka) else: return bottle.template('hand.tpl', player=player, dealer=dealer, karte=game.roka)