Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- HashMap<String,HashMap<String,Integer>> rules = new HashMap<String,HashMap<String,Integer>>(){{
- put("scissors",new HashMap<String,Integer>(){{
- put("scissors",DRAW);
- put("rock",SECOND_WON);
- put("paper",FIRST_WON);
- }});
- put("rock",new HashMap<String,Integer>(){{
- put("scissors",FIRST_WON);
- put("rock",DRAW);
- put("paper",SECOND_WON);
- }});
- put("paper",new HashMap<String,Integer>(){{
- put("scissors",SECOND_WON);
- put("rock",FIRST_WON);
- put("paper",DRAW);
- }});
- }};
- try {
- int result = rules.get(firstPlayerAction).get(secondPlayerAction);
- webSocketService.notifyGameOver(firstPlayer, secondPlayer, result);
- } catch (Exception e) {
- LogFactory.getInstance().getGameLogger().error("GameMechanics.GameSession/gameActionReveal: Wrong game_action from json! ",e);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement