Black Box
Background
This logic puzzle is a variation of the board game of the same name, invented by Eric Solomon.
Puzzle and Goal
An unsolved puzzle consists of a rectangular (typically square) grid with some clues along the edges. These clues represent the behavior of light beams entering the grid.
The goal is to fill in some of the cells to satisfy the clues. The number of cells to be filled in will be provided with the puzzle.
Rules
The solved grid must satisfy the following conditions:
If a light beam heads directly into a filled-in cell, it is absorbed (with the clue "A").
A light beam cannot go through a cell that orthogonally neighbors a filled-in cell; it must turn right in the preceding cell.
Numbered clues are paired, such that a light beam entering at one number will exit at the matching number.
A clue of "R" means that the light beam has returned to the original cell.
Playable Online