Solvable Nonograms

Manipulate[
DynamicModule[{n=5,rowq,ccq,cc1q,colq,desnoq,spodajq, cc, row, col, desno,spodaj, cc1},
Dynamic@({i1,j1}=Floor[(pt+{1,1})]);
i=n+1-j1;
j=i1;
(* problem *)
gob=Join[invaders[[invader]],RotateLeft[Drop[#,-1],1] &/@ invaders[[invader]],2];
ccq=Map[Split,gob];
cc1q=Map[Split,Transpose[gob]];rowq=Map[Length,Table[Select[ccq[[i]],MemberQ[#,1]&],{i,1,Length[ccq]}],{2}];colq=Map[Length,Table[Select[cc1q[[i]],MemberQ[#,1]&],{i,1,Length[cc1q]}],{2}];desnoq=Map[stringfromlist,rowq];
spodajq=Map[Column,colq];

(* end problem *)
cc=Map[Split,ar];
cc1=Map[Split,Transpose[ar]];row=Map[Length,Table[Select[cc[[i]],MemberQ[#,1]&],{i,1,Length[cc]}],{2}];col=Map[Length,Table[Select[cc1[[i]],MemberQ[#,1]&],{i,1,Length[cc1]}],{2}];desno=Map[stringfromlist,row];
spodaj=Map[Column,col];EventHandler[ClickPane[Dynamic@({i1,j1}=Floor[(pt+{1,1})]);i=4-j1;j=i1;Dynamic@(Dynamic@({i1,j1}=Floor[(pt+{1,1})]);i=4-j1;j=i1;Show[ArrayPlot[ar,Mesh->True,Axes->None,ColorRules->{1->GrayLevel[0.8]},MeshStyle->{GrayLevel[0.3]}],Graphics[{Table[Text[Style[desnoq[[i]],If[row[[i]]==rowq[[i]],Red,Black],20],{n+0.3,n+0.5-i},{-1,0}],{i,1,n}],Table[Text[Style[spodajq[[i]],If[col[[i]]==colq[[i]],Red,Black],20],{i-0.5,-0.1},{0,1}],{i,1,n}]}],PlotRange->{{-0.5,3n/2+1},{-n/2-1,n+0.5}}]),(pt=#)&],{"MouseClicked":>(If[pt[[1]]<0||pt[[2]]<0||pt[[1]]>n||pt[[2]]>n,,With[{i=n+1-Floor[(pt+{1,1})][[2]],j=Floor[(pt+{1,1})][[1]]},ar[[i,j]]=(ar[[i,j]]/.{0->1,1->0})]])}]],

{{invader,26579,"choose problem"},1,Length[invaders],1,Appearance->"Labeled"},
{gob,{Table[0,{5},{5}]},ControlType->None},
Control[{ar,{Table[0,{5},{5}]},ControlType->None}],
{pt,{{0,0}},ControlType->None},
Button["clear",ar=Table[0,{5},{5}]],
Button["show solution",ar=gob],
SynchronousInitialization-> False,
SynchronousUpdating-> False,
Initialization:>{
invaders = Tuples[Range[2]-1,{5,3}];stringfromlist[list_]:=Module[{len=Length[list],str=""},If[len==0,"",Do[str=StringJoin[str,ToString[list[[i]]],", "],{i,1,len-1}];str=StringJoin[str,ToString[list[[len]]]]]];}]

Each square in the grid must be filled in with gray or left as white. The numbers to the right of the rows or under the columns are the lengths of the runs of gray squares in that row or column. (For example, 1, 2 means there is one gray square followed by a series of two separated by one or more white squares; the number of white squares before, between, or after is not given.) The numbers are red if they satisfy the condition for that row or column.

The aim is to find all the gray squares. Click a square to change its color.

Reference

[1] Wikipedia. "Nonogram." (Aug 15, 2013) en.wikipedia.org/wiki/Nonogram.

Contributed by: Izidor Hafner