def playCard(json): # Should allow for safe spectating if dataModel.prevCardWasNone and json["cardPlayed"] is None: return if json["cardPlayed"]: trackWhoWinningTrick(json) if json["cardPlayed"] is not None: dataModel.trackCardPlayed(json["cardPlayed"], json["playerPosition"]) dataModel.prevCardWasNone = False else: dataModel.prevCardWasNone = True updateTrickInfo() dataModel.dicts["trickInfo"]["cardsPlayed"] = dataModel.cardsPlayed json["dicts"] = dataModel.dicts if dataModel.cardsPlayed > 5: json["lastCard"] = 1 dataModel.setCurrentPlayer(json["nextPlayer"]) socketio.emit('place card', json) if dataModel.cardsPlayed > 5: handleEndOfTrick() else: tryBotPlaying(dataModel.getCurrentPlayer())
def submitHorseDropPass(json): if "done" in json: dataModel.updateHandAfterHorseDrop(json["myCardsHorse"]) else: dataModel.updateHandAfterHorsePass(json["singlePassedCard"]) if "done" in json: json["dropper"] = 2 json["passedCards"] = [] else: json["dropper"] = 4 dataModel.passedCards = json["passedCards"] if len(json["passedCards"]) == 2: dataModel.currentStage = "playCards" dataModel.setCurrentPlayer(dataModel.dicts["highBid"]["playerInd"]) socketio.emit('done bidding', json) tryBotPlaying(dataModel.getCurrentPlayer()) else: dataModel.currentStage = "passHorse" dataModel.setCurrentPlayer(json["dropper"]) socketio.emit('pass horse', json) tryBotPassHorse(dataModel.getCurrentPlayer(), dataModel.dicts["highBid"]["playerInd"], json["passedCards"])
def submitBid(json): determineHighBid(json) dataModel.setBid(json) if json['nextBidder'] == dataModel.dicts["handInfo"][ "dealer"] or dataModel.dicts["highBid"]["high"] == "10": dataModel.setInitialHandInfo() json = {"dicts": dataModel.dicts} dataModel.setCurrentPlayer(dataModel.dicts["highBid"]["playerInd"]) dataModel.startHandBot() if int(dataModel.dicts["highBid"]["high"]) == 9: dataModel.currentStage = "dropHorse" socketio.emit('horse drop', json) tryBotHorseDrop(dataModel.getCurrentPlayer()) return dataModel.currentStage = "playCards" socketio.emit('done bidding', json) tryBotPlaying(dataModel.getCurrentPlayer()) else: json["dicts"] = dataModel.dicts dataModel.setCurrentPlayer(json["nextBidder"]) socketio.emit('bid placed', json) tryBotBidding(dataModel.getCurrentPlayer())