grid, given as a list of strings:
- '.' is an empty cell;
- '#' is a wall that nobody can stand on;
- 'M' is the mouse, 'C' the cat and 'F' the cheese. Each of these appears exactly once, and their cells are walkable too.
The mouse and the cat take turns, the mouse first. A move is a jump in one of the four directions (up, down, left, right) of at most mouse_jump cells for the mouse and cat_jump cells for the cat. A shorter jump is fine, and so is staying put. Nobody may leave the board or jump over a wall, but the mouse may jump over the cat.
The game ends when:
- the cat lands on the mouse's cell: the cat wins;
- the cat reaches the cheese first: the cat wins;
- the mouse reaches the cheese first: the mouse wins;
- the mouse has not reached the cheese within 1000 moves: the cat wins.
Both play optimally. Return True if the mouse wins, otherwise False.grid=['M..C', '...F'], cat_jump=1, mouse_jump=1 → False
The cat is right above the cheese and needs one move to reach it, while the mouse needs at least four.
grid=['M.#C', '...#', 'F...'], cat_jump=2, mouse_jump=2 → True
The cat is walled into its corner, and the mouse lands on the cheese with its very first two-cell jump down.
grid=['F.M.C'], cat_jump=3, mouse_jump=2 → True
grid[i][j] is one of 'C', 'M', 'F', '.', '#''C', 'M' and 'F' each appear exactly oncegrid=['M..C', '...F'], cat_jump=1, mouse_jump=1
False
Run checks the first 3 tests in your browser. Submit checks all 46 tests on the server, hidden ones included.