Package org.ggp.base.util.statemachine

Examples of org.ggp.base.util.statemachine.StateMachine.initialize()


        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


        description = GdlCleaner.run(description);

        StaticValidator.validateDescription(description);

        StateMachine sm = new ProverStateMachine();
        sm.initialize(description);
        MachineState state = sm.getInitialState();
        assertEquals(1, sm.getRoles().size());
        Role player = sm.getRoles().get(0);
        assertEquals(1, sm.getLegalMoves(state, player).size());
        state = sm.getNextStates(state).get(0);
View Full Code Here

  @Override
  public List<ValidatorWarning> checkValidity(Game theGame) throws ValidatorException {
    try {
      StateMachine sm = new ProverStateMachine();
      sm.initialize(theGame.getRules());

      AimaProver prover = new AimaProver(theGame.getRules());
      GdlSentence basesQuery = GdlPool.getRelation(BASE, new GdlTerm[] {X});
      Set<GdlSentence> bases = prover.askAll(basesQuery, Collections.<GdlSentence>emptySet());
      GdlSentence inputsQuery = GdlPool.getRelation(INPUT, new GdlTerm[] {X, Y});
View Full Code Here

  @Override
  public List<ValidatorWarning> checkValidity(Game theGame) throws ValidatorException {
    for (int i = 0; i < numSimulations; i++) {
      StateMachine stateMachine = new ProverStateMachine();
      stateMachine.initialize(theGame.getRules());

      MachineState state = stateMachine.getInitialState();
      for (int depth = 0; !stateMachine.isTerminal(state); depth++) {
        if (depth == maxDepth) {
          throw new ValidatorException("Hit max depth while simulating: " + maxDepth);
View Full Code Here

            runButton.setEnabled(false);
            if (theGame == null)
                return;

            StateMachine stateMachine = new ProverStateMachine();
            stateMachine.initialize(theGame.getRules());
            List<Role> roles = stateMachine.getRoles();

            int newRowCount = 11;
            for (int i = 0; i < roles.size(); i++) {
                roleLabels.add(new JLabel(roles.get(i).getName().toString() + ":"));
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.