Problem 3043. Fillapix  Solver (basic)
Fillapix is a logic puzzle game similar to PicaPix (aka Logic art) and Minesweeper. An example starting board is shown below on the left with the completed board shown to its right. Each number in the board indicates how many surrounding cells, including itself, are to be filled in. There are (up to) nine total cells associated with each number: four immediately adjacent (up, down, left, and right), four diagonally adjacent (one touching each corner), and the central cell (where the number is located).
Based on this logic, all 0's and 9's are determinant, as all nine cells are either empty or filled, respectively, for these numbers. Also, all 6's on the board edges and 4's in the corners should be completely filled in, as they only involve 6 or 4 cells, respectively.
This problem deals with basiclogic Fillapix problems; a sample stepbystep solution is found here. These problems are basic in that each clue can be solved independent of all other clues, though some looping or iteration over the board will be required to solve all the clues. Basic logic can be summarized in the following two cases, regarding the cells associated with each clue: (1) if the sum of filledin cells equals the clue, all other associated cells should be marked as empty, and (2) if the sum of empty cells equals the total number of associated cells minus the clue, all other associated cells should be marked as filled in.
For this problem, you will be presented with a board full of clues. Write a function to solve the Fillapix puzzle based on those clues, returning a solution of the same size as the board filled with 1's (filled) and 0's (empty).
A related problem is Fillapix  Solution Checker.
Solution Stats
Problem Comments

9 Comments
Nan or 1 (test 5) for non clue cells ?
Thanks for the catch. I've updated that test case.
Now, the biggie. Implement a solver for advanced FAP. I never managed to create one that worked on all problems.
I was working on it last night, but it's tabled for now. I can't quite figure out how to solve the advanced logic portion that propagates along adjacent clues (including diagonal) to solve cells outside of that clue's reach.
Good problem but too difficult for a first contact. Maybe a first basic problem with small boards and/or clear cues (0/9). And after only, a more difficult one.
If anyone is interested more in these games, I've made quite a few of them on Sporcle.com. for the first of four Fillapix (aka, mosaic logic puzzle) playlists.
I wouldn't call this problem basic since it is very similar to solving a nonogram, which is nphard, but it is possible to solve this problem in this current instance with logical thinking only. With more complex boards of this game, it is not enough because it would have more than one possible solution or no solution.
@Rafael S.T. Vieira: while you are correct (along with JeanMarie) in stating that the problem is not easy, the "basic" indicates, as you rightly mention, that simple logic applied to surrounding cells is all that is needed to solve this sort of puzzle. Of course, there are more complex boards wherein the "basic" logic is insufficient to completely solve them.
It appears that the link I supplied earlier was lost. Here it is again:
https://www.sporcle.com/playlists/goc3/mosaiclogicpuzzles
Solution Comments
Show commentsProblem Recent Solvers9
Suggested Problems

147 Solvers

Create a function handle that reverses the input arguments of another function handle
144 Solvers

96 Solvers

57 Solvers

7589 Solvers
More from this Author139
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!