@Override public Move getNextMove(PlayerInfo mappings, IBoard board) { Move move = Move.STAY; Unicorn me = board.getCurrentUnicorn(); switch (state) { case SEARCH: move = searchNextCloud(me, board); if (move == Move.STAY) { state = State.SPAWN; } break; case SPAWN: move = Move.SPAWN; state = State.RUN; break; case RUN: move = searchSafeSpot(me, board); if (move == Move.STAY) { state = State.SEARCH; } break; } return move; }
@Override public boolean test(Node node) { V pos = (V) node.getState(); for (GameObject go : board.at(pos)) { if (go instanceof Fountain) { if (((Fountain) go).lastVisitedBy != me.id) return true; } } return false; }
@Override public boolean test(Node currentNode) { V currentUnicornPos = (V) currentNode.getState(); for (V d : Board.getDirections()) { for (GameObject obj : board.at(V.add(currentUnicornPos, d))) { if (obj instanceof Cloud) { return true; } } } return false; }
@Override public boolean test(Node node) { V pos = (V) node.getState(); // for all seeds for (Seed s : board.getSeeds()) { // are we on the same (axis parallel) line ? if (V.sameLine(pos, s.pos)) { // are we far enough from it ? if (V.manhattan(pos, s.pos) < s.range) { return false; } } } return true; }