Examples of GameState


Examples of aima.core.search.adversarial.GameState

    return (TicTacToeBoard) state.get("board");
  }

  @Override
  public List<GameState> getSuccessorStates(GameState state) {
    GameState temp = presentState;
    List<GameState> retVal = new ArrayList<GameState>();
    int parentLevel = getLevel(state);
    for (int i = 0; i < getMoves(state).size(); i++) {
      XYLocation loc = (XYLocation) getMoves(state).get(i);

      GameState aState = makeMove(state, loc);
      aState.put("moveMade", loc);
      aState.put("level", new Integer(parentLevel + 1));
      retVal.add(aState);

    }
    presentState = temp;
    return retVal;
View Full Code Here

Examples of beans.GameState

        return playerNode;
    }

    public static ObjectNode getGameStateJson(Integer gameId) {
        try {
            GameState gs = (new GameManager()).getGameState(gameId);
            if (gs == null) {
                return null;
            }
            GameStateJSONFormatter gsj = new GameStateJSONFormatter(gs);
            return gsj.getJSON();
View Full Code Here

Examples of com.epicsagaonline.bukkit.ChallengeMaps.objects.GameState

    String worldName = mapName + "_" + player.getName();
    DeleteWorld(mapName, worldName);
    CopyWorld(mapName, worldName, true);
   
    GameState gs = GameStateData.Load(Current.Maps.get(mapName), player, true);
    gs.PendingRemoval = true;

  }
View Full Code Here

Examples of com.epicsagaonline.bukkit.ChallengeMaps.objects.GameState

  {
    if (Current.GameStates.size() > 0)
    {
      for (String key : Current.GameStates.keySet())
      {
        GameState gs = Current.GameStates.get(key);
        for (String objKey : gs.getMap().getObjectives().keySet())
        {
          Objective obj = gs.getMap().getObjectives().get(objKey);
          Trigger trg = obj.getTrigger();
          switch (trg.getType())
          {
            case BLOCK_BREAK:
              ProcessBlockBreak(gs, obj);
              break;
            case BLOCK_PLACE:
              ProcessBlockPlace(gs, obj);
              break;
            case BLOCK_PLACE_DISTANCE:
              ProcessBlockPlaceDistance(gs, obj);
              break;
            case CRAFT:
              ProcessItemCraft(gs, obj);
              break;
            case MAP_COUNT:
              ProcessMapCount(gs, obj);
              break;
          }
        }
        for (String loc : Current.MapEntrances.keySet())
        {
          MapEntrance me = Current.MapEntrances.get(loc);
          if (me.getMap().getMapName().equals(gs.getMap().getMapName()))
          {
            me.getHighScores().put(gs.getPlayer().getName(), gs.getScore());
          }
        }

        if (gs.PendingRemoval)
        {
          Current.GameWorlds.remove(gs.getWorld().getName());
          Current.Plugin.getServer().unloadWorld(gs.getWorld().getName(), true);
          KeysToRemove.add(key);
        }
      }
      GameStateData.saveData();
      MapEntranceData.SaveMapEntrances();
View Full Code Here

Examples of com.epicsagaonline.bukkit.ChallengeMaps.objects.GameState

    {
      savingData = true;
      // Log.Write("Saving Gamestates.");
      for (String key : Current.GameStates.keySet())
      {
        GameState gs = Current.GameStates.get(key);
        Init();
        File file = new File(Current.Plugin.getDataFolder() + File.separator + DATA_PATH + File.separator + gs.getKey() + ".yml");
        if (!file.exists())
        {
          try
          {
            file.createNewFile();
View Full Code Here

Examples of com.epicsagaonline.bukkit.ChallengeMaps.objects.GameState

  @SuppressWarnings("unchecked") public static GameState Load(Map map, Player player, boolean forceNew)
  {
    Init();
    String fileName = map.getMapName() + "_" + player.getName() + ".yml";
    File file = new File(Current.Plugin.getDataFolder() + File.separator + DATA_PATH + File.separator + fileName);
    GameState gs = null;
    if (file.exists() && !forceNew)
    {
      Yaml yaml = new Yaml();
      HashMap<String, Object> root = new HashMap<String, Object>();
      FileInputStream stream;
      try
      {
        stream = new FileInputStream(file);
        root = (HashMap<String, Object>) yaml.load(stream);
        gs = new GameState(root, player);
        Current.GameStates.put(gs.getPlayer().getName(), gs);
      }
      catch (FileNotFoundException e)
      {
        Log.Write(e.getMessage());
      }
View Full Code Here

Examples of com.epicsagaonline.bukkit.ChallengeMaps.objects.GameState

    return gs;
  }

  private static GameState New(Map map, Player player)
  {
    GameState gs = new GameState(map, player);
    if (Current.GameStates.get(gs.getPlayer().getName()) == null)
    {
      Current.GameStates.remove(gs.getPlayer().getName());
    }
    Current.GameStates.put(gs.getPlayer().getName(), gs);
    GameStateData.saveData();
    return gs;
  }
View Full Code Here

Examples of com.epicsagaonline.bukkit.ChallengeMaps.objects.GameState

          event.getPlayer().sendMessage("You cannot remove a map entrance.");
        }
      }
      else
      {
        GameState gs = Current.getGameStateByWorld(event.getBlock().getWorld());
        if (gs != null)
        {
          if (gs.getMap().getAllowBreaking())
          {
            Block blk = event.getBlock();
            gs.addBlockBreak(blk.getTypeId());
            gs.removeMapContents(blk.getTypeId());
          }
          else
          {
            event.setCancelled(true);
          }
View Full Code Here

Examples of com.epicsagaonline.bukkit.ChallengeMaps.objects.GameState

  public @Override void onBlockPlace(BlockPlaceEvent event)
  {
    if (!event.isCancelled())
    {
      GameState gs = Current.getGameStateByWorld(event.getBlock().getWorld());
      if (gs != null)
      {
        if (gs.getMap().getAllowBuilding())
        {
          Block blk = event.getBlock();
          gs.addBlockPlace(blk.getTypeId());
          gs.addBlockPlaceDistance(blk.getTypeId(), blk.getLocation());
          gs.addMapContents(blk.getTypeId());
        }
        else
        {
          event.setCancelled(true);
        }
View Full Code Here

Examples of com.epicsagaonline.bukkit.ChallengeMaps.objects.GameState

  public @Override void onBlockBurn(BlockBurnEvent event)
  {
    if (!event.isCancelled())
    {
      GameState gs = Current.getGameStateByWorld(event.getBlock().getWorld());
      if (gs != null)
      {
        gs.removeMapContents(event.getBlock().getTypeId());
      }
    }
  }
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.