def get(self): ''' get You got your basic get method right here, but with a twist. This method perfoms the intialization of the game state, creating the json objects that represent the game and json encoding them. It then renders them on the game template with jinja. ''' # get the player avatar image from the datastore self.sessionId = self.request.get("sessionId") # use the gameModel to interact with the datastore newModel = DatastoreInteraction(self.sessionId) avatar = newModel.getAvatar() # set the right picture if(avatar == "character1"): self.thumbnailImage = "bettyThumb.png" elif(avatar == "character2"): self.thumbnailImage = "jasonThumb.png" elif(avatar == "character3"): self.thumbnailImage = "batRatThumb.png" elif(avatar == "character4"): self.thumbnailImage = "catLadyThumb.png" elif(avatar == "character5"): self.thumbnailImage = "lebowsCatThumb.png" else: self.thumbnailImage = "tommyCatThumb.png" # perform initial creation and encoding of JSON object newState = self.initEncode() # update the opcards and aicards in the hal object in the datastore halState = json.loads(newState) newModel = DatastoreInteraction(self.sessionId) newModel.updateAiCards(str(halState['playCard']), aiCards=str(halState['compCard'])) self.render("game.html", oldState='null', newState=newState, thumbnailImage=self.thumbnailImage)