Examples of Game


Examples of org.cspoker.server.embedded.gamecontrol.Game

    try {
      gameControl.deal();
    } catch (IllegalActionException e1) {
      fail(e1.toString());
    }
    Game game = gameControl.getGame();

    // New Deal
    assertEquals(guy, game.getDealer());
    assertEquals(PreFlopRound.class, gameControl.getRound().getClass());

    try {
      System.out.println(game.getCurrentPlayer());
      gameControl.call(game.getCurrentPlayer());
      assertEquals(PreFlopRound.class, gameControl.getRound().getClass());
      gameControl.raise(game.getCurrentPlayer(), 10);
      assertEquals(PreFlopRound.class, gameControl.getRound().getClass());
      gameControl.call(game.getCurrentPlayer());
      assertEquals(PreFlopRound.class, gameControl.getRound().getClass());
      gameControl.raise(game.getCurrentPlayer(), 20);
      assertEquals(PreFlopRound.class, gameControl.getRound().getClass());
      gameControl.call(game.getCurrentPlayer());
      assertEquals(PreFlopRound.class, gameControl.getRound().getClass());
      gameControl.call(game.getCurrentPlayer());
    } catch (IllegalActionException e) {
      fail(e.getMessage());
    }


    // Flop Round
    assertEquals(FlopRound.class, gameControl.getRound().getClass());
    try {
      gameControl.check(game.getCurrentPlayer());
      gameControl.check(game.getCurrentPlayer());
      gameControl.check(game.getCurrentPlayer());
    } catch (IllegalActionException e) {
      fail(e.getMessage());
    }

    // Turn Round
    assertEquals(TurnRound.class, gameControl.getRound().getClass());
    try {
      gameControl.check(game.getCurrentPlayer());
      gameControl.check(game.getCurrentPlayer());
      gameControl.check(game.getCurrentPlayer());
    } catch (IllegalActionException e) {
      fail(e.getMessage());
    }

    // Final Round
    assertEquals(FinalRound.class, gameControl.getRound().getClass());
    try {
      gameControl.check(game.getCurrentPlayer());
      gameControl.check(game.getCurrentPlayer());
      gameControl.check(game.getCurrentPlayer());
    } catch (IllegalActionException e) {
      fail(e.getMessage());
    }

    // New Deal
View Full Code Here

Examples of org.cspoker.server.embedded.gamecontrol.Game

    try {
      gameControl.deal();
    } catch (IllegalActionException e1) {
      fail(e1.toString());
    }
    Game game = gameControl.getGame();

    try {
      gameControl.call(game.getCurrentPlayer());
      gameControl.call(game.getCurrentPlayer());
      gameControl.check(game.getCurrentPlayer());
    } catch (IllegalActionException e) {
      fail(e.getMessage());
    }

    // Flop Round
    try {
      gameControl.bet(game.getCurrentPlayer(),8);
      gameControl.raise(game.getCurrentPlayer(), 10);
      gameControl.call(game.getCurrentPlayer());
    } catch (IllegalActionException e) {
      fail(e.getMessage());
    }

    // Turn Round
    try {
      gameControl.check(game.getCurrentPlayer());
      gameControl.check(game.getCurrentPlayer());
    } catch (IllegalActionException e) {
      fail(e.getMessage());
    }

    // Final Round
    try {
      System.out.println("final round");
      gameControl.check(game.getCurrentPlayer());
      System.out.println("Check 1");
      gameControl.check(game.getCurrentPlayer());
      System.out.println("check 2");
    } catch (IllegalActionException e) {
      fail(e.getMessage());
    }

    GameFlowTest.logger.info("Next game...");

    GameFlowTest.logger.info("Current Player:" + game.getCurrentPlayer());
    GameFlowTest.logger.info("Next Dealer:" + game.getNextDealer());
    GameFlowTest.logger.info(game.getFirstToActPlayer());
    GameFlowTest.logger.info("Dealer: " + game.getDealer().getName());
    GameFlowTest.logger.info(game.getCurrentDealPlayers());
  }
View Full Code Here

