Solve an Akari (aka Light Up) puzzle.
Akari is a Japanese puzzle game. Input is a rectangular grid, with walls and empty cells.
The objective is to place light bulbs on the grid in empty cells so that every empty cell is illuminated.
Output a solution to the puzzle.
Rules:
- A light bulb will illuminate a cell if it's in the same row or column and there's no walls in between.
- No light bulbs should be illuminated by another light bulb.
- Some walls will additionally have numbers in them, these indicate exactly how many light bulbs should share a wall with that cell.
Structure:
- First Row will have #rows #columns.
- Following that is a grid.
- For output, keep the same format as input, but for any empty cell, if a lamp should be placed there, instead output a '@'
Notation:
- "." is an empty cell.
- "#" is a wall, numbers for numbered cells (remember these also serve as walls).
Example:
Input:
7 7
2.#...1
...2...
......#
.#...#.
2......
...#...
#...3.#
Output:
2@#@..1
@..2..@
...@..#
.#@..#@
2@.....
@..#@..
#..@3@#