Terminator
Two players are engaged in a board game set on an 8×8 square maze. Some of the cells on the board contain walls. One player controls a terminator piece, while the other manages an escapee piece. Players alternate turns, and skipping a turn is not permitted (it is guaranteed that a move is always possible). During a turn, a player can move their piece to any adjacent free cell, whether horizontally, vertically, or diagonally, similar to a king's move in chess. Additionally, the terminator has the ability to shoot missiles at the escapee. The missile travels in a straight line in any direction—horizontally, vertically, or diagonally. If the escapee is in the terminator's line of fire and there are no walls blocking the path, the terminator will immediately shoot (regardless of whose turn it is), resulting in the escapee's loss. The initial positions of both pieces are provided. The escapee makes the first move. The escapee wins if they manage to move off the board from the eighth row, as the other edges of the board are bordered by walls.
The problem question: Can the escapee win if both players play optimally?
Input
The input file describes the game board. A free cell is marked with the digit 0, a cell with a wall is marked with the digit 1, the escapee's cell is marked with the digit 2, and the terminator's cell is marked with the digit 3.
Output
Output the number 1 if the escapee can win, and -1 otherwise.