Examples of org.ggp.base.util.game.Game

  // a randomly-played match, to demonstrate that visualization works.
  public static void main(String args[]) {
        JFrame frame = new JFrame("Visualization Test");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

        Game theGame = GameRepository.getDefaultRepository().getGame("nineBoardTicTacToe");
        VisualizationPanel theVisual = new VisualizationPanel(theGame);
        frame.setPreferredSize(new Dimension(1200, 900));
        frame.getContentPane().add(theVisual);
        frame.pack();
        frame.setVisible(true);

        StateMachine theMachine = new CachedStateMachine(new ProverStateMachine());
        theMachine.initialize(theGame.getRules());
        try {
            MachineState theCurrentState = theMachine.getInitialState();
            do {
                theVisual.observe(new ServerNewGameStateEvent(theCurrentState));
                theCurrentState = theMachine.getRandomNextState(theCurrentState);
View Full Code Here

Examples of org.jboss.seam.example.numberguess.Game

      String id = new NonFacesRequest("/numberGuess.jsp")
      {

         @Override
         protected void renderResponse() throws Exception {
            Game game = (Game) getInstance(Game.class);
            Guess guess = (Guess) getInstance(Guess.class);
            assert game.getBiggest()==100;
            assert game.getSmallest()==1;
            assert guess.getValue()==null;
            assert game.getGuessCount()==0;
            assert Manager.instance().isLongRunningConversation();
            assert Pageflow.instance().getProcessInstance().getRootToken()
            .getNode().getName().equals("displayGuess");
         }
        
      }.run();

      String id2 = new FacesRequest("/numberGuess.jsp", id)
      {

         @Override
         protected void applyRequestValues() throws Exception {
            Guess guess = (Guess) getInstance(Guess.class);
            guessedValue = getRandomNumber() > 50 ? 25 : 75;
            guess.setValue(guessedValue);
         }

         @Override
         protected void invokeApplication() throws Exception {
            setOutcome("guess");
            //ng.guess();
         }
        
         @Override
         protected void afterRequest() {
            assert !isRenderResponseBegun();
            assert getViewId().equals("/numberGuess.jsp");
         }
        
      }.run();
     
      assert id2.equals(id);
     
      new NonFacesRequest("/numberGuess.jsp", id)
      {
        
         @Override
         protected void renderResponse() throws Exception {
            Game game = (Game) getInstance(Game.class);
            Guess guess = (Guess) getInstance(Guess.class);
            assert ( guessedValue > getRandomNumber() && game.getBiggest()==guessedValue-1 )
                  || ( guessedValue < getRandomNumber() && game.getSmallest()==guessedValue+1 );
            assert guess.getValue().equals(guessedValue);
            assert game.getGuessCount()==1;
            assert Manager.instance().isLongRunningConversation();
            assert Pageflow.instance().getProcessInstance().getRootToken()
                  .getNode().getName().equals("displayGuess");
         }
        
      }.run();

      id2 = new FacesRequest("/numberGuess.jsp", id)
      {

         @Override
         protected void applyRequestValues() throws Exception {
            Guess guess = (Guess) getInstance(Guess.class);
            guessedValue = getRandomNumber();
            guess.setValue(guessedValue);
         }

         @Override
         protected void invokeApplication() throws Exception {
             Guess guess = (Guess) getInstance(Guess.class);
            setOutcome("guess");
            assert guess.getValue().equals(getRandomNumber());
            assert Pageflow.instance().getProcessInstance().getRootToken()
            .getNode().getName().equals("displayGuess");
            //ng.guess();
         }
        
         @Override
         protected void afterRequest()
         {
            assert !isRenderResponseBegun();
            assert getViewId().equals("/win.jsp");
         }
        
      }.run();
     
      assert id2.equals(id);
     
      new NonFacesRequest("/win.jsp", id)
      {
         @Override
         protected void renderResponse() throws Exception {
            Game game = (Game) getInstance(Game.class);
            Guess guess = (Guess) getInstance(Guess.class);
            assert guess.getValue().equals(getRandomNumber());
            assert game.getGuessCount()==2;
            assert !Manager.instance().isLongRunningConversation();
            assert Pageflow.instance().getProcessInstance().getRootToken()
                  .getNode().getName().equals("win");
         }
        
View Full Code Here

Examples of org.jpacman.framework.model.Game

   *
   * @throws FactoryException If parsing fails. Should not happen.
   */
  @Test
  public void testFullMap() throws FactoryException {
    Game g = parser.parseMap(map);
    Board b = g.getBoard();

    // did we recognize the right sprites?
    assertEquals(SpriteType.EMPTY, b.spriteTypeAt(1, 3));
    assertEquals(SpriteType.PLAYER, b.spriteTypeAt(2, 2));
    assertEquals(SpriteType.GHOST, b.spriteTypeAt(1, 2));
    assertEquals(SpriteType.WALL, b.spriteTypeAt(0, 0));
    assertEquals(SpriteType.FOOD, b.spriteTypeAt(1, 1));

    // did we properly set the player?
    assertEquals(g.getPlayer(), b.spriteAt(2, 2));

    // were all ghosts added?
    assertEquals(2, g.getGhosts().size());

    // was the food actually added?
    final int cellsWithFoodCount = 3;
    assertEquals(cellsWithFoodCount * Food.DEFAULT_POINTS,
           g.getPointManager().totalFoodInGame());
  }
View Full Code Here

Examples of org.mcsg.survivalgames.Game

    }

    public void saveGame(int arenaid, Player winner,int players, long time ){
        if(!enabled)return;
        int gameno = 0;
        Game g = GameManager.getInstance().getGame(arenaid);

        try {
            long time1 = new Date().getTime();
            PreparedStatement s2 = dbman.createStatement("SELECT * FROM "+SettingsManager.getSqlPrefix() +
                    "gamestats ORDER BY gameno DESC LIMIT 1");
            ResultSet rs = s2.executeQuery();
            rs.next();
            gameno = rs.getInt(1) + 1;

            if(time1 + 5000 < new Date().getTime())System.out.println("Your database took a long time to respond. Check the connection between the server and database");
        } catch (SQLException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
            g.setRBStatus("Error: getno");
        }

        addSQL("INSERT INTO "+SettingsManager.getSqlPrefix()+"gamestats VALUES(NULL,"+arenaid+","+players+",'"+winner.getName()+"',"+time+")");

        for(PlayerStatsSession s:arenas.get(arenaid).values()){
View Full Code Here

Examples of org.menacheri.jetserver.app.Game

  }

  @Test
  public void sessionDisconnectValidation() throws InterruptedException {
    // create necessary setup objects.
    Game game = new SimpleGame(1, "Test");
    Protocol dummyProtocol = new DummyProtocol();
    GameRoomSessionBuilder sessionBuilder = new GameRoomSessionBuilder();
    sessionBuilder.parentGame(game).gameRoomName("Zombie_ROOM_1")
        .protocol(dummyProtocol);
    CountDownLatch latch = new CountDownLatch(1);
View Full Code Here

Examples of org.newdawn.slick.Game

        for (JugadorDetalle jug : impl.getJugadores()) {
            model.addElement(jug);
        }
        jList1.setModel(model);
        jList1.setSelectedIndex(0);
        game = new Game() {

            org.newdawn.slick.Image pasto = null;

            @Override
            public void init(GameContainer gc) throws SlickException {
View Full Code Here

Examples of org.scotlandyard.engine.Game

*/
public final class GameImpl extends SetOperations implements Game {

  public static Game getNewInstance(final String identifier,
      final User creator, final BoardMap boardMap) throws GameException {
    final Game game = new GameImpl(identifier, creator, boardMap);

    if (creator!=null && GameEngine.instance().getUser(creator.getEmail()) == null) {
      throw new GameException(
          "the user can not create a game before login is made");
    }
View Full Code Here

Examples of org.scotlandyard.engine.Game

    final MockParametersMap map = new MockParametersMap();
   
    BoardMap boardMap = BoardMapImpl.getNewInstance("pnth");
    boardMap.prepareMap("web/maps/pnth.xml");
    User user = UserImpl.getNewInstance("Hussain", "hussain@game.com");
    Game game = GameImpl.getNewInstance("new game", user,boardMap);
   
    Detective detective = new Detective(user);
    game.addDetective(detective);
   
    game.setPlayerPosition(detective.getEmail(), boardMap.getCoordinates().iterator().next().getLabel());
   
    GamePlayersJsonContainer container = new GamePlayersJsonContainer(game);
   
    assertNull(
        "mr x has not been initialized",
        container.mrx
        );
   
    assertNotNull(
      "check if the container has been initialized correctly",
      container.detectives
      );
   
    assertEquals(
        "testing if the container contains one detective",
        1,
        container.detectives.size()
      );
   
    //System.out.println(container.toJson());
   
    map.put("gameId", game.getIdentifier());
   
    final String json = (String)new GamePlayers().processRequest(map, engine);
    final GamePlayersJsonContainer gpjc = new GamePlayersJsonContainer().fromJson(json);
    assertEquals(gpjc.detectives.size(),1);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.