Package org.ggp.base.util.game

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


  /**
   * @param args
   */
  public static void main(String[] args) throws Exception {
    GameRepository gameRepo = new CloudGameRepository("http://games.ggp.org/stanford/");

    for (String gameKey : gameRepo.getGameKeys()) {
      if (!gameKey.equals("amazons") //Skip games that currently result in out-of-memory errors
          && !gameKey.equals("alexChess")) {
        try {
          new BasesInputsValidator(20000).checkValidity(gameRepo.getGame(gameKey));
          System.out.println("Game " + gameKey + " has valid base/input propositions.");
        } catch (ValidatorException ve) {
          System.out.println("Game " + gameKey + " is invalid: " + ve.getMessage());
        }
      }
View Full Code Here


  /**
   * Tries to test most of the rulesheets in the games directory. This should
   * be run when developing a new game to spot errors.
   */
  public static void main(String[] args) {
    GameRepository testGameRepo = new TestGameRepository();

    for(String gameKey : testGameRepo.getGameKeys()) {
      if (GAME_KEY_BLACKLIST.contains(gameKey)) {
        continue;
      }

      System.out.println("Testing " + gameKey);
      try {
        List<ValidatorWarning> warnings = new StaticValidator().checkValidity(testGameRepo.getGame(gameKey));
        if (!warnings.isEmpty()) {
          System.out.println("Warnings for " + gameKey + ": " + warnings);
        }
      } catch (ValidatorException e) {
        e.printStackTrace();
View Full Code Here

    public GameRepository getSelectedGameRepository() {
        return theSelectedRepository;
    }

    public void repopulateGameList() {
        GameRepository theRepository = getSelectedGameRepository();
        List<String> theKeyList = new ArrayList<String>(theRepository.getGameKeys());
        Collections.sort(theKeyList);
        theGameList.removeAllItems();
        for (String theKey : theKeyList) {
            Game theGame = theRepository.getGame(theKey);
            if (theGame == null) {
                continue;
            }
            String theName = theGame.getName();
            if (theName == null) {
View Full Code Here

      final boolean showDiffs = false;
        final ProverStateMachine theReference = new ProverStateMachine();
        final ProverStateMachine theMachine = new ProverStateMachine();

        GameRepository theRepository = GameRepository.getDefaultRepository();
        for(String gameKey : theRepository.getGameKeys()) {
            if(gameKey.contains("laikLee")) continue;
            List<Gdl> description = theRepository.getGame(gameKey).getRules();
            List<Gdl> newDescription = description;

            // Choose the transformation(s) to test here
            description = DeORer.run(description);
            newDescription = VariableConstrainer.replaceFunctionValuedVariables(description);
View Full Code Here

*/
public final class BatchValidator
{
  public static void main(String[] args)
  {
    GameRepository repo = new CloudGameRepository("games.ggp.org/base");
    for (String gameKey : repo.getGameKeys()) {
      if (gameKey.contains("amazons") || gameKey.contains("knightazons") || gameKey.contains("factoringImpossibleTurtleBrain") || gameKey.contains("quad") || gameKey.contains("blokbox") || gameKey.contains("othello"))
        continue;
      Game game = repo.getGame(gameKey);
      GameValidator[] theValidators = new GameValidator[] {
          new StaticValidator(),
          new BasesInputsValidator(3000),
          new SimulationValidator(300, 10),
          new OPNFValidator(),
View Full Code Here

  @Test
    public void testMappingScramblerConsistency() {
      GdlScrambler aScrambler = new MappingGdlScrambler(new Random(123));
      GdlScrambler bScrambler = new MappingGdlScrambler(new Random(123));
      GdlScrambler cScrambler = new MappingGdlScrambler(new Random(234));
      GameRepository repo = GameRepository.getDefaultRepository();
      for (String gameKey : repo.getGameKeys()) {
        Game game = repo.getGame(gameKey);
        StringBuilder aScrambledRules = new StringBuilder();
        StringBuilder bScrambledRules = new StringBuilder();
        StringBuilder cScrambledRules = new StringBuilder();
        StringBuilder dScrambledRules = new StringBuilder();
        StringBuilder eScrambledRules = new StringBuilder();
View Full Code Here

        assertEquals(cScrambledRules.toString(), fScrambledRules.toString());
      }
    }

    private void runScramblerTest(GdlScrambler scrambler) throws SymbolFormatException, GdlFormatException {
      GameRepository repo = GameRepository.getDefaultRepository();
      for (String gameKey : repo.getGameKeys()) {
        Game game = repo.getGame(gameKey);
        List<Gdl> theScrambledRules = new ArrayList<Gdl>();
        for(Gdl rule : game.getRules()) {
          String renderedRule = rule.toString();
          String renderedScrambledRule = scrambler.scramble(rule).toString();
          String renderedUnscrambledRule = scrambler.unscramble(renderedScrambledRule).toString();
View Full Code Here

   * on a Gdl object.
   */
  @Test
    public void testSimpleRendering() {
      GdlRenderer renderer = new GdlRenderer();
      GameRepository repo = GameRepository.getDefaultRepository();
      for (String gameKey : repo.getGameKeys()) {
        Game game = repo.getGame(gameKey);
        for(Gdl rule : game.getRules()) {
          assertEquals(rule.toString(), renderer.renderGdl(rule));
        }
      }
    }
View Full Code Here

TOP

Related Classes of org.ggp.base.util.game.GameRepository

Copyright © 2018 www.massapicom. 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.