{"group":{"id":1,"name":"Community","lockable":false,"created_at":"2012-01-18T18:02:15.000Z","updated_at":"2026-04-06T14:01:22.000Z","description":"Problems submitted by members of the MATLAB Central community.","is_default":true,"created_by":161519,"badge_id":null,"featured":false,"trending":false,"solution_count_in_trending_period":0,"trending_last_calculated":"2026-04-06T00:00:00.000Z","image_id":null,"published":true,"community_created":false,"status_id":2,"is_default_group_for_player":false,"deleted_by":null,"deleted_at":null,"restored_by":null,"restored_at":null,"description_opc":null,"description_html":null,"published_at":null},"problems":[{"id":1982,"title":"Battleship - Seaman Level","description":"\u003chttp://www.conceptispuzzles.com/index.aspx?uri=puzzle/battleships Games Magazine Battleships\u003e is a logic puzzle to find the Fleet given some map information and the number of Ship cells in every column and row. The fleet is made of a Battleship(4), two Cruisers(3), three Destroyers(2), and four Submarines(1). Thus the total filled cells is 20.\r\n\r\nThe Seaman Level is the simplest and can be solved by direct evolution of current condition.\r\n\r\nMap information contains Water(0), Subs(1), Middle of a ship(6), Unknown(7), and the Aft(rear) of a ship. Ship going Up(2), Down(3), Left(4), and Right(5).\r\n\r\nShips have no diagonal or UDLR adjacency.  The best way in Seaman to deal with Midship segments is to determine where it can not go to determine an orientation.\r\n\r\nThe map is ringed by zeros to make m a 12x12 array.\r\n\r\n*Input:* m,r,c;  m 12x12 of map values, r(12,1) of row sums, c(1,12) of col sums\r\n\r\n*Output:* b; A binary 12x12 array\r\n\r\n*Example:*\r\n\r\n  r=[0 2 0 2 2 2 3 2 3 0 4 0]';\r\n  c=[0 4 0 3 1 3 1 4 0 1 3 0];\r\n  \r\n  m              b\r\n  000000000000  000000000000\r\n  077757777770  000011000000\r\n  077777777770  000000000000\r\n  077777777770  000100010000\r\n  077777777770  000100010000\r\n  077777777770  010000010000\r\n  077777777770  010000010010\r\n  027777777760  010000000010\r\n  077777777770  000101000010\r\n  077777777770  000000000000\r\n  077777477770  010001100100\r\n  000000000000  000000000000\r\n\r\n*Future:* The example is a Level-4 Captain board. The future holds less explicit boards that will require recursion methods.","description_html":"\u003cp\u003e\u003ca href = \"http://www.conceptispuzzles.com/index.aspx?uri=puzzle/battleships\"\u003eGames Magazine Battleships\u003c/a\u003e is a logic puzzle to find the Fleet given some map information and the number of Ship cells in every column and row. The fleet is made of a Battleship(4), two Cruisers(3), three Destroyers(2), and four Submarines(1). Thus the total filled cells is 20.\u003c/p\u003e\u003cp\u003eThe Seaman Level is the simplest and can be solved by direct evolution of current condition.\u003c/p\u003e\u003cp\u003eMap information contains Water(0), Subs(1), Middle of a ship(6), Unknown(7), and the Aft(rear) of a ship. Ship going Up(2), Down(3), Left(4), and Right(5).\u003c/p\u003e\u003cp\u003eShips have no diagonal or UDLR adjacency.  The best way in Seaman to deal with Midship segments is to determine where it can not go to determine an orientation.\u003c/p\u003e\u003cp\u003eThe map is ringed by zeros to make m a 12x12 array.\u003c/p\u003e\u003cp\u003e\u003cb\u003eInput:\u003c/b\u003e m,r,c;  m 12x12 of map values, r(12,1) of row sums, c(1,12) of col sums\u003c/p\u003e\u003cp\u003e\u003cb\u003eOutput:\u003c/b\u003e b; A binary 12x12 array\u003c/p\u003e\u003cp\u003e\u003cb\u003eExample:\u003c/b\u003e\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003er=[0 2 0 2 2 2 3 2 3 0 4 0]';\r\nc=[0 4 0 3 1 3 1 4 0 1 3 0];\r\n\u003c/pre\u003e\u003cpre class=\"language-matlab\"\u003em              b\r\n000000000000  000000000000\r\n077757777770  000011000000\r\n077777777770  000000000000\r\n077777777770  000100010000\r\n077777777770  000100010000\r\n077777777770  010000010000\r\n077777777770  010000010010\r\n027777777760  010000000010\r\n077777777770  000101000010\r\n077777777770  000000000000\r\n077777477770  010001100100\r\n000000000000  000000000000\r\n\u003c/pre\u003e\u003cp\u003e\u003cb\u003eFuture:\u003c/b\u003e The example is a Level-4 Captain board. The future holds less explicit boards that will require recursion methods.\u003c/p\u003e","function_template":"function b=solve_battleship(m,r,c)\r\n% WSUDLRMX 0W 1S 2U 3D 4L 5R 6M 7X\r\n% Surround 10x10 with ring of zeros\r\n% r : RowSum Vector [12,1]\r\n% c : ColSum Vector [1,12]\r\n b=zeros(12);\r\nend","test_suite":"%%\r\nm=zeros(12);\r\nm(2:end-1,2:end-1)=7;\r\n% Games August 2013 1-Seaman\r\nr=[0 2 2 3 1 1 1 1 2 2 5 0]';\r\nc=[0 1 0 1 1 2 6 0 5 0 4 0];\r\nm(2,2)=1;\r\nm(2,6)=1;\r\nm(4,9)=3;\r\n\r\ntic\r\nb=solve_battleship(m,r,c);\r\ntoc\r\n\r\nb(b\u003e1)=0;\r\nb(b\u003c0)=0;\r\n\r\nbr=sum(b,2);\r\nbc=sum(b);\r\n\r\nassert(isequal(r,br))\r\nassert(isequal(c,bc))\r\n\r\n% find battleship,cruisers,destroyers,subs\r\n% conv2 to locate pieces\r\n% bsh,bsv\r\n% ch,cv,dh,dv,s\r\n mconvsub=conv2(b,[2 2 2;2 1 2;2 2 2],'same');\r\n subs_ptr=find(mconvsub==1); % Isolated valid subs\r\n assert(size(subs_ptr,1)==4)\r\n % Qty of subs_ptr must be 4\r\n mconvBH=conv2(b,[5 5 5 5 5 5;5 1 1 1 1 5;5 5 5 5 5 5],'same');\r\n mconvBV=conv2(b',[5 5 5 5 5 5;5 1 1 1 1 5;5 5 5 5 5 5],'same');\r\n BS_ptr=[find(mconvBH==4);find(mconvBV==4)];\r\n assert(size(BS_ptr,1)==1)\r\n % Qty of BS_ptr must be 1\r\n mconvCH=conv2(b,[5 5 5 5 5;5 1 1 1 5;5 5 5 5 5],'same');\r\n mconvCV=conv2(b',[5 5 5 5 5;5 1 1 1 5;5 5 5 5 5],'same');\r\n CS_ptr=[find(mconvCH==3);find(mconvCV==3)];\r\n assert(size(CS_ptr,1)==2)\r\n % Qty of CS_ptr must be 2\r\n mconvDH=conv2(b,[5 5 5 5;5 1 1 5;5 5 5 5],'same');\r\n mconvDV=conv2(b',[5 5 5 5;5 1 1 5;5 5 5 5],'same');\r\n DS_ptr=[find(mconvDH==2);find(mconvDV==2)];\r\n assert(size(DS_ptr,1)==3)\r\n % Qty of DS_ptr must be 3\r\ntoc\r\n\r\n%%\r\nm=zeros(12);\r\nm(2:end-1,2:end-1)=7;\r\n\r\n% December 2013 1-Seaman \r\n r=[0 1 1 1 1 2 3 3 3 1 4 0]';\r\n c=[0 3 2 0 1 6 0 3 1 4 0 0];\r\n m(2,3)=1;\r\n m(8,5)=1;\r\n m(7,8)=6;\r\n\r\ntic\r\nb=solve_battleship(m,r,c);\r\ntoc\r\n\r\nb(b\u003e1)=0;\r\nb(b\u003c0)=0;\r\n\r\nbr=sum(b,2);\r\nbc=sum(b);\r\n\r\nassert(isequal(r,br))\r\nassert(isequal(c,bc))\r\n\r\n% find battleship,cruisers,destroyers,subs\r\n% conv2 to locate pieces\r\n% bsh,bsv\r\n% ch,cv,dh,dv,s\r\n mconvsub=conv2(b,[2 2 2;2 1 2;2 2 2],'same');\r\n subs_ptr=find(mconvsub==1); % Isolated valid subs\r\n assert(size(subs_ptr,1)==4)\r\n % Qty of subs_ptr must be 4\r\n mconvBH=conv2(b,[5 5 5 5 5 5;5 1 1 1 1 5;5 5 5 5 5 5],'same');\r\n mconvBV=conv2(b',[5 5 5 5 5 5;5 1 1 1 1 5;5 5 5 5 5 5],'same');\r\n BS_ptr=[find(mconvBH==4);find(mconvBV==4)];\r\n assert(size(BS_ptr,1)==1)\r\n % Qty of BS_ptr must be 1\r\n mconvCH=conv2(b,[5 5 5 5 5;5 1 1 1 5;5 5 5 5 5],'same');\r\n mconvCV=conv2(b',[5 5 5 5 5;5 1 1 1 5;5 5 5 5 5],'same');\r\n CS_ptr=[find(mconvCH==3);find(mconvCV==3)];\r\n assert(size(CS_ptr,1)==2)\r\n % Qty of CS_ptr must be 2\r\n mconvDH=conv2(b,[5 5 5 5;5 1 1 5;5 5 5 5],'same');\r\n mconvDV=conv2(b',[5 5 5 5;5 1 1 5;5 5 5 5],'same');\r\n DS_ptr=[find(mconvDH==2);find(mconvDV==2)];\r\n assert(size(DS_ptr,1)==3)\r\n % Qty of DS_ptr must be 3\r\ntoc\r\n\r\n%%\r\nm=zeros(12);\r\nm(2:end-1,2:end-1)=7;\r\n\r\n% September 2013 1-Seaman\r\n r=[0 1 1 2 4 1 0 2 2 5 2 0]';\r\n c=[0 1 1 1 1 4 0 7 0 2 3 0];\r\n m(2,8)=0;\r\n m(8,3)=1;\r\n m(9,6)=0;\r\n m(5,11)=6;\r\n\r\ntic\r\nb=solve_battleship(m,r,c);\r\ntoc\r\n\r\nb(b\u003e1)=0;\r\nb(b\u003c0)=0;\r\n\r\nbr=sum(b,2);\r\nbc=sum(b);\r\n\r\nassert(isequal(r,br))\r\nassert(isequal(c,bc))\r\n\r\n% find battleship,cruisers,destroyers,subs\r\n% conv2 to locate pieces\r\n% bsh,bsv\r\n% ch,cv,dh,dv,s\r\n mconvsub=conv2(b,[2 2 2;2 1 2;2 2 2],'same');\r\n subs_ptr=find(mconvsub==1); % Isolated valid subs\r\n assert(size(subs_ptr,1)==4)\r\n % Qty of subs_ptr must be 4\r\n mconvBH=conv2(b,[5 5 5 5 5 5;5 1 1 1 1 5;5 5 5 5 5 5],'same');\r\n mconvBV=conv2(b',[5 5 5 5 5 5;5 1 1 1 1 5;5 5 5 5 5 5],'same');\r\n BS_ptr=[find(mconvBH==4);find(mconvBV==4)];\r\n assert(size(BS_ptr,1)==1)\r\n % Qty of BS_ptr must be 1\r\n mconvCH=conv2(b,[5 5 5 5 5;5 1 1 1 5;5 5 5 5 5],'same');\r\n mconvCV=conv2(b',[5 5 5 5 5;5 1 1 1 5;5 5 5 5 5],'same');\r\n CS_ptr=[find(mconvCH==3);find(mconvCV==3)];\r\n assert(size(CS_ptr,1)==2)\r\n % Qty of CS_ptr must be 2\r\n mconvDH=conv2(b,[5 5 5 5;5 1 1 5;5 5 5 5],'same');\r\n mconvDV=conv2(b',[5 5 5 5;5 1 1 5;5 5 5 5],'same');\r\n DS_ptr=[find(mconvDH==2);find(mconvDV==2)];\r\n assert(size(DS_ptr,1)==3)\r\n % Qty of DS_ptr must be 3\r\ntoc\r\n\r\n\r\n","published":true,"deleted":false,"likes_count":0,"comments_count":0,"created_by":3097,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":3,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2013-11-12T05:17:43.000Z","updated_at":"2013-11-12T06:14:18.000Z","published_at":"2013-11-12T06:14:18.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:hyperlink w:docLocation=\\\"http://www.conceptispuzzles.com/index.aspx?uri=puzzle/battleships\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eGames Magazine Battleships\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e is a logic puzzle to find the Fleet given some map information and the number of Ship cells in every column and row. The fleet is made of a Battleship(4), two Cruisers(3), three Destroyers(2), and four Submarines(1). Thus the total filled cells is 20.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe Seaman Level is the simplest and can be solved by direct evolution of current condition.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eMap information contains Water(0), Subs(1), Middle of a ship(6), Unknown(7), and the Aft(rear) of a ship. Ship going Up(2), Down(3), Left(4), and Right(5).\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eShips have no diagonal or UDLR adjacency. The best way in Seaman to deal with Midship segments is to determine where it can not go to determine an orientation.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe map is ringed by zeros to make m a 12x12 array.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eInput:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e m,r,c; m 12x12 of map values, r(12,1) of row sums, c(1,12) of col sums\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eOutput:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e b; A binary 12x12 array\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eExample:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[r=[0 2 0 2 2 2 3 2 3 0 4 0]';\\nc=[0 4 0 3 1 3 1 4 0 1 3 0];\\n\\nm              b\\n000000000000  000000000000\\n077757777770  000011000000\\n077777777770  000000000000\\n077777777770  000100010000\\n077777777770  000100010000\\n077777777770  010000010000\\n077777777770  010000010010\\n027777777760  010000000010\\n077777777770  000101000010\\n077777777770  000000000000\\n077777477770  010001100100\\n000000000000  000000000000]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eFuture:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e The example is a Level-4 Captain board. The future holds less explicit boards that will require recursion methods.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":2004,"title":"BattleShip - Petty Officer (Level 2)","description":"\u003chttp://www.conceptispuzzles.com/index.aspx?uri=puzzle/battleships Games Magazine Battleships\u003e is a logic puzzle to find the Fleet given some map information and the number of Ship cells in every column and row. The fleet is made of a Battleship(4), two Cruisers(3), three Destroyers(2), and four Submarines(1). Thus the total filled cells is 20.\r\n\r\nThe Seaman Level is the simplest and can be solved by direct evolution of current condition. The Petty Officer Level requires just a pinch more effort to solve.\r\n\r\nMap information contains Water(0), Subs(1), Middle of a ship(6), Unknown(7), and the Aft(rear) of a ship. Ship going Up(2), Down(3), Left(4), and Right(5).\r\n\r\nShips have no diagonal or UDLR adjacency.  The best way in Seaman to deal with Midship segments is to determine where it can not go to determine an orientation.\r\n\r\nThe map is ringed by zeros to make m a 12x12 array.\r\n\r\n*Input:* m,r,c;  m 12x12 of map values, r(12,1) of row sums, c(1,12) of col sums\r\n\r\n*Output:* b; A binary 12x12 array\r\n\r\n*Example:*\r\n\r\n  r=[0 2 0 2 2 2 3 2 3 0 4 0]';\r\n  c=[0 4 0 3 1 3 1 4 0 1 3 0];\r\n  \r\n  m              b\r\n  000000000000  000000000000\r\n  077757777770  000011000000\r\n  077777777770  000000000000\r\n  077777777770  000100010000\r\n  077777777770  000100010000\r\n  077777777770  010000010000\r\n  077777777770  010000010010\r\n  027777777760  010000000010\r\n  077777777770  000101000010\r\n  077777777770  000000000000\r\n  077777477770  010001100100\r\n  000000000000  000000000000\r\n\r\n*Algorithm:* \r\n\r\n  1) Initialize processing array based upon input matrix.\r\n  2) Implement a cycling check of driven array changes\r\n  3) Quick Test of Change every single Unknown serially\r\n  4) Evolve and check if complete solution created","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.4333px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 795.667px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 397.833px; transform-origin: 407px 397.833px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 63px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 31.5px; text-align: left; transform-origin: 384px 31.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003ca target='_blank' href = \"http://www.conceptispuzzles.com/index.aspx?uri=puzzle/battleships\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eGames Magazine Battleships\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 291.35px 7.91667px; transform-origin: 291.35px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e is a logic puzzle to find the Fleet given some map information and the number of Ship cells in every column and row. The fleet is made of a Battleship(4), two Cruisers(3), three Destroyers(2), and four Submarines(1). Thus the total filled cells is 20.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 42px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 21px; text-align: left; transform-origin: 384px 21px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 360.45px 7.91667px; transform-origin: 360.45px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThe Seaman Level is the simplest and can be solved by direct evolution of current condition. The Petty Officer Level requires just a pinch more effort to solve.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 42px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 21px; text-align: left; transform-origin: 384px 21px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 382.1px 7.91667px; transform-origin: 382.1px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eMap information contains Water(0), Subs(1), Middle of a ship(6), Unknown(7), and the Aft(rear) of a ship. Ship going Up(2), Down(3), Left(4), and Right(5).\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 42px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 21px; text-align: left; transform-origin: 384px 21px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 382.267px 7.91667px; transform-origin: 382.267px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eShips have no diagonal or UDLR adjacency. The best way in Seaman to deal with Midship segments is to determine where it can not go to determine an orientation.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 165.183px 7.91667px; transform-origin: 165.183px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThe map is ringed by zeros to make m a 12x12 array.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 19.4333px 7.91667px; transform-origin: 19.4333px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003eInput:\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 220.5px 7.91667px; transform-origin: 220.5px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e m,r,c; m 12x12 of map values, r(12,1) of row sums, c(1,12) of col sums\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 25.2667px 7.91667px; transform-origin: 25.2667px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003eOutput:\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 74.3px 7.91667px; transform-origin: 74.3px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e b; A binary 12x12 array\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 31.1167px 7.91667px; transform-origin: 31.1167px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003eExample:\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgb(247, 247, 247); block-size: 326.933px; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-end-end-radius: 4px; border-end-start-radius: 4px; border-start-end-radius: 4px; border-start-start-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; margin-block-end: 10px; margin-block-start: 10px; margin-bottom: 10px; margin-inline-end: 3px; margin-inline-start: 3px; margin-left: 3px; margin-right: 3px; margin-top: 10px; perspective-origin: 404px 163.467px; transform-origin: 404px 163.467px; margin-left: 3px; margin-top: 10px; margin-bottom: 10px; margin-right: 3px; \"\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 0.833333px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 0.833333px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 0.833333px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 0.833333px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 111.65px 7.91667px; transform-origin: 111.65px 7.91667px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003er=[0 2 0 2 2 2 3 2 3 0 4 0]';\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 0.833333px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 0.833333px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 0.833333px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 0.833333px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 107.8px 7.91667px; transform-origin: 107.8px 7.91667px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003ec=[0 4 0 3 1 3 1 4 0 1 3 0];\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 0.833333px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 0.833333px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 0.833333px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 0.833333px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 0px 7.91667px; transform-origin: 0px 7.91667px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 0.833333px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 0.833333px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 0.833333px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 0.833333px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 61.6px 7.91667px; transform-origin: 61.6px 7.91667px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 57.75px 7.91667px; transform-origin: 57.75px 7.91667px; \"\u003em              \u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(170, 4, 249); border-block-start-color: rgb(170, 4, 249); border-bottom-color: rgb(170, 4, 249); border-inline-end-color: rgb(170, 4, 249); border-inline-start-color: rgb(170, 4, 249); border-left-color: rgb(170, 4, 249); border-right-color: rgb(170, 4, 249); border-top-color: rgb(170, 4, 249); caret-color: rgb(170, 4, 249); color: rgb(170, 4, 249); column-rule-color: rgb(170, 4, 249); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(170, 4, 249); perspective-origin: 3.85px 7.91667px; text-decoration: none; text-decoration-color: rgb(170, 4, 249); text-emphasis-color: rgb(170, 4, 249); transform-origin: 3.85px 7.91667px; \"\u003eb\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 0.833333px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 0.833333px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 0.833333px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 0.833333px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 100.1px 7.91667px; transform-origin: 100.1px 7.91667px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e000000000000  000000000000\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 0.833333px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 0.833333px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 0.833333px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 0.833333px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 100.1px 7.91667px; transform-origin: 100.1px 7.91667px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e077757777770  000011000000\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 0.833333px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 0.833333px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 0.833333px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 0.833333px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 100.1px 7.91667px; transform-origin: 100.1px 7.91667px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e077777777770  000000000000\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 0.833333px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 0.833333px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 0.833333px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 0.833333px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 100.1px 7.91667px; transform-origin: 100.1px 7.91667px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e077777777770  000100010000\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 0.833333px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 0.833333px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 0.833333px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 0.833333px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 100.1px 7.91667px; transform-origin: 100.1px 7.91667px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e077777777770  000100010000\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 0.833333px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 0.833333px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 0.833333px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 0.833333px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 100.1px 7.91667px; transform-origin: 100.1px 7.91667px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e077777777770  010000010000\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 0.833333px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 0.833333px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 0.833333px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 0.833333px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 100.1px 7.91667px; transform-origin: 100.1px 7.91667px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e077777777770  010000010010\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 0.833333px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 0.833333px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 0.833333px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 0.833333px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 100.1px 7.91667px; transform-origin: 100.1px 7.91667px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e027777777760  010000000010\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 0.833333px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 0.833333px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 0.833333px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 0.833333px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 100.1px 7.91667px; transform-origin: 100.1px 7.91667px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e077777777770  000101000010\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 0.833333px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 0.833333px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 0.833333px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 0.833333px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 100.1px 7.91667px; transform-origin: 100.1px 7.91667px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e077777777770  000000000000\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 0.833333px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 0.833333px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 0.833333px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 0.833333px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 100.1px 7.91667px; transform-origin: 100.1px 7.91667px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e077777477770  010001100100\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 0.833333px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 0.833333px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 0.833333px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 0.833333px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 100.1px 7.91667px; transform-origin: 100.1px 7.91667px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e000000000000  000000000000\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 10px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 10px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 10px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 35.3833px 7.91667px; transform-origin: 35.3833px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003eAlgorithm:\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgb(247, 247, 247); block-size: 81.7333px; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-end-end-radius: 4px; border-end-start-radius: 4px; border-start-end-radius: 4px; border-start-start-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; margin-block-end: 10px; margin-block-start: 10px; margin-bottom: 10px; margin-inline-end: 3px; margin-inline-start: 3px; margin-left: 3px; margin-right: 3px; margin-top: 10px; perspective-origin: 404px 40.8667px; transform-origin: 404px 40.8667px; margin-left: 3px; margin-top: 10px; margin-bottom: 10px; margin-right: 3px; \"\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 0.833333px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 0.833333px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 0.833333px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 0.833333px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 211.75px 7.91667px; transform-origin: 211.75px 7.91667px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 53.9px 7.91667px; transform-origin: 53.9px 7.91667px; \"\u003e1) Initialize \u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(170, 4, 249); border-block-start-color: rgb(170, 4, 249); border-bottom-color: rgb(170, 4, 249); border-inline-end-color: rgb(170, 4, 249); border-inline-start-color: rgb(170, 4, 249); border-left-color: rgb(170, 4, 249); border-right-color: rgb(170, 4, 249); border-top-color: rgb(170, 4, 249); caret-color: rgb(170, 4, 249); color: rgb(170, 4, 249); column-rule-color: rgb(170, 4, 249); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(170, 4, 249); perspective-origin: 157.85px 7.91667px; text-decoration: none; text-decoration-color: rgb(170, 4, 249); text-emphasis-color: rgb(170, 4, 249); transform-origin: 157.85px 7.91667px; \"\u003eprocessing array based upon input matrix.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 0.833333px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 0.833333px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 0.833333px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 0.833333px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 200.2px 7.91667px; transform-origin: 200.2px 7.91667px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 50.05px 7.91667px; transform-origin: 50.05px 7.91667px; \"\u003e2) Implement \u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(170, 4, 249); border-block-start-color: rgb(170, 4, 249); border-bottom-color: rgb(170, 4, 249); border-inline-end-color: rgb(170, 4, 249); border-inline-start-color: rgb(170, 4, 249); border-left-color: rgb(170, 4, 249); border-right-color: rgb(170, 4, 249); border-top-color: rgb(170, 4, 249); caret-color: rgb(170, 4, 249); color: rgb(170, 4, 249); column-rule-color: rgb(170, 4, 249); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(170, 4, 249); perspective-origin: 150.15px 7.91667px; text-decoration: none; text-decoration-color: rgb(170, 4, 249); text-emphasis-color: rgb(170, 4, 249); transform-origin: 150.15px 7.91667px; \"\u003ea cycling check of driven array changes\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 0.833333px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 0.833333px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 0.833333px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 0.833333px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 204.05px 7.91667px; transform-origin: 204.05px 7.91667px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 34.65px 7.91667px; transform-origin: 34.65px 7.91667px; \"\u003e3) Quick \u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(170, 4, 249); border-block-start-color: rgb(170, 4, 249); border-bottom-color: rgb(170, 4, 249); border-inline-end-color: rgb(170, 4, 249); border-inline-start-color: rgb(170, 4, 249); border-left-color: rgb(170, 4, 249); border-right-color: rgb(170, 4, 249); border-top-color: rgb(170, 4, 249); caret-color: rgb(170, 4, 249); color: rgb(170, 4, 249); column-rule-color: rgb(170, 4, 249); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(170, 4, 249); perspective-origin: 169.4px 7.91667px; text-decoration: none; text-decoration-color: rgb(170, 4, 249); text-emphasis-color: rgb(170, 4, 249); transform-origin: 169.4px 7.91667px; \"\u003eTest of Change every single Unknown serially\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 0.833333px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 0.833333px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 0.833333px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 0.833333px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 184.8px 7.91667px; transform-origin: 184.8px 7.91667px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 38.5px 7.91667px; transform-origin: 38.5px 7.91667px; \"\u003e4) Evolve \u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(170, 4, 249); border-block-start-color: rgb(170, 4, 249); border-bottom-color: rgb(170, 4, 249); border-inline-end-color: rgb(170, 4, 249); border-inline-start-color: rgb(170, 4, 249); border-left-color: rgb(170, 4, 249); border-right-color: rgb(170, 4, 249); border-top-color: rgb(170, 4, 249); caret-color: rgb(170, 4, 249); color: rgb(170, 4, 249); column-rule-color: rgb(170, 4, 249); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(170, 4, 249); perspective-origin: 146.3px 7.91667px; text-decoration: none; text-decoration-color: rgb(170, 4, 249); text-emphasis-color: rgb(170, 4, 249); transform-origin: 146.3px 7.91667px; \"\u003eand check if complete solution created\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function b=solve_battleship(m,r,c)\r\n% WSUDLRMX 0W 1S 2U 3D 4L 5R 6M 7X\r\n% Surround 10x10 with ring of zeros\r\n% r : RowSum Vector [12,1]\r\n% c : ColSum Vector [1,12]\r\n b=zeros(12);\r\nend","test_suite":"%%\r\nglobal valid\r\nfiletext = fileread('solve_battleship.m');\r\nvalid=isempty(strfind(filetext, '(exist(fullfile(cd'));\r\nassert(valid,'overwrite assert forbidden')\r\n%%\r\nglobal valid\r\nm=zeros(12);\r\nm(2:end-1,2:end-1)=7;\r\n% Games August 2013 2-Petty Officer %\r\nr=[0 0 1 4 1 3 3 3 3 2 0 0]';\r\nc=[0 2 3 2 0 5 0 4 0 2 2 0];\r\nm(5,4)=3;\r\nm(6,11)=3;\r\nm(9,8)=0;\r\n\r\ntic\r\nb=0;\r\nif valid\r\n b=solve_battleship(m,r,c);\r\nend\r\ntoc\r\n\r\nb(b\u003e1)=0;\r\nb(b\u003c0)=0;\r\n\r\nbr=sum(b,2);\r\nbc=sum(b);\r\n\r\nassert(isequal(r,br))\r\nassert(isequal(c,bc))\r\n\r\n% find battleship,cruisers,destroyers,subs\r\n% conv2 to locate pieces\r\n% bsh,bsv\r\n% ch,cv,dh,dv,s\r\n mconvsub=conv2(b,[2 2 2;2 1 2;2 2 2],'same');\r\n subs_ptr=find(mconvsub==1); % Isolated valid subs\r\n assert(size(subs_ptr,1)==4)\r\n % Qty of subs_ptr must be 4\r\n mconvBH=conv2(b,[5 5 5 5 5 5;5 1 1 1 1 5;5 5 5 5 5 5],'same');\r\n mconvBV=conv2(b',[5 5 5 5 5 5;5 1 1 1 1 5;5 5 5 5 5 5],'same');\r\n BS_ptr=[find(mconvBH==4);find(mconvBV==4)];\r\n assert(size(BS_ptr,1)==1)\r\n % Qty of BS_ptr must be 1\r\n mconvCH=conv2(b,[5 5 5 5 5;5 1 1 1 5;5 5 5 5 5],'same');\r\n mconvCV=conv2(b',[5 5 5 5 5;5 1 1 1 5;5 5 5 5 5],'same');\r\n CS_ptr=[find(mconvCH==3);find(mconvCV==3)];\r\n assert(size(CS_ptr,1)==2)\r\n % Qty of CS_ptr must be 2\r\n mconvDH=conv2(b,[5 5 5 5;5 1 1 5;5 5 5 5],'same');\r\n mconvDV=conv2(b',[5 5 5 5;5 1 1 5;5 5 5 5],'same');\r\n DS_ptr=[find(mconvDH==2);find(mconvDV==2)];\r\n assert(size(DS_ptr,1)==3)\r\n % Qty of DS_ptr must be 3\r\ntoc\r\n\r\n%%\r\nglobal valid\r\nm=zeros(12);\r\nm(2:end-1,2:end-1)=7;\r\n\r\n% December 2013 2-Petty %\r\nr=[0 2 2 2 3 2 0 0 7 0 2 0]';\r\nc=[0 2 5 1 4 1 4 0 2 1 0 0];\r\nm(3,3)=3;\r\nm(5,7)=1;\r\nm(9,4)=0;\r\n\r\ntic\r\nb=0;\r\nif valid\r\n b=solve_battleship(m,r,c);\r\nend\r\ntoc\r\n\r\nb(b\u003e1)=0;\r\nb(b\u003c0)=0;\r\n\r\nbr=sum(b,2);\r\nbc=sum(b);\r\n\r\nassert(isequal(r,br))\r\nassert(isequal(c,bc))\r\n\r\n% find battleship,cruisers,destroyers,subs\r\n% conv2 to locate pieces\r\n% bsh,bsv\r\n% ch,cv,dh,dv,s\r\n mconvsub=conv2(b,[2 2 2;2 1 2;2 2 2],'same');\r\n subs_ptr=find(mconvsub==1); % Isolated valid subs\r\n assert(size(subs_ptr,1)==4)\r\n % Qty of subs_ptr must be 4\r\n mconvBH=conv2(b,[5 5 5 5 5 5;5 1 1 1 1 5;5 5 5 5 5 5],'same');\r\n mconvBV=conv2(b',[5 5 5 5 5 5;5 1 1 1 1 5;5 5 5 5 5 5],'same');\r\n BS_ptr=[find(mconvBH==4);find(mconvBV==4)];\r\n assert(size(BS_ptr,1)==1)\r\n % Qty of BS_ptr must be 1\r\n mconvCH=conv2(b,[5 5 5 5 5;5 1 1 1 5;5 5 5 5 5],'same');\r\n mconvCV=conv2(b',[5 5 5 5 5;5 1 1 1 5;5 5 5 5 5],'same');\r\n CS_ptr=[find(mconvCH==3);find(mconvCV==3)];\r\n assert(size(CS_ptr,1)==2)\r\n % Qty of CS_ptr must be 2\r\n mconvDH=conv2(b,[5 5 5 5;5 1 1 5;5 5 5 5],'same');\r\n mconvDV=conv2(b',[5 5 5 5;5 1 1 5;5 5 5 5],'same');\r\n DS_ptr=[find(mconvDH==2);find(mconvDV==2)];\r\n assert(size(DS_ptr,1)==3)\r\n % Qty of DS_ptr must be 3\r\ntoc\r\n\r\n%%\r\nglobal valid\r\nm=zeros(12);\r\nm(2:end-1,2:end-1)=7;\r\n\r\n% September 2013 2-Petty\r\nr=[0 5 1 4 1 0 5 1 2 1 0 0]';\r\nc=[0 2 3 3 2 0 5 0 3 1 1 0];\r\nm(9,2)=1;\r\nm(2,7)=0;\r\nm(3,9)=1;\r\n\r\n\r\ntic\r\nb=0;\r\nif valid\r\n b=solve_battleship(m,r,c);\r\nend\r\ntoc\r\n\r\nb(b\u003e1)=0;\r\nb(b\u003c0)=0;\r\n\r\nbr=sum(b,2);\r\nbc=sum(b);\r\n\r\nassert(isequal(r,br))\r\nassert(isequal(c,bc))\r\n\r\n% find battleship,cruisers,destroyers,subs\r\n% conv2 to locate pieces\r\n% bsh,bsv\r\n% ch,cv,dh,dv,s\r\n mconvsub=conv2(b,[2 2 2;2 1 2;2 2 2],'same');\r\n subs_ptr=find(mconvsub==1); % Isolated valid subs\r\n assert(size(subs_ptr,1)==4)\r\n % Qty of subs_ptr must be 4\r\n mconvBH=conv2(b,[5 5 5 5 5 5;5 1 1 1 1 5;5 5 5 5 5 5],'same');\r\n mconvBV=conv2(b',[5 5 5 5 5 5;5 1 1 1 1 5;5 5 5 5 5 5],'same');\r\n BS_ptr=[find(mconvBH==4);find(mconvBV==4)];\r\n assert(size(BS_ptr,1)==1)\r\n % Qty of BS_ptr must be 1\r\n mconvCH=conv2(b,[5 5 5 5 5;5 1 1 1 5;5 5 5 5 5],'same');\r\n mconvCV=conv2(b',[5 5 5 5 5;5 1 1 1 5;5 5 5 5 5],'same');\r\n CS_ptr=[find(mconvCH==3);find(mconvCV==3)];\r\n assert(size(CS_ptr,1)==2)\r\n % Qty of CS_ptr must be 2\r\n mconvDH=conv2(b,[5 5 5 5;5 1 1 5;5 5 5 5],'same');\r\n mconvDV=conv2(b',[5 5 5 5;5 1 1 5;5 5 5 5],'same');\r\n DS_ptr=[find(mconvDH==2);find(mconvDV==2)];\r\n assert(size(DS_ptr,1)==3)\r\n % Qty of DS_ptr must be 3\r\ntoc\r\n","published":true,"deleted":false,"likes_count":0,"comments_count":0,"created_by":3097,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":4,"test_suite_updated_at":"2020-10-01T19:08:44.000Z","rescore_all_solutions":true,"group_id":1,"created_at":"2013-11-17T22:45:53.000Z","updated_at":"2025-12-10T03:22:09.000Z","published_at":"2013-11-17T23:06:51.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:hyperlink w:docLocation=\\\"http://www.conceptispuzzles.com/index.aspx?uri=puzzle/battleships\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eGames Magazine Battleships\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e is a logic puzzle to find the Fleet given some map information and the number of Ship cells in every column and row. The fleet is made of a Battleship(4), two Cruisers(3), three Destroyers(2), and four Submarines(1). Thus the total filled cells is 20.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe Seaman Level is the simplest and can be solved by direct evolution of current condition. The Petty Officer Level requires just a pinch more effort to solve.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eMap information contains Water(0), Subs(1), Middle of a ship(6), Unknown(7), and the Aft(rear) of a ship. Ship going Up(2), Down(3), Left(4), and Right(5).\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eShips have no diagonal or UDLR adjacency. The best way in Seaman to deal with Midship segments is to determine where it can not go to determine an orientation.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe map is ringed by zeros to make m a 12x12 array.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eInput:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e m,r,c; m 12x12 of map values, r(12,1) of row sums, c(1,12) of col sums\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eOutput:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e b; A binary 12x12 array\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eExample:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[r=[0 2 0 2 2 2 3 2 3 0 4 0]';\\nc=[0 4 0 3 1 3 1 4 0 1 3 0];\\n\\nm              b\\n000000000000  000000000000\\n077757777770  000011000000\\n077777777770  000000000000\\n077777777770  000100010000\\n077777777770  000100010000\\n077777777770  010000010000\\n077777777770  010000010010\\n027777777760  010000000010\\n077777777770  000101000010\\n077777777770  000000000000\\n077777477770  010001100100\\n000000000000  000000000000]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eAlgorithm:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[1) Initialize processing array based upon input matrix.\\n2) Implement a cycling check of driven array changes\\n3) Quick Test of Change every single Unknown serially\\n4) Evolve and check if complete solution created]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":2005,"title":"BattleShip - Seaman (1) thru Admiral(6) :  CPU Time Scoring(msec)","description":"\u003chttp://www.conceptispuzzles.com/index.aspx?uri=puzzle/battleships Games Magazine Battleships\u003e is a logic puzzle to find the Fleet given some map information and the number of Ship cells in every column and row. The fleet is made of a Battleship(4), two Cruisers(3), three Destroyers(2), and four Submarines(1). Thus the total filled cells is 20.\r\n\r\nThis Challenge is to complete three full sets of Battleship in minimal time.\r\n\r\nMap information contains Water(0), Subs(1), Middle of a ship(6), Unknown(7), and the Aft(rear) of a ship. Ship going Up(2), Down(3), Left(4), and Right(5).\r\n\r\nShips have no diagonal or UDLR adjacency.  The best way in Seaman to deal with Midship segments is to determine where it can not go to determine an orientation.\r\n\r\nThe map is ringed by zeros to make m a 12x12 array.\r\n\r\n*Input:* m,r,c;  m 12x12 of map values, r(12,1) of row sums, c(1,12) of col sums\r\n\r\n*Output:* b; A binary 12x12 array\r\n\r\n*Scoring:* Total Time (msec)\r\n\r\n*Example:*\r\n\r\n  r=[0 2 0 2 2 2 3 2 3 0 4 0]';\r\n  c=[0 4 0 3 1 3 1 4 0 1 3 0];\r\n  \r\n  m              b\r\n  000000000000  000000000000\r\n  077757777770  000011000000\r\n  077777777770  000000000000\r\n  077777777770  000100010000\r\n  077777777770  000100010000\r\n  077777777770  010000010000\r\n  077777777770  010000010010\r\n  027777777760  010000000010\r\n  077777777770  000101000010\r\n  077777777770  000000000000\r\n  077777477770  010001100100\r\n  000000000000  000000000000\r\n\r\n*Algorithm:* \r\n\r\n  1) Initialize processing array based upon input matrix.\r\n  2) Implement a cycling check of driven array changes\r\n  3) Quick Test of Change every single Unknown serially\r\n  4) Evolve and check if complete solution created\r\n  5) Robustly recursively check all potential Battleships, Cruisers, Destroyers, Subs","description_html":"\u003cp\u003e\u003ca href = \"http://www.conceptispuzzles.com/index.aspx?uri=puzzle/battleships\"\u003eGames Magazine Battleships\u003c/a\u003e is a logic puzzle to find the Fleet given some map information and the number of Ship cells in every column and row. The fleet is made of a Battleship(4), two Cruisers(3), three Destroyers(2), and four Submarines(1). Thus the total filled cells is 20.\u003c/p\u003e\u003cp\u003eThis Challenge is to complete three full sets of Battleship in minimal time.\u003c/p\u003e\u003cp\u003eMap information contains Water(0), Subs(1), Middle of a ship(6), Unknown(7), and the Aft(rear) of a ship. Ship going Up(2), Down(3), Left(4), and Right(5).\u003c/p\u003e\u003cp\u003eShips have no diagonal or UDLR adjacency.  The best way in Seaman to deal with Midship segments is to determine where it can not go to determine an orientation.\u003c/p\u003e\u003cp\u003eThe map is ringed by zeros to make m a 12x12 array.\u003c/p\u003e\u003cp\u003e\u003cb\u003eInput:\u003c/b\u003e m,r,c;  m 12x12 of map values, r(12,1) of row sums, c(1,12) of col sums\u003c/p\u003e\u003cp\u003e\u003cb\u003eOutput:\u003c/b\u003e b; A binary 12x12 array\u003c/p\u003e\u003cp\u003e\u003cb\u003eScoring:\u003c/b\u003e Total Time (msec)\u003c/p\u003e\u003cp\u003e\u003cb\u003eExample:\u003c/b\u003e\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003er=[0 2 0 2 2 2 3 2 3 0 4 0]';\r\nc=[0 4 0 3 1 3 1 4 0 1 3 0];\r\n\u003c/pre\u003e\u003cpre class=\"language-matlab\"\u003em              b\r\n000000000000  000000000000\r\n077757777770  000011000000\r\n077777777770  000000000000\r\n077777777770  000100010000\r\n077777777770  000100010000\r\n077777777770  010000010000\r\n077777777770  010000010010\r\n027777777760  010000000010\r\n077777777770  000101000010\r\n077777777770  000000000000\r\n077777477770  010001100100\r\n000000000000  000000000000\r\n\u003c/pre\u003e\u003cp\u003e\u003cb\u003eAlgorithm:\u003c/b\u003e\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003e1) Initialize processing array based upon input matrix.\r\n2) Implement a cycling check of driven array changes\r\n3) Quick Test of Change every single Unknown serially\r\n4) Evolve and check if complete solution created\r\n5) Robustly recursively check all potential Battleships, Cruisers, Destroyers, Subs\r\n\u003c/pre\u003e","function_template":"function b=solve_battleship(m,r,c)\r\n% WSUDLRMX 0W 1S 2U 3D 4L 5R 6M 7X\r\n% Surround 10x10 with ring of zeros\r\n% r : RowSum Vector [12,1]\r\n% c : ColSum Vector [1,12]\r\n b=zeros(12);\r\nend","test_suite":"assignin('caller','score',2000);\r\n%%\r\nglobal tt\r\nm=zeros(12);\r\nm(2:end-1,2:end-1)=7;\r\n\r\n% Games August 2013 1-Seaman\r\nr=[0 2 2 3 1 1 1 1 2 2 5 0]';\r\nc=[0 1 0 1 1 2 6 0 5 0 4 0];\r\nm(2,2)=1;\r\nm(2,6)=1;\r\nm(4,9)=3;\r\n\r\n%tz=tt; % anti-cheat\r\ntic\r\ntime0=cputime;\r\nb=solve_battleship(m,r,c);\r\n%tt=tz+cputime-time0\r\ntt=cputime-time0\r\n%toc\r\n\r\n\r\nb(b\u003e1)=0;\r\nb(b\u003c0)=0;\r\n\r\nbr=sum(b,2);\r\nbc=sum(b);\r\n\r\nassert(isequal(r,br))\r\nassert(isequal(c,bc))\r\n\r\n% find battleship,cruisers,destroyers,subs\r\n% conv2 to locate pieces\r\n% bsh,bsv\r\n% ch,cv,dh,dv,s\r\n mconvsub=conv2(b,[2 2 2;2 1 2;2 2 2],'same');\r\n subs_ptr=find(mconvsub==1); % Isolated valid subs\r\n assert(size(subs_ptr,1)==4)\r\n % Qty of subs_ptr must be 4\r\n mconvBH=conv2(b,[5 5 5 5 5 5;5 1 1 1 1 5;5 5 5 5 5 5],'same');\r\n mconvBV=conv2(b',[5 5 5 5 5 5;5 1 1 1 1 5;5 5 5 5 5 5],'same');\r\n BS_ptr=[find(mconvBH==4);find(mconvBV==4)];\r\n assert(size(BS_ptr,1)==1)\r\n % Qty of BS_ptr must be 1\r\n mconvCH=conv2(b,[5 5 5 5 5;5 1 1 1 5;5 5 5 5 5],'same');\r\n mconvCV=conv2(b',[5 5 5 5 5;5 1 1 1 5;5 5 5 5 5],'same');\r\n CS_ptr=[find(mconvCH==3);find(mconvCV==3)];\r\n assert(size(CS_ptr,1)==2)\r\n % Qty of CS_ptr must be 2\r\n mconvDH=conv2(b,[5 5 5 5;5 1 1 5;5 5 5 5],'same');\r\n mconvDV=conv2(b',[5 5 5 5;5 1 1 5;5 5 5 5],'same');\r\n DS_ptr=[find(mconvDH==2);find(mconvDV==2)];\r\n assert(size(DS_ptr,1)==3)\r\n % Qty of DS_ptr must be 3\r\ntoc\r\n%%\r\nglobal tt\r\nm=zeros(12);\r\nm(2:end-1,2:end-1)=7;\r\n\r\n% Games August 2013 2-Petty Officer\r\nr=[0 0 1 4 1 3 3 3 3 2 0 0]';\r\nc=[0 2 3 2 0 5 0 4 0 2 2 0];\r\nm(5,4)=3;\r\nm(6,11)=3;\r\nm(9,8)=0;\r\n\r\ntz=tt; % anti-cheat\r\ntic\r\ntime0=cputime;\r\nb=solve_battleship(m,r,c);\r\ntt=tz+cputime-time0\r\n%toc\r\n\r\n\r\nb(b\u003e1)=0;\r\nb(b\u003c0)=0;\r\n\r\nbr=sum(b,2);\r\nbc=sum(b);\r\n\r\nassert(isequal(r,br))\r\nassert(isequal(c,bc))\r\n\r\n% find battleship,cruisers,destroyers,subs\r\n% conv2 to locate pieces\r\n% bsh,bsv\r\n% ch,cv,dh,dv,s\r\n mconvsub=conv2(b,[2 2 2;2 1 2;2 2 2],'same');\r\n subs_ptr=find(mconvsub==1); % Isolated valid subs\r\n assert(size(subs_ptr,1)==4)\r\n % Qty of subs_ptr must be 4\r\n mconvBH=conv2(b,[5 5 5 5 5 5;5 1 1 1 1 5;5 5 5 5 5 5],'same');\r\n mconvBV=conv2(b',[5 5 5 5 5 5;5 1 1 1 1 5;5 5 5 5 5 5],'same');\r\n BS_ptr=[find(mconvBH==4);find(mconvBV==4)];\r\n assert(size(BS_ptr,1)==1)\r\n % Qty of BS_ptr must be 1\r\n mconvCH=conv2(b,[5 5 5 5 5;5 1 1 1 5;5 5 5 5 5],'same');\r\n mconvCV=conv2(b',[5 5 5 5 5;5 1 1 1 5;5 5 5 5 5],'same');\r\n CS_ptr=[find(mconvCH==3);find(mconvCV==3)];\r\n assert(size(CS_ptr,1)==2)\r\n % Qty of CS_ptr must be 2\r\n mconvDH=conv2(b,[5 5 5 5;5 1 1 5;5 5 5 5],'same');\r\n mconvDV=conv2(b',[5 5 5 5;5 1 1 5;5 5 5 5],'same');\r\n DS_ptr=[find(mconvDH==2);find(mconvDV==2)];\r\n assert(size(DS_ptr,1)==3)\r\n % Qty of DS_ptr must be 3\r\ntoc\r\n%%\r\nglobal tt\r\nm=zeros(12);\r\nm(2:end-1,2:end-1)=7;\r\n\r\n% Games August 2013 3-Ensign\r\nr=[0 3 0 4 1 0 0 1 2 1 8 0]';\r\nc=[0 5 1 1 3 1 1 1 1 3 3 0];\r\nm(4,7)=1;\r\nm(4,11)=3;\r\n\r\ntz=tt; % anti-cheat\r\ntic\r\ntime0=cputime;\r\nb=solve_battleship(m,r,c);\r\ntt=tz+cputime-time0\r\n%toc\r\n\r\n\r\nb(b\u003e1)=0;\r\nb(b\u003c0)=0;\r\n\r\nbr=sum(b,2);\r\nbc=sum(b);\r\n\r\nassert(isequal(r,br))\r\nassert(isequal(c,bc))\r\n\r\n% find battleship,cruisers,destroyers,subs\r\n% conv2 to locate pieces\r\n% bsh,bsv\r\n% ch,cv,dh,dv,s\r\n mconvsub=conv2(b,[2 2 2;2 1 2;2 2 2],'same');\r\n subs_ptr=find(mconvsub==1); % Isolated valid subs\r\n assert(size(subs_ptr,1)==4)\r\n % Qty of subs_ptr must be 4\r\n mconvBH=conv2(b,[5 5 5 5 5 5;5 1 1 1 1 5;5 5 5 5 5 5],'same');\r\n mconvBV=conv2(b',[5 5 5 5 5 5;5 1 1 1 1 5;5 5 5 5 5 5],'same');\r\n BS_ptr=[find(mconvBH==4);find(mconvBV==4)];\r\n assert(size(BS_ptr,1)==1)\r\n % Qty of BS_ptr must be 1\r\n mconvCH=conv2(b,[5 5 5 5 5;5 1 1 1 5;5 5 5 5 5],'same');\r\n mconvCV=conv2(b',[5 5 5 5 5;5 1 1 1 5;5 5 5 5 5],'same');\r\n CS_ptr=[find(mconvCH==3);find(mconvCV==3)];\r\n assert(size(CS_ptr,1)==2)\r\n % Qty of CS_ptr must be 2\r\n mconvDH=conv2(b,[5 5 5 5;5 1 1 5;5 5 5 5],'same');\r\n mconvDV=conv2(b',[5 5 5 5;5 1 1 5;5 5 5 5],'same');\r\n DS_ptr=[find(mconvDH==2);find(mconvDV==2)];\r\n assert(size(DS_ptr,1)==3)\r\n % Qty of DS_ptr must be 3\r\ntoc\r\n%%\r\nglobal tt\r\nm=zeros(12);\r\nm(2:end-1,2:end-1)=7;\r\n\r\n% Games August 2013 4-Captain\r\nr=[0 1 2 2 2 2 5 0 5 0 1 0]';\r\nc=[0 5 0 0 0 2 1 4 2 1 5 0];\r\nm(4,8)=0;\r\nm(7,10)=4;\r\n\r\ntz=tt; % anti-cheat\r\ntic\r\ntime0=cputime;\r\nb=solve_battleship(m,r,c);\r\ntt=tz+cputime-time0\r\n%toc\r\n\r\n\r\nb(b\u003e1)=0;\r\nb(b\u003c0)=0;\r\n\r\nbr=sum(b,2);\r\nbc=sum(b);\r\n\r\nassert(isequal(r,br))\r\nassert(isequal(c,bc))\r\n\r\n% find battleship,cruisers,destroyers,subs\r\n% conv2 to locate pieces\r\n% bsh,bsv\r\n% ch,cv,dh,dv,s\r\n mconvsub=conv2(b,[2 2 2;2 1 2;2 2 2],'same');\r\n subs_ptr=find(mconvsub==1); % Isolated valid subs\r\n assert(size(subs_ptr,1)==4)\r\n % Qty of subs_ptr must be 4\r\n mconvBH=conv2(b,[5 5 5 5 5 5;5 1 1 1 1 5;5 5 5 5 5 5],'same');\r\n mconvBV=conv2(b',[5 5 5 5 5 5;5 1 1 1 1 5;5 5 5 5 5 5],'same');\r\n BS_ptr=[find(mconvBH==4);find(mconvBV==4)];\r\n assert(size(BS_ptr,1)==1)\r\n % Qty of BS_ptr must be 1\r\n mconvCH=conv2(b,[5 5 5 5 5;5 1 1 1 5;5 5 5 5 5],'same');\r\n mconvCV=conv2(b',[5 5 5 5 5;5 1 1 1 5;5 5 5 5 5],'same');\r\n CS_ptr=[find(mconvCH==3);find(mconvCV==3)];\r\n assert(size(CS_ptr,1)==2)\r\n % Qty of CS_ptr must be 2\r\n mconvDH=conv2(b,[5 5 5 5;5 1 1 5;5 5 5 5],'same');\r\n mconvDV=conv2(b',[5 5 5 5;5 1 1 5;5 5 5 5],'same');\r\n DS_ptr=[find(mconvDH==2);find(mconvDV==2)];\r\n assert(size(DS_ptr,1)==3)\r\n % Qty of DS_ptr must be 3\r\ntoc\r\n%%\r\nglobal tt\r\nm=zeros(12);\r\nm(2:end-1,2:end-1)=7;\r\n\r\n% Games August 2013 5-Commodore\r\nr=[0 1 1 5 0 3 1 3 2 1 3 0]';\r\nc=[0 2 2 1 0 2 1 6 0 5 1 0];\r\nm(6,4)=1;\r\nm(6,8)=0;\r\nm(7,10)=3;\r\n\r\ntz=tt; % anti-cheat\r\ntic\r\ntime0=cputime;\r\nb=solve_battleship(m,r,c);\r\ntt=tz+cputime-time0\r\n%toc\r\n\r\n\r\nb(b\u003e1)=0;\r\nb(b\u003c0)=0;\r\n\r\nbr=sum(b,2);\r\nbc=sum(b);\r\n\r\nassert(isequal(r,br))\r\nassert(isequal(c,bc))\r\n\r\n% find battleship,cruisers,destroyers,subs\r\n% conv2 to locate pieces\r\n% bsh,bsv\r\n% ch,cv,dh,dv,s\r\n mconvsub=conv2(b,[2 2 2;2 1 2;2 2 2],'same');\r\n subs_ptr=find(mconvsub==1); % Isolated valid subs\r\n assert(size(subs_ptr,1)==4)\r\n % Qty of subs_ptr must be 4\r\n mconvBH=conv2(b,[5 5 5 5 5 5;5 1 1 1 1 5;5 5 5 5 5 5],'same');\r\n mconvBV=conv2(b',[5 5 5 5 5 5;5 1 1 1 1 5;5 5 5 5 5 5],'same');\r\n BS_ptr=[find(mconvBH==4);find(mconvBV==4)];\r\n assert(size(BS_ptr,1)==1)\r\n % Qty of BS_ptr must be 1\r\n mconvCH=conv2(b,[5 5 5 5 5;5 1 1 1 5;5 5 5 5 5],'same');\r\n mconvCV=conv2(b',[5 5 5 5 5;5 1 1 1 5;5 5 5 5 5],'same');\r\n CS_ptr=[find(mconvCH==3);find(mconvCV==3)];\r\n assert(size(CS_ptr,1)==2)\r\n % Qty of CS_ptr must be 2\r\n mconvDH=conv2(b,[5 5 5 5;5 1 1 5;5 5 5 5],'same');\r\n mconvDV=conv2(b',[5 5 5 5;5 1 1 5;5 5 5 5],'same');\r\n DS_ptr=[find(mconvDH==2);find(mconvDV==2)];\r\n assert(size(DS_ptr,1)==3)\r\n % Qty of DS_ptr must be 3\r\ntoc\r\n%%\r\nglobal tt\r\nm=zeros(12);\r\nm(2:end-1,2:end-1)=7;\r\n\r\n% Games August 2013 6-Admiral\r\nr=[0 5 1 4 2 3 1 1 0 3 0 0]';\r\nc=[0 4 0 1 2 4 2 1 1 5 0 0];\r\nm(5,2)=1;\r\nm(10,7)=6;\r\n\r\ntz=tt; % anti-cheat\r\ntic\r\ntime0=cputime;\r\nb=solve_battleship(m,r,c);\r\ntt=tz+cputime-time0\r\n%toc\r\n\r\n\r\nb(b\u003e1)=0;\r\nb(b\u003c0)=0;\r\n\r\nbr=sum(b,2);\r\nbc=sum(b);\r\n\r\nassert(isequal(r,br))\r\nassert(isequal(c,bc))\r\n\r\n% find battleship,cruisers,destroyers,subs\r\n% conv2 to locate pieces\r\n% bsh,bsv\r\n% ch,cv,dh,dv,s\r\n mconvsub=conv2(b,[2 2 2;2 1 2;2 2 2],'same');\r\n subs_ptr=find(mconvsub==1); % Isolated valid subs\r\n assert(size(subs_ptr,1)==4)\r\n % Qty of subs_ptr must be 4\r\n mconvBH=conv2(b,[5 5 5 5 5 5;5 1 1 1 1 5;5 5 5 5 5 5],'same');\r\n mconvBV=conv2(b',[5 5 5 5 5 5;5 1 1 1 1 5;5 5 5 5 5 5],'same');\r\n BS_ptr=[find(mconvBH==4);find(mconvBV==4)];\r\n assert(size(BS_ptr,1)==1)\r\n % Qty of BS_ptr must be 1\r\n mconvCH=conv2(b,[5 5 5 5 5;5 1 1 1 5;5 5 5 5 5],'same');\r\n mconvCV=conv2(b',[5 5 5 5 5;5 1 1 1 5;5 5 5 5 5],'same');\r\n CS_ptr=[find(mconvCH==3);find(mconvCV==3)];\r\n assert(size(CS_ptr,1)==2)\r\n % Qty of CS_ptr must be 2\r\n mconvDH=conv2(b,[5 5 5 5;5 1 1 5;5 5 5 5],'same');\r\n mconvDV=conv2(b',[5 5 5 5;5 1 1 5;5 5 5 5],'same');\r\n DS_ptr=[find(mconvDH==2);find(mconvDV==2)];\r\n assert(size(DS_ptr,1)==3)\r\n % Qty of DS_ptr must be 3\r\ntoc\r\n%%\r\nglobal tt\r\nm=zeros(12);\r\nm(2:end-1,2:end-1)=7;\r\n\r\n% December 2013 1-Seaman\r\nr=[0 1 1 1 1 2 3 3 3 1 4 0]';\r\nc=[0 3 2 0 1 6 0 3 1 4 0 0];\r\nm(2,3)=1;\r\nm(8,5)=1;\r\nm(7,8)=6;\r\n\r\ntz=tt; % anti-cheat\r\ntic\r\ntime0=cputime;\r\nb=solve_battleship(m,r,c);\r\ntt=tz+cputime-time0\r\n%toc\r\n\r\n\r\nb(b\u003e1)=0;\r\nb(b\u003c0)=0;\r\n\r\nbr=sum(b,2);\r\nbc=sum(b);\r\n\r\nassert(isequal(r,br))\r\nassert(isequal(c,bc))\r\n\r\n% find battleship,cruisers,destroyers,subs\r\n% conv2 to locate pieces\r\n% bsh,bsv\r\n% ch,cv,dh,dv,s\r\n mconvsub=conv2(b,[2 2 2;2 1 2;2 2 2],'same');\r\n subs_ptr=find(mconvsub==1); % Isolated valid subs\r\n assert(size(subs_ptr,1)==4)\r\n % Qty of subs_ptr must be 4\r\n mconvBH=conv2(b,[5 5 5 5 5 5;5 1 1 1 1 5;5 5 5 5 5 5],'same');\r\n mconvBV=conv2(b',[5 5 5 5 5 5;5 1 1 1 1 5;5 5 5 5 5 5],'same');\r\n BS_ptr=[find(mconvBH==4);find(mconvBV==4)];\r\n assert(size(BS_ptr,1)==1)\r\n % Qty of BS_ptr must be 1\r\n mconvCH=conv2(b,[5 5 5 5 5;5 1 1 1 5;5 5 5 5 5],'same');\r\n mconvCV=conv2(b',[5 5 5 5 5;5 1 1 1 5;5 5 5 5 5],'same');\r\n CS_ptr=[find(mconvCH==3);find(mconvCV==3)];\r\n assert(size(CS_ptr,1)==2)\r\n % Qty of CS_ptr must be 2\r\n mconvDH=conv2(b,[5 5 5 5;5 1 1 5;5 5 5 5],'same');\r\n mconvDV=conv2(b',[5 5 5 5;5 1 1 5;5 5 5 5],'same');\r\n DS_ptr=[find(mconvDH==2);find(mconvDV==2)];\r\n assert(size(DS_ptr,1)==3)\r\n % Qty of DS_ptr must be 3\r\ntoc\r\n%%\r\nglobal tt\r\nm=zeros(12);\r\nm(2:end-1,2:end-1)=7;\r\n\r\n% December 2013 2-Petty\r\nr=[0 2 2 2 3 2 0 0 7 0 2 0]';\r\nc=[0 2 5 1 4 1 4 0 2 1 0 0];\r\nm(3,3)=3;\r\nm(5,7)=1;\r\nm(9,4)=0;\r\n\r\ntz=tt; % anti-cheat\r\ntic\r\ntime0=cputime;\r\nb=solve_battleship(m,r,c);\r\ntt=tz+cputime-time0\r\n%toc\r\n\r\n\r\nb(b\u003e1)=0;\r\nb(b\u003c0)=0;\r\n\r\nbr=sum(b,2);\r\nbc=sum(b);\r\n\r\nassert(isequal(r,br))\r\nassert(isequal(c,bc))\r\n\r\n% find battleship,cruisers,destroyers,subs\r\n% conv2 to locate pieces\r\n% bsh,bsv\r\n% ch,cv,dh,dv,s\r\n mconvsub=conv2(b,[2 2 2;2 1 2;2 2 2],'same');\r\n subs_ptr=find(mconvsub==1); % Isolated valid subs\r\n assert(size(subs_ptr,1)==4)\r\n % Qty of subs_ptr must be 4\r\n mconvBH=conv2(b,[5 5 5 5 5 5;5 1 1 1 1 5;5 5 5 5 5 5],'same');\r\n mconvBV=conv2(b',[5 5 5 5 5 5;5 1 1 1 1 5;5 5 5 5 5 5],'same');\r\n BS_ptr=[find(mconvBH==4);find(mconvBV==4)];\r\n assert(size(BS_ptr,1)==1)\r\n % Qty of BS_ptr must be 1\r\n mconvCH=conv2(b,[5 5 5 5 5;5 1 1 1 5;5 5 5 5 5],'same');\r\n mconvCV=conv2(b',[5 5 5 5 5;5 1 1 1 5;5 5 5 5 5],'same');\r\n CS_ptr=[find(mconvCH==3);find(mconvCV==3)];\r\n assert(size(CS_ptr,1)==2)\r\n % Qty of CS_ptr must be 2\r\n mconvDH=conv2(b,[5 5 5 5;5 1 1 5;5 5 5 5],'same');\r\n mconvDV=conv2(b',[5 5 5 5;5 1 1 5;5 5 5 5],'same');\r\n DS_ptr=[find(mconvDH==2);find(mconvDV==2)];\r\n assert(size(DS_ptr,1)==3)\r\n % Qty of DS_ptr must be 3\r\ntoc\r\n%%\r\nglobal tt\r\nm=zeros(12);\r\nm(2:end-1,2:end-1)=7;\r\n\r\n% December 2013 3-Ensign\r\nr=[0 3 0 0 2 4 3 2 1 4 1 0]';\r\nc=[0 2 2 5 2 3 0 3 0 2 1 0];\r\nm(7,2)=1;\r\nm(7,4)=3;\r\nm(9,8)=0;\r\n\r\ntz=tt; % anti-cheat\r\ntic\r\ntime0=cputime;\r\nb=solve_battleship(m,r,c);\r\ntt=tz+cputime-time0\r\n%toc\r\n\r\n\r\nb(b\u003e1)=0;\r\nb(b\u003c0)=0;\r\n\r\nbr=sum(b,2);\r\nbc=sum(b);\r\n\r\nassert(isequal(r,br))\r\nassert(isequal(c,bc))\r\n\r\n% find battleship,cruisers,destroyers,subs\r\n% conv2 to locate pieces\r\n% bsh,bsv\r\n% ch,cv,dh,dv,s\r\n mconvsub=conv2(b,[2 2 2;2 1 2;2 2 2],'same');\r\n subs_ptr=find(mconvsub==1); % Isolated valid subs\r\n assert(size(subs_ptr,1)==4)\r\n % Qty of subs_ptr must be 4\r\n mconvBH=conv2(b,[5 5 5 5 5 5;5 1 1 1 1 5;5 5 5 5 5 5],'same');\r\n mconvBV=conv2(b',[5 5 5 5 5 5;5 1 1 1 1 5;5 5 5 5 5 5],'same');\r\n BS_ptr=[find(mconvBH==4);find(mconvBV==4)];\r\n assert(size(BS_ptr,1)==1)\r\n % Qty of BS_ptr must be 1\r\n mconvCH=conv2(b,[5 5 5 5 5;5 1 1 1 5;5 5 5 5 5],'same');\r\n mconvCV=conv2(b',[5 5 5 5 5;5 1 1 1 5;5 5 5 5 5],'same');\r\n CS_ptr=[find(mconvCH==3);find(mconvCV==3)];\r\n assert(size(CS_ptr,1)==2)\r\n % Qty of CS_ptr must be 2\r\n mconvDH=conv2(b,[5 5 5 5;5 1 1 5;5 5 5 5],'same');\r\n mconvDV=conv2(b',[5 5 5 5;5 1 1 5;5 5 5 5],'same');\r\n DS_ptr=[find(mconvDH==2);find(mconvDV==2)];\r\n assert(size(DS_ptr,1)==3)\r\n % Qty of DS_ptr must be 3\r\ntoc\r\n%%\r\nglobal tt\r\nm=zeros(12);\r\nm(2:end-1,2:end-1)=7;\r\n\r\n% December 2013 4-Captain\r\nr=[0 2 0 2 2 2 3 2 3 0 4 0]';\r\nc=[0 4 0 3 1 3 1 4 0 1 3 0];\r\nm(8,2)=2;\r\nm(2,5)=5;\r\nm(11,7)=4;\r\nm(8,11)=6;\r\n\r\n\r\ntz=tt; % anti-cheat\r\ntic\r\ntime0=cputime;\r\nb=solve_battleship(m,r,c);\r\ntt=tz+cputime-time0\r\n%toc\r\n\r\n\r\nb(b\u003e1)=0;\r\nb(b\u003c0)=0;\r\n\r\nbr=sum(b,2);\r\nbc=sum(b);\r\n\r\nassert(isequal(r,br))\r\nassert(isequal(c,bc))\r\n\r\n% find battleship,cruisers,destroyers,subs\r\n% conv2 to locate pieces\r\n% bsh,bsv\r\n% ch,cv,dh,dv,s\r\n mconvsub=conv2(b,[2 2 2;2 1 2;2 2 2],'same');\r\n subs_ptr=find(mconvsub==1); % Isolated valid subs\r\n assert(size(subs_ptr,1)==4)\r\n % Qty of subs_ptr must be 4\r\n mconvBH=conv2(b,[5 5 5 5 5 5;5 1 1 1 1 5;5 5 5 5 5 5],'same');\r\n mconvBV=conv2(b',[5 5 5 5 5 5;5 1 1 1 1 5;5 5 5 5 5 5],'same');\r\n BS_ptr=[find(mconvBH==4);find(mconvBV==4)];\r\n assert(size(BS_ptr,1)==1)\r\n % Qty of BS_ptr must be 1\r\n mconvCH=conv2(b,[5 5 5 5 5;5 1 1 1 5;5 5 5 5 5],'same');\r\n mconvCV=conv2(b',[5 5 5 5 5;5 1 1 1 5;5 5 5 5 5],'same');\r\n CS_ptr=[find(mconvCH==3);find(mconvCV==3)];\r\n assert(size(CS_ptr,1)==2)\r\n % Qty of CS_ptr must be 2\r\n mconvDH=conv2(b,[5 5 5 5;5 1 1 5;5 5 5 5],'same');\r\n mconvDV=conv2(b',[5 5 5 5;5 1 1 5;5 5 5 5],'same');\r\n DS_ptr=[find(mconvDH==2);find(mconvDV==2)];\r\n assert(size(DS_ptr,1)==3)\r\n % Qty of DS_ptr must be 3\r\ntoc\r\n%%\r\nglobal tt\r\nm=zeros(12);\r\nm(2:end-1,2:end-1)=7;\r\n\r\n% December 2013 5-Commodore\r\nr=[0 3 2 3 1 1 1 3 3 2 1 0]';\r\nc=[0 1 2 4 1 4 1 1 0 5 1 0];\r\nm(2,10)=5;\r\nm(8,4)=6;\r\nm(8,6)=5;\r\n\r\ntz=tt; % anti-cheat\r\ntic\r\ntime0=cputime;\r\nb=solve_battleship(m,r,c);\r\ntt=tz+cputime-time0\r\n%toc\r\n\r\n\r\nb(b\u003e1)=0;\r\nb(b\u003c0)=0;\r\n\r\nbr=sum(b,2);\r\nbc=sum(b);\r\n\r\nassert(isequal(r,br))\r\nassert(isequal(c,bc))\r\n\r\n% find battleship,cruisers,destroyers,subs\r\n% conv2 to locate pieces\r\n% bsh,bsv\r\n% ch,cv,dh,dv,s\r\n mconvsub=conv2(b,[2 2 2;2 1 2;2 2 2],'same');\r\n subs_ptr=find(mconvsub==1); % Isolated valid subs\r\n assert(size(subs_ptr,1)==4)\r\n % Qty of subs_ptr must be 4\r\n mconvBH=conv2(b,[5 5 5 5 5 5;5 1 1 1 1 5;5 5 5 5 5 5],'same');\r\n mconvBV=conv2(b',[5 5 5 5 5 5;5 1 1 1 1 5;5 5 5 5 5 5],'same');\r\n BS_ptr=[find(mconvBH==4);find(mconvBV==4)];\r\n assert(size(BS_ptr,1)==1)\r\n % Qty of BS_ptr must be 1\r\n mconvCH=conv2(b,[5 5 5 5 5;5 1 1 1 5;5 5 5 5 5],'same');\r\n mconvCV=conv2(b',[5 5 5 5 5;5 1 1 1 5;5 5 5 5 5],'same');\r\n CS_ptr=[find(mconvCH==3);find(mconvCV==3)];\r\n assert(size(CS_ptr,1)==2)\r\n % Qty of CS_ptr must be 2\r\n mconvDH=conv2(b,[5 5 5 5;5 1 1 5;5 5 5 5],'same');\r\n mconvDV=conv2(b',[5 5 5 5;5 1 1 5;5 5 5 5],'same');\r\n DS_ptr=[find(mconvDH==2);find(mconvDV==2)];\r\n assert(size(DS_ptr,1)==3)\r\n % Qty of DS_ptr must be 3\r\ntoc\r\n%%\r\nglobal tt\r\nm=zeros(12);\r\nm(2:end-1,2:end-1)=7;\r\n\r\n% December 2013 6-Admiral\r\nr=[0 5 1 0 3 0 1 5 2 3 0 0]';\r\nc=[0 0 4 2 5 2 1 2 1 1 2 0];\r\nm(2,10)=0;\r\nm(8,7)=0;\r\nm(10,5)=1;\r\n\r\ntz=tt; % anti-cheat\r\ntic\r\ntime0=cputime;\r\nb=solve_battleship(m,r,c);\r\ntt=tz+cputime-time0\r\n%toc\r\n\r\n\r\nb(b\u003e1)=0;\r\nb(b\u003c0)=0;\r\n\r\nbr=sum(b,2);\r\nbc=sum(b);\r\n\r\nassert(isequal(r,br))\r\nassert(isequal(c,bc))\r\n\r\n% find battleship,cruisers,destroyers,subs\r\n% conv2 to locate pieces\r\n% bsh,bsv\r\n% ch,cv,dh,dv,s\r\n mconvsub=conv2(b,[2 2 2;2 1 2;2 2 2],'same');\r\n subs_ptr=find(mconvsub==1); % Isolated valid subs\r\n assert(size(subs_ptr,1)==4)\r\n % Qty of subs_ptr must be 4\r\n mconvBH=conv2(b,[5 5 5 5 5 5;5 1 1 1 1 5;5 5 5 5 5 5],'same');\r\n mconvBV=conv2(b',[5 5 5 5 5 5;5 1 1 1 1 5;5 5 5 5 5 5],'same');\r\n BS_ptr=[find(mconvBH==4);find(mconvBV==4)];\r\n assert(size(BS_ptr,1)==1)\r\n % Qty of BS_ptr must be 1\r\n mconvCH=conv2(b,[5 5 5 5 5;5 1 1 1 5;5 5 5 5 5],'same');\r\n mconvCV=conv2(b',[5 5 5 5 5;5 1 1 1 5;5 5 5 5 5],'same');\r\n CS_ptr=[find(mconvCH==3);find(mconvCV==3)];\r\n assert(size(CS_ptr,1)==2)\r\n % Qty of CS_ptr must be 2\r\n mconvDH=conv2(b,[5 5 5 5;5 1 1 5;5 5 5 5],'same');\r\n mconvDV=conv2(b',[5 5 5 5;5 1 1 5;5 5 5 5],'same');\r\n DS_ptr=[find(mconvDH==2);find(mconvDV==2)];\r\n assert(size(DS_ptr,1)==3)\r\n % Qty of DS_ptr must be 3\r\ntoc\r\n%%\r\nglobal tt\r\nm=zeros(12);\r\nm(2:end-1,2:end-1)=7;\r\n\r\n% September 2013 1-Seaman\r\nr=[0 1 1 2 4 1 0 2 2 5 2 0]';\r\nc=[0 1 1 1 1 4 0 7 0 2 3 0];\r\nm(2,8)=0;\r\nm(8,3)=1;\r\nm(9,6)=0;\r\nm(5,11)=6;\r\n\r\ntz=tt; % anti-cheat\r\ntic\r\ntime0=cputime;\r\nb=solve_battleship(m,r,c);\r\ntt=tz+cputime-time0\r\n%toc\r\n\r\n\r\nb(b\u003e1)=0;\r\nb(b\u003c0)=0;\r\n\r\nbr=sum(b,2);\r\nbc=sum(b);\r\n\r\nassert(isequal(r,br))\r\nassert(isequal(c,bc))\r\n\r\n% find battleship,cruisers,destroyers,subs\r\n% conv2 to locate pieces\r\n% bsh,bsv\r\n% ch,cv,dh,dv,s\r\n mconvsub=conv2(b,[2 2 2;2 1 2;2 2 2],'same');\r\n subs_ptr=find(mconvsub==1); % Isolated valid subs\r\n assert(size(subs_ptr,1)==4)\r\n % Qty of subs_ptr must be 4\r\n mconvBH=conv2(b,[5 5 5 5 5 5;5 1 1 1 1 5;5 5 5 5 5 5],'same');\r\n mconvBV=conv2(b',[5 5 5 5 5 5;5 1 1 1 1 5;5 5 5 5 5 5],'same');\r\n BS_ptr=[find(mconvBH==4);find(mconvBV==4)];\r\n assert(size(BS_ptr,1)==1)\r\n % Qty of BS_ptr must be 1\r\n mconvCH=conv2(b,[5 5 5 5 5;5 1 1 1 5;5 5 5 5 5],'same');\r\n mconvCV=conv2(b',[5 5 5 5 5;5 1 1 1 5;5 5 5 5 5],'same');\r\n CS_ptr=[find(mconvCH==3);find(mconvCV==3)];\r\n assert(size(CS_ptr,1)==2)\r\n % Qty of CS_ptr must be 2\r\n mconvDH=conv2(b,[5 5 5 5;5 1 1 5;5 5 5 5],'same');\r\n mconvDV=conv2(b',[5 5 5 5;5 1 1 5;5 5 5 5],'same');\r\n DS_ptr=[find(mconvDH==2);find(mconvDV==2)];\r\n assert(size(DS_ptr,1)==3)\r\n % Qty of DS_ptr must be 3\r\ntoc\r\n%%\r\nglobal tt\r\nm=zeros(12);\r\nm(2:end-1,2:end-1)=7;\r\n\r\n% September 2013 2-Petty\r\nr=[0 5 1 4 1 0 5 1 2 1 0 0]';\r\nc=[0 2 3 3 2 0 5 0 3 1 1 0];\r\nm(9,2)=1;\r\nm(2,7)=0;\r\nm(3,9)=1;\r\n\r\ntz=tt; % anti-cheat\r\ntic\r\ntime0=cputime;\r\nb=solve_battleship(m,r,c);\r\ntt=tz+cputime-time0\r\n%toc\r\n\r\n\r\nb(b\u003e1)=0;\r\nb(b\u003c0)=0;\r\n\r\nbr=sum(b,2);\r\nbc=sum(b);\r\n\r\nassert(isequal(r,br))\r\nassert(isequal(c,bc))\r\n\r\n% find battleship,cruisers,destroyers,subs\r\n% conv2 to locate pieces\r\n% bsh,bsv\r\n% ch,cv,dh,dv,s\r\n mconvsub=conv2(b,[2 2 2;2 1 2;2 2 2],'same');\r\n subs_ptr=find(mconvsub==1); % Isolated valid subs\r\n assert(size(subs_ptr,1)==4)\r\n % Qty of subs_ptr must be 4\r\n mconvBH=conv2(b,[5 5 5 5 5 5;5 1 1 1 1 5;5 5 5 5 5 5],'same');\r\n mconvBV=conv2(b',[5 5 5 5 5 5;5 1 1 1 1 5;5 5 5 5 5 5],'same');\r\n BS_ptr=[find(mconvBH==4);find(mconvBV==4)];\r\n assert(size(BS_ptr,1)==1)\r\n % Qty of BS_ptr must be 1\r\n mconvCH=conv2(b,[5 5 5 5 5;5 1 1 1 5;5 5 5 5 5],'same');\r\n mconvCV=conv2(b',[5 5 5 5 5;5 1 1 1 5;5 5 5 5 5],'same');\r\n CS_ptr=[find(mconvCH==3);find(mconvCV==3)];\r\n assert(size(CS_ptr,1)==2)\r\n % Qty of CS_ptr must be 2\r\n mconvDH=conv2(b,[5 5 5 5;5 1 1 5;5 5 5 5],'same');\r\n mconvDV=conv2(b',[5 5 5 5;5 1 1 5;5 5 5 5],'same');\r\n DS_ptr=[find(mconvDH==2);find(mconvDV==2)];\r\n assert(size(DS_ptr,1)==3)\r\n % Qty of DS_ptr must be 3\r\ntoc\r\n%%\r\nglobal tt\r\nm=zeros(12);\r\nm(2:end-1,2:end-1)=7;\r\n\r\n% September 2013 3-Ensign\r\nr=[0 3 0 2 3 1 1 2 2 2 4 0]';\r\nc=[0 1 1 0 6 1 4 0 3 1 3 0];\r\nm(4,3)=0;\r\nm(5,6)=4;\r\nm(7,9)=6;\r\n\r\ntz=tt; % anti-cheat\r\ntic\r\ntime0=cputime;\r\nb=solve_battleship(m,r,c);\r\ntt=tz+cputime-time0\r\n%toc\r\n\r\n\r\nb(b\u003e1)=0;\r\nb(b\u003c0)=0;\r\n\r\nbr=sum(b,2);\r\nbc=sum(b);\r\n\r\nassert(isequal(r,br))\r\nassert(isequal(c,bc))\r\n\r\n% find battleship,cruisers,destroyers,subs\r\n% conv2 to locate pieces\r\n% bsh,bsv\r\n% ch,cv,dh,dv,s\r\n mconvsub=conv2(b,[2 2 2;2 1 2;2 2 2],'same');\r\n subs_ptr=find(mconvsub==1); % Isolated valid subs\r\n assert(size(subs_ptr,1)==4)\r\n % Qty of subs_ptr must be 4\r\n mconvBH=conv2(b,[5 5 5 5 5 5;5 1 1 1 1 5;5 5 5 5 5 5],'same');\r\n mconvBV=conv2(b',[5 5 5 5 5 5;5 1 1 1 1 5;5 5 5 5 5 5],'same');\r\n BS_ptr=[find(mconvBH==4);find(mconvBV==4)];\r\n assert(size(BS_ptr,1)==1)\r\n % Qty of BS_ptr must be 1\r\n mconvCH=conv2(b,[5 5 5 5 5;5 1 1 1 5;5 5 5 5 5],'same');\r\n mconvCV=conv2(b',[5 5 5 5 5;5 1 1 1 5;5 5 5 5 5],'same');\r\n CS_ptr=[find(mconvCH==3);find(mconvCV==3)];\r\n assert(size(CS_ptr,1)==2)\r\n % Qty of CS_ptr must be 2\r\n mconvDH=conv2(b,[5 5 5 5;5 1 1 5;5 5 5 5],'same');\r\n mconvDV=conv2(b',[5 5 5 5;5 1 1 5;5 5 5 5],'same');\r\n DS_ptr=[find(mconvDH==2);find(mconvDV==2)];\r\n assert(size(DS_ptr,1)==3)\r\n % Qty of DS_ptr must be 3\r\ntoc\r\n%%\r\nglobal tt\r\nm=zeros(12);\r\nm(2:end-1,2:end-1)=7;\r\n\r\n% September 2013 4-Captain\r\nr=[0 0 6 0 2 2 4 1 3 2 0 0]';\r\nc=[0 3 1 3 1 2 2 2 2 0 4 0];\r\nm(5,2)=0;\r\nm(9,4)=0;\r\nm(3,5)=4;\r\nm(6,11)=2;\r\nm(8,11)=3;\r\n\r\ntz=tt; % anti-cheat\r\ntic\r\ntime0=cputime;\r\nb=solve_battleship(m,r,c);\r\ntt=tz+cputime-time0\r\n%toc\r\n\r\n\r\nb(b\u003e1)=0;\r\nb(b\u003c0)=0;\r\n\r\nbr=sum(b,2);\r\nbc=sum(b);\r\n\r\nassert(isequal(r,br))\r\nassert(isequal(c,bc))\r\n\r\n% find battleship,cruisers,destroyers,subs\r\n% conv2 to locate pieces\r\n% bsh,bsv\r\n% ch,cv,dh,dv,s\r\n mconvsub=conv2(b,[2 2 2;2 1 2;2 2 2],'same');\r\n subs_ptr=find(mconvsub==1); % Isolated valid subs\r\n assert(size(subs_ptr,1)==4)\r\n % Qty of subs_ptr must be 4\r\n mconvBH=conv2(b,[5 5 5 5 5 5;5 1 1 1 1 5;5 5 5 5 5 5],'same');\r\n mconvBV=conv2(b',[5 5 5 5 5 5;5 1 1 1 1 5;5 5 5 5 5 5],'same');\r\n BS_ptr=[find(mconvBH==4);find(mconvBV==4)];\r\n assert(size(BS_ptr,1)==1)\r\n % Qty of BS_ptr must be 1\r\n mconvCH=conv2(b,[5 5 5 5 5;5 1 1 1 5;5 5 5 5 5],'same');\r\n mconvCV=conv2(b',[5 5 5 5 5;5 1 1 1 5;5 5 5 5 5],'same');\r\n CS_ptr=[find(mconvCH==3);find(mconvCV==3)];\r\n assert(size(CS_ptr,1)==2)\r\n % Qty of CS_ptr must be 2\r\n mconvDH=conv2(b,[5 5 5 5;5 1 1 5;5 5 5 5],'same');\r\n mconvDV=conv2(b',[5 5 5 5;5 1 1 5;5 5 5 5],'same');\r\n DS_ptr=[find(mconvDH==2);find(mconvDV==2)];\r\n assert(size(DS_ptr,1)==3)\r\n % Qty of DS_ptr must be 3\r\ntoc\r\n%%\r\nglobal tt\r\nm=zeros(12);\r\nm(2:end-1,2:end-1)=7;\r\n\r\n% September 2013 5-Commodore %\r\nr=[0 5 2 1 1 7 1 2 0 0 1 0]';\r\nc=[0 2 3 1 2 1 3 1 2 0 5 0];\r\nm(8,2)=1;\r\nm(5,11)=2;\r\n\r\ntz=tt; % anti-cheat\r\ntic\r\ntime0=cputime;\r\nb=solve_battleship(m,r,c);\r\ntt=tz+cputime-time0\r\n%toc\r\n\r\n\r\nb(b\u003e1)=0;\r\nb(b\u003c0)=0;\r\n\r\nbr=sum(b,2);\r\nbc=sum(b);\r\n\r\nassert(isequal(r,br))\r\nassert(isequal(c,bc))\r\n\r\n% find battleship,cruisers,destroyers,subs\r\n% conv2 to locate pieces\r\n% bsh,bsv\r\n% ch,cv,dh,dv,s\r\n mconvsub=conv2(b,[2 2 2;2 1 2;2 2 2],'same');\r\n subs_ptr=find(mconvsub==1); % Isolated valid subs\r\n assert(size(subs_ptr,1)==4)\r\n % Qty of subs_ptr must be 4\r\n mconvBH=conv2(b,[5 5 5 5 5 5;5 1 1 1 1 5;5 5 5 5 5 5],'same');\r\n mconvBV=conv2(b',[5 5 5 5 5 5;5 1 1 1 1 5;5 5 5 5 5 5],'same');\r\n BS_ptr=[find(mconvBH==4);find(mconvBV==4)];\r\n assert(size(BS_ptr,1)==1)\r\n % Qty of BS_ptr must be 1\r\n mconvCH=conv2(b,[5 5 5 5 5;5 1 1 1 5;5 5 5 5 5],'same');\r\n mconvCV=conv2(b',[5 5 5 5 5;5 1 1 1 5;5 5 5 5 5],'same');\r\n CS_ptr=[find(mconvCH==3);find(mconvCV==3)];\r\n assert(size(CS_ptr,1)==2)\r\n % Qty of CS_ptr must be 2\r\n mconvDH=conv2(b,[5 5 5 5;5 1 1 5;5 5 5 5],'same');\r\n mconvDV=conv2(b',[5 5 5 5;5 1 1 5;5 5 5 5],'same');\r\n DS_ptr=[find(mconvDH==2);find(mconvDV==2)];\r\n assert(size(DS_ptr,1)==3)\r\n % Qty of DS_ptr must be 3\r\ntoc\r\n%%\r\nglobal tt\r\nm=zeros(12);\r\nm(2:end-1,2:end-1)=7;\r\n\r\n% September 2013 6-Admiral % Solved with with Bship HV .10 \r\n% solved recur .023\r\nr=[0 0 2 4 1 4 1 0 2 0 6 0]';\r\nc=[0 3 1 3 1 3 2 1 2 1 3 0];\r\nm(3,2)=0;\r\nm(4,5)=4;\r\nm(9,9)=5;\r\n\r\ntz=tt; % anti-cheat\r\ntic\r\ntime0=cputime;\r\nb=solve_battleship(m,r,c);\r\ntt=tz+cputime-time0\r\n%toc\r\n\r\n\r\nb(b\u003e1)=0;\r\nb(b\u003c0)=0;\r\n\r\nbr=sum(b,2);\r\nbc=sum(b);\r\n\r\nassert(isequal(r,br))\r\nassert(isequal(c,bc))\r\n\r\n% find battleship,cruisers,destroyers,subs\r\n% conv2 to locate pieces\r\n% bsh,bsv\r\n% ch,cv,dh,dv,s\r\n mconvsub=conv2(b,[2 2 2;2 1 2;2 2 2],'same');\r\n subs_ptr=find(mconvsub==1); % Isolated valid subs\r\n assert(size(subs_ptr,1)==4)\r\n % Qty of subs_ptr must be 4\r\n mconvBH=conv2(b,[5 5 5 5 5 5;5 1 1 1 1 5;5 5 5 5 5 5],'same');\r\n mconvBV=conv2(b',[5 5 5 5 5 5;5 1 1 1 1 5;5 5 5 5 5 5],'same');\r\n BS_ptr=[find(mconvBH==4);find(mconvBV==4)];\r\n assert(size(BS_ptr,1)==1)\r\n % Qty of BS_ptr must be 1\r\n mconvCH=conv2(b,[5 5 5 5 5;5 1 1 1 5;5 5 5 5 5],'same');\r\n mconvCV=conv2(b',[5 5 5 5 5;5 1 1 1 5;5 5 5 5 5],'same');\r\n CS_ptr=[find(mconvCH==3);find(mconvCV==3)];\r\n assert(size(CS_ptr,1)==2)\r\n % Qty of CS_ptr must be 2\r\n mconvDH=conv2(b,[5 5 5 5;5 1 1 5;5 5 5 5],'same');\r\n mconvDV=conv2(b',[5 5 5 5;5 1 1 5;5 5 5 5],'same');\r\n DS_ptr=[find(mconvDH==2);find(mconvDV==2)];\r\n assert(size(DS_ptr,1)==3)\r\n % Qty of DS_ptr must be 3\r\ntoc\r\n%%\r\nglobal tt\r\ntt\r\nassignin('caller','score',min(2000,floor(1000*tt)));","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":3097,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":3,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2013-11-17T23:26:01.000Z","updated_at":"2013-11-18T00:27:11.000Z","published_at":"2013-11-18T00:27:11.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:hyperlink w:docLocation=\\\"http://www.conceptispuzzles.com/index.aspx?uri=puzzle/battleships\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eGames Magazine Battleships\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e is a logic puzzle to find the Fleet given some map information and the number of Ship cells in every column and row. The fleet is made of a Battleship(4), two Cruisers(3), three Destroyers(2), and four Submarines(1). Thus the total filled cells is 20.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis Challenge is to complete three full sets of Battleship in minimal time.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eMap information contains Water(0), Subs(1), Middle of a ship(6), Unknown(7), and the Aft(rear) of a ship. Ship going Up(2), Down(3), Left(4), and Right(5).\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eShips have no diagonal or UDLR adjacency. The best way in Seaman to deal with Midship segments is to determine where it can not go to determine an orientation.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe map is ringed by zeros to make m a 12x12 array.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eInput:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e m,r,c; m 12x12 of map values, r(12,1) of row sums, c(1,12) of col sums\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eOutput:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e b; A binary 12x12 array\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eScoring:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e Total Time (msec)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eExample:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[r=[0 2 0 2 2 2 3 2 3 0 4 0]';\\nc=[0 4 0 3 1 3 1 4 0 1 3 0];\\n\\nm              b\\n000000000000  000000000000\\n077757777770  000011000000\\n077777777770  000000000000\\n077777777770  000100010000\\n077777777770  000100010000\\n077777777770  010000010000\\n077777777770  010000010010\\n027777777760  010000000010\\n077777777770  000101000010\\n077777777770  000000000000\\n077777477770  010001100100\\n000000000000  000000000000]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eAlgorithm:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[1) Initialize processing array based upon input matrix.\\n2) Implement a cycling check of driven array changes\\n3) Quick Test of Change every single Unknown serially\\n4) Evolve and check if complete solution created\\n5) Robustly recursively check all potential Battleships, Cruisers, Destroyers, Subs]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"}],"problem_search":{"errors":[],"problems":[{"id":1982,"title":"Battleship - Seaman Level","description":"\u003chttp://www.conceptispuzzles.com/index.aspx?uri=puzzle/battleships Games Magazine Battleships\u003e is a logic puzzle to find the Fleet given some map information and the number of Ship cells in every column and row. The fleet is made of a Battleship(4), two Cruisers(3), three Destroyers(2), and four Submarines(1). Thus the total filled cells is 20.\r\n\r\nThe Seaman Level is the simplest and can be solved by direct evolution of current condition.\r\n\r\nMap information contains Water(0), Subs(1), Middle of a ship(6), Unknown(7), and the Aft(rear) of a ship. Ship going Up(2), Down(3), Left(4), and Right(5).\r\n\r\nShips have no diagonal or UDLR adjacency.  The best way in Seaman to deal with Midship segments is to determine where it can not go to determine an orientation.\r\n\r\nThe map is ringed by zeros to make m a 12x12 array.\r\n\r\n*Input:* m,r,c;  m 12x12 of map values, r(12,1) of row sums, c(1,12) of col sums\r\n\r\n*Output:* b; A binary 12x12 array\r\n\r\n*Example:*\r\n\r\n  r=[0 2 0 2 2 2 3 2 3 0 4 0]';\r\n  c=[0 4 0 3 1 3 1 4 0 1 3 0];\r\n  \r\n  m              b\r\n  000000000000  000000000000\r\n  077757777770  000011000000\r\n  077777777770  000000000000\r\n  077777777770  000100010000\r\n  077777777770  000100010000\r\n  077777777770  010000010000\r\n  077777777770  010000010010\r\n  027777777760  010000000010\r\n  077777777770  000101000010\r\n  077777777770  000000000000\r\n  077777477770  010001100100\r\n  000000000000  000000000000\r\n\r\n*Future:* The example is a Level-4 Captain board. The future holds less explicit boards that will require recursion methods.","description_html":"\u003cp\u003e\u003ca href = \"http://www.conceptispuzzles.com/index.aspx?uri=puzzle/battleships\"\u003eGames Magazine Battleships\u003c/a\u003e is a logic puzzle to find the Fleet given some map information and the number of Ship cells in every column and row. The fleet is made of a Battleship(4), two Cruisers(3), three Destroyers(2), and four Submarines(1). Thus the total filled cells is 20.\u003c/p\u003e\u003cp\u003eThe Seaman Level is the simplest and can be solved by direct evolution of current condition.\u003c/p\u003e\u003cp\u003eMap information contains Water(0), Subs(1), Middle of a ship(6), Unknown(7), and the Aft(rear) of a ship. Ship going Up(2), Down(3), Left(4), and Right(5).\u003c/p\u003e\u003cp\u003eShips have no diagonal or UDLR adjacency.  The best way in Seaman to deal with Midship segments is to determine where it can not go to determine an orientation.\u003c/p\u003e\u003cp\u003eThe map is ringed by zeros to make m a 12x12 array.\u003c/p\u003e\u003cp\u003e\u003cb\u003eInput:\u003c/b\u003e m,r,c;  m 12x12 of map values, r(12,1) of row sums, c(1,12) of col sums\u003c/p\u003e\u003cp\u003e\u003cb\u003eOutput:\u003c/b\u003e b; A binary 12x12 array\u003c/p\u003e\u003cp\u003e\u003cb\u003eExample:\u003c/b\u003e\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003er=[0 2 0 2 2 2 3 2 3 0 4 0]';\r\nc=[0 4 0 3 1 3 1 4 0 1 3 0];\r\n\u003c/pre\u003e\u003cpre class=\"language-matlab\"\u003em              b\r\n000000000000  000000000000\r\n077757777770  000011000000\r\n077777777770  000000000000\r\n077777777770  000100010000\r\n077777777770  000100010000\r\n077777777770  010000010000\r\n077777777770  010000010010\r\n027777777760  010000000010\r\n077777777770  000101000010\r\n077777777770  000000000000\r\n077777477770  010001100100\r\n000000000000  000000000000\r\n\u003c/pre\u003e\u003cp\u003e\u003cb\u003eFuture:\u003c/b\u003e The example is a Level-4 Captain board. The future holds less explicit boards that will require recursion methods.\u003c/p\u003e","function_template":"function b=solve_battleship(m,r,c)\r\n% WSUDLRMX 0W 1S 2U 3D 4L 5R 6M 7X\r\n% Surround 10x10 with ring of zeros\r\n% r : RowSum Vector [12,1]\r\n% c : ColSum Vector [1,12]\r\n b=zeros(12);\r\nend","test_suite":"%%\r\nm=zeros(12);\r\nm(2:end-1,2:end-1)=7;\r\n% Games August 2013 1-Seaman\r\nr=[0 2 2 3 1 1 1 1 2 2 5 0]';\r\nc=[0 1 0 1 1 2 6 0 5 0 4 0];\r\nm(2,2)=1;\r\nm(2,6)=1;\r\nm(4,9)=3;\r\n\r\ntic\r\nb=solve_battleship(m,r,c);\r\ntoc\r\n\r\nb(b\u003e1)=0;\r\nb(b\u003c0)=0;\r\n\r\nbr=sum(b,2);\r\nbc=sum(b);\r\n\r\nassert(isequal(r,br))\r\nassert(isequal(c,bc))\r\n\r\n% find battleship,cruisers,destroyers,subs\r\n% conv2 to locate pieces\r\n% bsh,bsv\r\n% ch,cv,dh,dv,s\r\n mconvsub=conv2(b,[2 2 2;2 1 2;2 2 2],'same');\r\n subs_ptr=find(mconvsub==1); % Isolated valid subs\r\n assert(size(subs_ptr,1)==4)\r\n % Qty of subs_ptr must be 4\r\n mconvBH=conv2(b,[5 5 5 5 5 5;5 1 1 1 1 5;5 5 5 5 5 5],'same');\r\n mconvBV=conv2(b',[5 5 5 5 5 5;5 1 1 1 1 5;5 5 5 5 5 5],'same');\r\n BS_ptr=[find(mconvBH==4);find(mconvBV==4)];\r\n assert(size(BS_ptr,1)==1)\r\n % Qty of BS_ptr must be 1\r\n mconvCH=conv2(b,[5 5 5 5 5;5 1 1 1 5;5 5 5 5 5],'same');\r\n mconvCV=conv2(b',[5 5 5 5 5;5 1 1 1 5;5 5 5 5 5],'same');\r\n CS_ptr=[find(mconvCH==3);find(mconvCV==3)];\r\n assert(size(CS_ptr,1)==2)\r\n % Qty of CS_ptr must be 2\r\n mconvDH=conv2(b,[5 5 5 5;5 1 1 5;5 5 5 5],'same');\r\n mconvDV=conv2(b',[5 5 5 5;5 1 1 5;5 5 5 5],'same');\r\n DS_ptr=[find(mconvDH==2);find(mconvDV==2)];\r\n assert(size(DS_ptr,1)==3)\r\n % Qty of DS_ptr must be 3\r\ntoc\r\n\r\n%%\r\nm=zeros(12);\r\nm(2:end-1,2:end-1)=7;\r\n\r\n% December 2013 1-Seaman \r\n r=[0 1 1 1 1 2 3 3 3 1 4 0]';\r\n c=[0 3 2 0 1 6 0 3 1 4 0 0];\r\n m(2,3)=1;\r\n m(8,5)=1;\r\n m(7,8)=6;\r\n\r\ntic\r\nb=solve_battleship(m,r,c);\r\ntoc\r\n\r\nb(b\u003e1)=0;\r\nb(b\u003c0)=0;\r\n\r\nbr=sum(b,2);\r\nbc=sum(b);\r\n\r\nassert(isequal(r,br))\r\nassert(isequal(c,bc))\r\n\r\n% find battleship,cruisers,destroyers,subs\r\n% conv2 to locate pieces\r\n% bsh,bsv\r\n% ch,cv,dh,dv,s\r\n mconvsub=conv2(b,[2 2 2;2 1 2;2 2 2],'same');\r\n subs_ptr=find(mconvsub==1); % Isolated valid subs\r\n assert(size(subs_ptr,1)==4)\r\n % Qty of subs_ptr must be 4\r\n mconvBH=conv2(b,[5 5 5 5 5 5;5 1 1 1 1 5;5 5 5 5 5 5],'same');\r\n mconvBV=conv2(b',[5 5 5 5 5 5;5 1 1 1 1 5;5 5 5 5 5 5],'same');\r\n BS_ptr=[find(mconvBH==4);find(mconvBV==4)];\r\n assert(size(BS_ptr,1)==1)\r\n % Qty of BS_ptr must be 1\r\n mconvCH=conv2(b,[5 5 5 5 5;5 1 1 1 5;5 5 5 5 5],'same');\r\n mconvCV=conv2(b',[5 5 5 5 5;5 1 1 1 5;5 5 5 5 5],'same');\r\n CS_ptr=[find(mconvCH==3);find(mconvCV==3)];\r\n assert(size(CS_ptr,1)==2)\r\n % Qty of CS_ptr must be 2\r\n mconvDH=conv2(b,[5 5 5 5;5 1 1 5;5 5 5 5],'same');\r\n mconvDV=conv2(b',[5 5 5 5;5 1 1 5;5 5 5 5],'same');\r\n DS_ptr=[find(mconvDH==2);find(mconvDV==2)];\r\n assert(size(DS_ptr,1)==3)\r\n % Qty of DS_ptr must be 3\r\ntoc\r\n\r\n%%\r\nm=zeros(12);\r\nm(2:end-1,2:end-1)=7;\r\n\r\n% September 2013 1-Seaman\r\n r=[0 1 1 2 4 1 0 2 2 5 2 0]';\r\n c=[0 1 1 1 1 4 0 7 0 2 3 0];\r\n m(2,8)=0;\r\n m(8,3)=1;\r\n m(9,6)=0;\r\n m(5,11)=6;\r\n\r\ntic\r\nb=solve_battleship(m,r,c);\r\ntoc\r\n\r\nb(b\u003e1)=0;\r\nb(b\u003c0)=0;\r\n\r\nbr=sum(b,2);\r\nbc=sum(b);\r\n\r\nassert(isequal(r,br))\r\nassert(isequal(c,bc))\r\n\r\n% find battleship,cruisers,destroyers,subs\r\n% conv2 to locate pieces\r\n% bsh,bsv\r\n% ch,cv,dh,dv,s\r\n mconvsub=conv2(b,[2 2 2;2 1 2;2 2 2],'same');\r\n subs_ptr=find(mconvsub==1); % Isolated valid subs\r\n assert(size(subs_ptr,1)==4)\r\n % Qty of subs_ptr must be 4\r\n mconvBH=conv2(b,[5 5 5 5 5 5;5 1 1 1 1 5;5 5 5 5 5 5],'same');\r\n mconvBV=conv2(b',[5 5 5 5 5 5;5 1 1 1 1 5;5 5 5 5 5 5],'same');\r\n BS_ptr=[find(mconvBH==4);find(mconvBV==4)];\r\n assert(size(BS_ptr,1)==1)\r\n % Qty of BS_ptr must be 1\r\n mconvCH=conv2(b,[5 5 5 5 5;5 1 1 1 5;5 5 5 5 5],'same');\r\n mconvCV=conv2(b',[5 5 5 5 5;5 1 1 1 5;5 5 5 5 5],'same');\r\n CS_ptr=[find(mconvCH==3);find(mconvCV==3)];\r\n assert(size(CS_ptr,1)==2)\r\n % Qty of CS_ptr must be 2\r\n mconvDH=conv2(b,[5 5 5 5;5 1 1 5;5 5 5 5],'same');\r\n mconvDV=conv2(b',[5 5 5 5;5 1 1 5;5 5 5 5],'same');\r\n DS_ptr=[find(mconvDH==2);find(mconvDV==2)];\r\n assert(size(DS_ptr,1)==3)\r\n % Qty of DS_ptr must be 3\r\ntoc\r\n\r\n\r\n","published":true,"deleted":false,"likes_count":0,"comments_count":0,"created_by":3097,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":3,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2013-11-12T05:17:43.000Z","updated_at":"2013-11-12T06:14:18.000Z","published_at":"2013-11-12T06:14:18.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:hyperlink w:docLocation=\\\"http://www.conceptispuzzles.com/index.aspx?uri=puzzle/battleships\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eGames Magazine Battleships\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e is a logic puzzle to find the Fleet given some map information and the number of Ship cells in every column and row. The fleet is made of a Battleship(4), two Cruisers(3), three Destroyers(2), and four Submarines(1). Thus the total filled cells is 20.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe Seaman Level is the simplest and can be solved by direct evolution of current condition.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eMap information contains Water(0), Subs(1), Middle of a ship(6), Unknown(7), and the Aft(rear) of a ship. Ship going Up(2), Down(3), Left(4), and Right(5).\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eShips have no diagonal or UDLR adjacency. The best way in Seaman to deal with Midship segments is to determine where it can not go to determine an orientation.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe map is ringed by zeros to make m a 12x12 array.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eInput:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e m,r,c; m 12x12 of map values, r(12,1) of row sums, c(1,12) of col sums\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eOutput:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e b; A binary 12x12 array\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eExample:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[r=[0 2 0 2 2 2 3 2 3 0 4 0]';\\nc=[0 4 0 3 1 3 1 4 0 1 3 0];\\n\\nm              b\\n000000000000  000000000000\\n077757777770  000011000000\\n077777777770  000000000000\\n077777777770  000100010000\\n077777777770  000100010000\\n077777777770  010000010000\\n077777777770  010000010010\\n027777777760  010000000010\\n077777777770  000101000010\\n077777777770  000000000000\\n077777477770  010001100100\\n000000000000  000000000000]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eFuture:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e The example is a Level-4 Captain board. The future holds less explicit boards that will require recursion methods.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":2004,"title":"BattleShip - Petty Officer (Level 2)","description":"\u003chttp://www.conceptispuzzles.com/index.aspx?uri=puzzle/battleships Games Magazine Battleships\u003e is a logic puzzle to find the Fleet given some map information and the number of Ship cells in every column and row. The fleet is made of a Battleship(4), two Cruisers(3), three Destroyers(2), and four Submarines(1). Thus the total filled cells is 20.\r\n\r\nThe Seaman Level is the simplest and can be solved by direct evolution of current condition. The Petty Officer Level requires just a pinch more effort to solve.\r\n\r\nMap information contains Water(0), Subs(1), Middle of a ship(6), Unknown(7), and the Aft(rear) of a ship. Ship going Up(2), Down(3), Left(4), and Right(5).\r\n\r\nShips have no diagonal or UDLR adjacency.  The best way in Seaman to deal with Midship segments is to determine where it can not go to determine an orientation.\r\n\r\nThe map is ringed by zeros to make m a 12x12 array.\r\n\r\n*Input:* m,r,c;  m 12x12 of map values, r(12,1) of row sums, c(1,12) of col sums\r\n\r\n*Output:* b; A binary 12x12 array\r\n\r\n*Example:*\r\n\r\n  r=[0 2 0 2 2 2 3 2 3 0 4 0]';\r\n  c=[0 4 0 3 1 3 1 4 0 1 3 0];\r\n  \r\n  m              b\r\n  000000000000  000000000000\r\n  077757777770  000011000000\r\n  077777777770  000000000000\r\n  077777777770  000100010000\r\n  077777777770  000100010000\r\n  077777777770  010000010000\r\n  077777777770  010000010010\r\n  027777777760  010000000010\r\n  077777777770  000101000010\r\n  077777777770  000000000000\r\n  077777477770  010001100100\r\n  000000000000  000000000000\r\n\r\n*Algorithm:* \r\n\r\n  1) Initialize processing array based upon input matrix.\r\n  2) Implement a cycling check of driven array changes\r\n  3) Quick Test of Change every single Unknown serially\r\n  4) Evolve and check if complete solution created","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.4333px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 795.667px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 397.833px; transform-origin: 407px 397.833px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 63px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 31.5px; text-align: left; transform-origin: 384px 31.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003ca target='_blank' href = \"http://www.conceptispuzzles.com/index.aspx?uri=puzzle/battleships\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eGames Magazine Battleships\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 291.35px 7.91667px; transform-origin: 291.35px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e is a logic puzzle to find the Fleet given some map information and the number of Ship cells in every column and row. The fleet is made of a Battleship(4), two Cruisers(3), three Destroyers(2), and four Submarines(1). Thus the total filled cells is 20.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 42px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 21px; text-align: left; transform-origin: 384px 21px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 360.45px 7.91667px; transform-origin: 360.45px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThe Seaman Level is the simplest and can be solved by direct evolution of current condition. The Petty Officer Level requires just a pinch more effort to solve.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 42px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 21px; text-align: left; transform-origin: 384px 21px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 382.1px 7.91667px; transform-origin: 382.1px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eMap information contains Water(0), Subs(1), Middle of a ship(6), Unknown(7), and the Aft(rear) of a ship. Ship going Up(2), Down(3), Left(4), and Right(5).\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 42px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 21px; text-align: left; transform-origin: 384px 21px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 382.267px 7.91667px; transform-origin: 382.267px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eShips have no diagonal or UDLR adjacency. The best way in Seaman to deal with Midship segments is to determine where it can not go to determine an orientation.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 165.183px 7.91667px; transform-origin: 165.183px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThe map is ringed by zeros to make m a 12x12 array.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 19.4333px 7.91667px; transform-origin: 19.4333px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003eInput:\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 220.5px 7.91667px; transform-origin: 220.5px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e m,r,c; m 12x12 of map values, r(12,1) of row sums, c(1,12) of col sums\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 25.2667px 7.91667px; transform-origin: 25.2667px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003eOutput:\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 74.3px 7.91667px; transform-origin: 74.3px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e b; A binary 12x12 array\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 31.1167px 7.91667px; transform-origin: 31.1167px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003eExample:\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgb(247, 247, 247); block-size: 326.933px; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-end-end-radius: 4px; border-end-start-radius: 4px; border-start-end-radius: 4px; border-start-start-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; margin-block-end: 10px; margin-block-start: 10px; margin-bottom: 10px; margin-inline-end: 3px; margin-inline-start: 3px; margin-left: 3px; margin-right: 3px; margin-top: 10px; perspective-origin: 404px 163.467px; transform-origin: 404px 163.467px; margin-left: 3px; margin-top: 10px; margin-bottom: 10px; margin-right: 3px; \"\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 0.833333px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 0.833333px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 0.833333px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 0.833333px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 111.65px 7.91667px; transform-origin: 111.65px 7.91667px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003er=[0 2 0 2 2 2 3 2 3 0 4 0]';\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 0.833333px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 0.833333px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 0.833333px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 0.833333px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 107.8px 7.91667px; transform-origin: 107.8px 7.91667px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003ec=[0 4 0 3 1 3 1 4 0 1 3 0];\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 0.833333px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 0.833333px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 0.833333px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 0.833333px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 0px 7.91667px; transform-origin: 0px 7.91667px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 0.833333px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 0.833333px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 0.833333px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 0.833333px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 61.6px 7.91667px; transform-origin: 61.6px 7.91667px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 57.75px 7.91667px; transform-origin: 57.75px 7.91667px; \"\u003em              \u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(170, 4, 249); border-block-start-color: rgb(170, 4, 249); border-bottom-color: rgb(170, 4, 249); border-inline-end-color: rgb(170, 4, 249); border-inline-start-color: rgb(170, 4, 249); border-left-color: rgb(170, 4, 249); border-right-color: rgb(170, 4, 249); border-top-color: rgb(170, 4, 249); caret-color: rgb(170, 4, 249); color: rgb(170, 4, 249); column-rule-color: rgb(170, 4, 249); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(170, 4, 249); perspective-origin: 3.85px 7.91667px; text-decoration: none; text-decoration-color: rgb(170, 4, 249); text-emphasis-color: rgb(170, 4, 249); transform-origin: 3.85px 7.91667px; \"\u003eb\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 0.833333px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 0.833333px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 0.833333px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 0.833333px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 100.1px 7.91667px; transform-origin: 100.1px 7.91667px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e000000000000  000000000000\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 0.833333px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 0.833333px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 0.833333px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 0.833333px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 100.1px 7.91667px; transform-origin: 100.1px 7.91667px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e077757777770  000011000000\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 0.833333px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 0.833333px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 0.833333px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 0.833333px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 100.1px 7.91667px; transform-origin: 100.1px 7.91667px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e077777777770  000000000000\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 0.833333px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 0.833333px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 0.833333px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 0.833333px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 100.1px 7.91667px; transform-origin: 100.1px 7.91667px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e077777777770  000100010000\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 0.833333px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 0.833333px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 0.833333px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 0.833333px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 100.1px 7.91667px; transform-origin: 100.1px 7.91667px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e077777777770  000100010000\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 0.833333px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 0.833333px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 0.833333px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 0.833333px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 100.1px 7.91667px; transform-origin: 100.1px 7.91667px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e077777777770  010000010000\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 0.833333px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 0.833333px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 0.833333px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 0.833333px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 100.1px 7.91667px; transform-origin: 100.1px 7.91667px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e077777777770  010000010010\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 0.833333px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 0.833333px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 0.833333px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 0.833333px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 100.1px 7.91667px; transform-origin: 100.1px 7.91667px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e027777777760  010000000010\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 0.833333px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 0.833333px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 0.833333px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 0.833333px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 100.1px 7.91667px; transform-origin: 100.1px 7.91667px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e077777777770  000101000010\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 0.833333px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 0.833333px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 0.833333px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 0.833333px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 100.1px 7.91667px; transform-origin: 100.1px 7.91667px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e077777777770  000000000000\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 0.833333px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 0.833333px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 0.833333px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 0.833333px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 100.1px 7.91667px; transform-origin: 100.1px 7.91667px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e077777477770  010001100100\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 0.833333px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 0.833333px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 0.833333px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 0.833333px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 100.1px 7.91667px; transform-origin: 100.1px 7.91667px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e000000000000  000000000000\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 10px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 10px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 10px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 35.3833px 7.91667px; transform-origin: 35.3833px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003eAlgorithm:\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgb(247, 247, 247); block-size: 81.7333px; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-end-end-radius: 4px; border-end-start-radius: 4px; border-start-end-radius: 4px; border-start-start-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; margin-block-end: 10px; margin-block-start: 10px; margin-bottom: 10px; margin-inline-end: 3px; margin-inline-start: 3px; margin-left: 3px; margin-right: 3px; margin-top: 10px; perspective-origin: 404px 40.8667px; transform-origin: 404px 40.8667px; margin-left: 3px; margin-top: 10px; margin-bottom: 10px; margin-right: 3px; \"\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 0.833333px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 0.833333px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 0.833333px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 0.833333px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 211.75px 7.91667px; transform-origin: 211.75px 7.91667px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 53.9px 7.91667px; transform-origin: 53.9px 7.91667px; \"\u003e1) Initialize \u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(170, 4, 249); border-block-start-color: rgb(170, 4, 249); border-bottom-color: rgb(170, 4, 249); border-inline-end-color: rgb(170, 4, 249); border-inline-start-color: rgb(170, 4, 249); border-left-color: rgb(170, 4, 249); border-right-color: rgb(170, 4, 249); border-top-color: rgb(170, 4, 249); caret-color: rgb(170, 4, 249); color: rgb(170, 4, 249); column-rule-color: rgb(170, 4, 249); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(170, 4, 249); perspective-origin: 157.85px 7.91667px; text-decoration: none; text-decoration-color: rgb(170, 4, 249); text-emphasis-color: rgb(170, 4, 249); transform-origin: 157.85px 7.91667px; \"\u003eprocessing array based upon input matrix.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 0.833333px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 0.833333px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 0.833333px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 0.833333px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 200.2px 7.91667px; transform-origin: 200.2px 7.91667px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 50.05px 7.91667px; transform-origin: 50.05px 7.91667px; \"\u003e2) Implement \u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(170, 4, 249); border-block-start-color: rgb(170, 4, 249); border-bottom-color: rgb(170, 4, 249); border-inline-end-color: rgb(170, 4, 249); border-inline-start-color: rgb(170, 4, 249); border-left-color: rgb(170, 4, 249); border-right-color: rgb(170, 4, 249); border-top-color: rgb(170, 4, 249); caret-color: rgb(170, 4, 249); color: rgb(170, 4, 249); column-rule-color: rgb(170, 4, 249); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(170, 4, 249); perspective-origin: 150.15px 7.91667px; text-decoration: none; text-decoration-color: rgb(170, 4, 249); text-emphasis-color: rgb(170, 4, 249); transform-origin: 150.15px 7.91667px; \"\u003ea cycling check of driven array changes\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 0.833333px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 0.833333px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 0.833333px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 0.833333px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 204.05px 7.91667px; transform-origin: 204.05px 7.91667px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 34.65px 7.91667px; transform-origin: 34.65px 7.91667px; \"\u003e3) Quick \u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(170, 4, 249); border-block-start-color: rgb(170, 4, 249); border-bottom-color: rgb(170, 4, 249); border-inline-end-color: rgb(170, 4, 249); border-inline-start-color: rgb(170, 4, 249); border-left-color: rgb(170, 4, 249); border-right-color: rgb(170, 4, 249); border-top-color: rgb(170, 4, 249); caret-color: rgb(170, 4, 249); color: rgb(170, 4, 249); column-rule-color: rgb(170, 4, 249); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(170, 4, 249); perspective-origin: 169.4px 7.91667px; text-decoration: none; text-decoration-color: rgb(170, 4, 249); text-emphasis-color: rgb(170, 4, 249); transform-origin: 169.4px 7.91667px; \"\u003eTest of Change every single Unknown serially\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 0.833333px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 0.833333px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 0.833333px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 0.833333px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 184.8px 7.91667px; transform-origin: 184.8px 7.91667px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 38.5px 7.91667px; transform-origin: 38.5px 7.91667px; \"\u003e4) Evolve \u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(170, 4, 249); border-block-start-color: rgb(170, 4, 249); border-bottom-color: rgb(170, 4, 249); border-inline-end-color: rgb(170, 4, 249); border-inline-start-color: rgb(170, 4, 249); border-left-color: rgb(170, 4, 249); border-right-color: rgb(170, 4, 249); border-top-color: rgb(170, 4, 249); caret-color: rgb(170, 4, 249); color: rgb(170, 4, 249); column-rule-color: rgb(170, 4, 249); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(170, 4, 249); perspective-origin: 146.3px 7.91667px; text-decoration: none; text-decoration-color: rgb(170, 4, 249); text-emphasis-color: rgb(170, 4, 249); transform-origin: 146.3px 7.91667px; \"\u003eand check if complete solution created\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function b=solve_battleship(m,r,c)\r\n% WSUDLRMX 0W 1S 2U 3D 4L 5R 6M 7X\r\n% Surround 10x10 with ring of zeros\r\n% r : RowSum Vector [12,1]\r\n% c : ColSum Vector [1,12]\r\n b=zeros(12);\r\nend","test_suite":"%%\r\nglobal valid\r\nfiletext = fileread('solve_battleship.m');\r\nvalid=isempty(strfind(filetext, '(exist(fullfile(cd'));\r\nassert(valid,'overwrite assert forbidden')\r\n%%\r\nglobal valid\r\nm=zeros(12);\r\nm(2:end-1,2:end-1)=7;\r\n% Games August 2013 2-Petty Officer %\r\nr=[0 0 1 4 1 3 3 3 3 2 0 0]';\r\nc=[0 2 3 2 0 5 0 4 0 2 2 0];\r\nm(5,4)=3;\r\nm(6,11)=3;\r\nm(9,8)=0;\r\n\r\ntic\r\nb=0;\r\nif valid\r\n b=solve_battleship(m,r,c);\r\nend\r\ntoc\r\n\r\nb(b\u003e1)=0;\r\nb(b\u003c0)=0;\r\n\r\nbr=sum(b,2);\r\nbc=sum(b);\r\n\r\nassert(isequal(r,br))\r\nassert(isequal(c,bc))\r\n\r\n% find battleship,cruisers,destroyers,subs\r\n% conv2 to locate pieces\r\n% bsh,bsv\r\n% ch,cv,dh,dv,s\r\n mconvsub=conv2(b,[2 2 2;2 1 2;2 2 2],'same');\r\n subs_ptr=find(mconvsub==1); % Isolated valid subs\r\n assert(size(subs_ptr,1)==4)\r\n % Qty of subs_ptr must be 4\r\n mconvBH=conv2(b,[5 5 5 5 5 5;5 1 1 1 1 5;5 5 5 5 5 5],'same');\r\n mconvBV=conv2(b',[5 5 5 5 5 5;5 1 1 1 1 5;5 5 5 5 5 5],'same');\r\n BS_ptr=[find(mconvBH==4);find(mconvBV==4)];\r\n assert(size(BS_ptr,1)==1)\r\n % Qty of BS_ptr must be 1\r\n mconvCH=conv2(b,[5 5 5 5 5;5 1 1 1 5;5 5 5 5 5],'same');\r\n mconvCV=conv2(b',[5 5 5 5 5;5 1 1 1 5;5 5 5 5 5],'same');\r\n CS_ptr=[find(mconvCH==3);find(mconvCV==3)];\r\n assert(size(CS_ptr,1)==2)\r\n % Qty of CS_ptr must be 2\r\n mconvDH=conv2(b,[5 5 5 5;5 1 1 5;5 5 5 5],'same');\r\n mconvDV=conv2(b',[5 5 5 5;5 1 1 5;5 5 5 5],'same');\r\n DS_ptr=[find(mconvDH==2);find(mconvDV==2)];\r\n assert(size(DS_ptr,1)==3)\r\n % Qty of DS_ptr must be 3\r\ntoc\r\n\r\n%%\r\nglobal valid\r\nm=zeros(12);\r\nm(2:end-1,2:end-1)=7;\r\n\r\n% December 2013 2-Petty %\r\nr=[0 2 2 2 3 2 0 0 7 0 2 0]';\r\nc=[0 2 5 1 4 1 4 0 2 1 0 0];\r\nm(3,3)=3;\r\nm(5,7)=1;\r\nm(9,4)=0;\r\n\r\ntic\r\nb=0;\r\nif valid\r\n b=solve_battleship(m,r,c);\r\nend\r\ntoc\r\n\r\nb(b\u003e1)=0;\r\nb(b\u003c0)=0;\r\n\r\nbr=sum(b,2);\r\nbc=sum(b);\r\n\r\nassert(isequal(r,br))\r\nassert(isequal(c,bc))\r\n\r\n% find battleship,cruisers,destroyers,subs\r\n% conv2 to locate pieces\r\n% bsh,bsv\r\n% ch,cv,dh,dv,s\r\n mconvsub=conv2(b,[2 2 2;2 1 2;2 2 2],'same');\r\n subs_ptr=find(mconvsub==1); % Isolated valid subs\r\n assert(size(subs_ptr,1)==4)\r\n % Qty of subs_ptr must be 4\r\n mconvBH=conv2(b,[5 5 5 5 5 5;5 1 1 1 1 5;5 5 5 5 5 5],'same');\r\n mconvBV=conv2(b',[5 5 5 5 5 5;5 1 1 1 1 5;5 5 5 5 5 5],'same');\r\n BS_ptr=[find(mconvBH==4);find(mconvBV==4)];\r\n assert(size(BS_ptr,1)==1)\r\n % Qty of BS_ptr must be 1\r\n mconvCH=conv2(b,[5 5 5 5 5;5 1 1 1 5;5 5 5 5 5],'same');\r\n mconvCV=conv2(b',[5 5 5 5 5;5 1 1 1 5;5 5 5 5 5],'same');\r\n CS_ptr=[find(mconvCH==3);find(mconvCV==3)];\r\n assert(size(CS_ptr,1)==2)\r\n % Qty of CS_ptr must be 2\r\n mconvDH=conv2(b,[5 5 5 5;5 1 1 5;5 5 5 5],'same');\r\n mconvDV=conv2(b',[5 5 5 5;5 1 1 5;5 5 5 5],'same');\r\n DS_ptr=[find(mconvDH==2);find(mconvDV==2)];\r\n assert(size(DS_ptr,1)==3)\r\n % Qty of DS_ptr must be 3\r\ntoc\r\n\r\n%%\r\nglobal valid\r\nm=zeros(12);\r\nm(2:end-1,2:end-1)=7;\r\n\r\n% September 2013 2-Petty\r\nr=[0 5 1 4 1 0 5 1 2 1 0 0]';\r\nc=[0 2 3 3 2 0 5 0 3 1 1 0];\r\nm(9,2)=1;\r\nm(2,7)=0;\r\nm(3,9)=1;\r\n\r\n\r\ntic\r\nb=0;\r\nif valid\r\n b=solve_battleship(m,r,c);\r\nend\r\ntoc\r\n\r\nb(b\u003e1)=0;\r\nb(b\u003c0)=0;\r\n\r\nbr=sum(b,2);\r\nbc=sum(b);\r\n\r\nassert(isequal(r,br))\r\nassert(isequal(c,bc))\r\n\r\n% find battleship,cruisers,destroyers,subs\r\n% conv2 to locate pieces\r\n% bsh,bsv\r\n% ch,cv,dh,dv,s\r\n mconvsub=conv2(b,[2 2 2;2 1 2;2 2 2],'same');\r\n subs_ptr=find(mconvsub==1); % Isolated valid subs\r\n assert(size(subs_ptr,1)==4)\r\n % Qty of subs_ptr must be 4\r\n mconvBH=conv2(b,[5 5 5 5 5 5;5 1 1 1 1 5;5 5 5 5 5 5],'same');\r\n mconvBV=conv2(b',[5 5 5 5 5 5;5 1 1 1 1 5;5 5 5 5 5 5],'same');\r\n BS_ptr=[find(mconvBH==4);find(mconvBV==4)];\r\n assert(size(BS_ptr,1)==1)\r\n % Qty of BS_ptr must be 1\r\n mconvCH=conv2(b,[5 5 5 5 5;5 1 1 1 5;5 5 5 5 5],'same');\r\n mconvCV=conv2(b',[5 5 5 5 5;5 1 1 1 5;5 5 5 5 5],'same');\r\n CS_ptr=[find(mconvCH==3);find(mconvCV==3)];\r\n assert(size(CS_ptr,1)==2)\r\n % Qty of CS_ptr must be 2\r\n mconvDH=conv2(b,[5 5 5 5;5 1 1 5;5 5 5 5],'same');\r\n mconvDV=conv2(b',[5 5 5 5;5 1 1 5;5 5 5 5],'same');\r\n DS_ptr=[find(mconvDH==2);find(mconvDV==2)];\r\n assert(size(DS_ptr,1)==3)\r\n % Qty of DS_ptr must be 3\r\ntoc\r\n","published":true,"deleted":false,"likes_count":0,"comments_count":0,"created_by":3097,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":4,"test_suite_updated_at":"2020-10-01T19:08:44.000Z","rescore_all_solutions":true,"group_id":1,"created_at":"2013-11-17T22:45:53.000Z","updated_at":"2025-12-10T03:22:09.000Z","published_at":"2013-11-17T23:06:51.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:hyperlink w:docLocation=\\\"http://www.conceptispuzzles.com/index.aspx?uri=puzzle/battleships\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eGames Magazine Battleships\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e is a logic puzzle to find the Fleet given some map information and the number of Ship cells in every column and row. The fleet is made of a Battleship(4), two Cruisers(3), three Destroyers(2), and four Submarines(1). Thus the total filled cells is 20.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe Seaman Level is the simplest and can be solved by direct evolution of current condition. The Petty Officer Level requires just a pinch more effort to solve.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eMap information contains Water(0), Subs(1), Middle of a ship(6), Unknown(7), and the Aft(rear) of a ship. Ship going Up(2), Down(3), Left(4), and Right(5).\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eShips have no diagonal or UDLR adjacency. The best way in Seaman to deal with Midship segments is to determine where it can not go to determine an orientation.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe map is ringed by zeros to make m a 12x12 array.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eInput:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e m,r,c; m 12x12 of map values, r(12,1) of row sums, c(1,12) of col sums\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eOutput:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e b; A binary 12x12 array\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eExample:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[r=[0 2 0 2 2 2 3 2 3 0 4 0]';\\nc=[0 4 0 3 1 3 1 4 0 1 3 0];\\n\\nm              b\\n000000000000  000000000000\\n077757777770  000011000000\\n077777777770  000000000000\\n077777777770  000100010000\\n077777777770  000100010000\\n077777777770  010000010000\\n077777777770  010000010010\\n027777777760  010000000010\\n077777777770  000101000010\\n077777777770  000000000000\\n077777477770  010001100100\\n000000000000  000000000000]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eAlgorithm:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[1) Initialize processing array based upon input matrix.\\n2) Implement a cycling check of driven array changes\\n3) Quick Test of Change every single Unknown serially\\n4) Evolve and check if complete solution created]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":2005,"title":"BattleShip - Seaman (1) thru Admiral(6) :  CPU Time Scoring(msec)","description":"\u003chttp://www.conceptispuzzles.com/index.aspx?uri=puzzle/battleships Games Magazine Battleships\u003e is a logic puzzle to find the Fleet given some map information and the number of Ship cells in every column and row. The fleet is made of a Battleship(4), two Cruisers(3), three Destroyers(2), and four Submarines(1). Thus the total filled cells is 20.\r\n\r\nThis Challenge is to complete three full sets of Battleship in minimal time.\r\n\r\nMap information contains Water(0), Subs(1), Middle of a ship(6), Unknown(7), and the Aft(rear) of a ship. Ship going Up(2), Down(3), Left(4), and Right(5).\r\n\r\nShips have no diagonal or UDLR adjacency.  The best way in Seaman to deal with Midship segments is to determine where it can not go to determine an orientation.\r\n\r\nThe map is ringed by zeros to make m a 12x12 array.\r\n\r\n*Input:* m,r,c;  m 12x12 of map values, r(12,1) of row sums, c(1,12) of col sums\r\n\r\n*Output:* b; A binary 12x12 array\r\n\r\n*Scoring:* Total Time (msec)\r\n\r\n*Example:*\r\n\r\n  r=[0 2 0 2 2 2 3 2 3 0 4 0]';\r\n  c=[0 4 0 3 1 3 1 4 0 1 3 0];\r\n  \r\n  m              b\r\n  000000000000  000000000000\r\n  077757777770  000011000000\r\n  077777777770  000000000000\r\n  077777777770  000100010000\r\n  077777777770  000100010000\r\n  077777777770  010000010000\r\n  077777777770  010000010010\r\n  027777777760  010000000010\r\n  077777777770  000101000010\r\n  077777777770  000000000000\r\n  077777477770  010001100100\r\n  000000000000  000000000000\r\n\r\n*Algorithm:* \r\n\r\n  1) Initialize processing array based upon input matrix.\r\n  2) Implement a cycling check of driven array changes\r\n  3) Quick Test of Change every single Unknown serially\r\n  4) Evolve and check if complete solution created\r\n  5) Robustly recursively check all potential Battleships, Cruisers, Destroyers, Subs","description_html":"\u003cp\u003e\u003ca href = \"http://www.conceptispuzzles.com/index.aspx?uri=puzzle/battleships\"\u003eGames Magazine Battleships\u003c/a\u003e is a logic puzzle to find the Fleet given some map information and the number of Ship cells in every column and row. The fleet is made of a Battleship(4), two Cruisers(3), three Destroyers(2), and four Submarines(1). Thus the total filled cells is 20.\u003c/p\u003e\u003cp\u003eThis Challenge is to complete three full sets of Battleship in minimal time.\u003c/p\u003e\u003cp\u003eMap information contains Water(0), Subs(1), Middle of a ship(6), Unknown(7), and the Aft(rear) of a ship. Ship going Up(2), Down(3), Left(4), and Right(5).\u003c/p\u003e\u003cp\u003eShips have no diagonal or UDLR adjacency.  The best way in Seaman to deal with Midship segments is to determine where it can not go to determine an orientation.\u003c/p\u003e\u003cp\u003eThe map is ringed by zeros to make m a 12x12 array.\u003c/p\u003e\u003cp\u003e\u003cb\u003eInput:\u003c/b\u003e m,r,c;  m 12x12 of map values, r(12,1) of row sums, c(1,12) of col sums\u003c/p\u003e\u003cp\u003e\u003cb\u003eOutput:\u003c/b\u003e b; A binary 12x12 array\u003c/p\u003e\u003cp\u003e\u003cb\u003eScoring:\u003c/b\u003e Total Time (msec)\u003c/p\u003e\u003cp\u003e\u003cb\u003eExample:\u003c/b\u003e\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003er=[0 2 0 2 2 2 3 2 3 0 4 0]';\r\nc=[0 4 0 3 1 3 1 4 0 1 3 0];\r\n\u003c/pre\u003e\u003cpre class=\"language-matlab\"\u003em              b\r\n000000000000  000000000000\r\n077757777770  000011000000\r\n077777777770  000000000000\r\n077777777770  000100010000\r\n077777777770  000100010000\r\n077777777770  010000010000\r\n077777777770  010000010010\r\n027777777760  010000000010\r\n077777777770  000101000010\r\n077777777770  000000000000\r\n077777477770  010001100100\r\n000000000000  000000000000\r\n\u003c/pre\u003e\u003cp\u003e\u003cb\u003eAlgorithm:\u003c/b\u003e\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003e1) Initialize processing array based upon input matrix.\r\n2) Implement a cycling check of driven array changes\r\n3) Quick Test of Change every single Unknown serially\r\n4) Evolve and check if complete solution created\r\n5) Robustly recursively check all potential Battleships, Cruisers, Destroyers, Subs\r\n\u003c/pre\u003e","function_template":"function b=solve_battleship(m,r,c)\r\n% WSUDLRMX 0W 1S 2U 3D 4L 5R 6M 7X\r\n% Surround 10x10 with ring of zeros\r\n% r : RowSum Vector [12,1]\r\n% c : ColSum Vector [1,12]\r\n b=zeros(12);\r\nend","test_suite":"assignin('caller','score',2000);\r\n%%\r\nglobal tt\r\nm=zeros(12);\r\nm(2:end-1,2:end-1)=7;\r\n\r\n% Games August 2013 1-Seaman\r\nr=[0 2 2 3 1 1 1 1 2 2 5 0]';\r\nc=[0 1 0 1 1 2 6 0 5 0 4 0];\r\nm(2,2)=1;\r\nm(2,6)=1;\r\nm(4,9)=3;\r\n\r\n%tz=tt; % anti-cheat\r\ntic\r\ntime0=cputime;\r\nb=solve_battleship(m,r,c);\r\n%tt=tz+cputime-time0\r\ntt=cputime-time0\r\n%toc\r\n\r\n\r\nb(b\u003e1)=0;\r\nb(b\u003c0)=0;\r\n\r\nbr=sum(b,2);\r\nbc=sum(b);\r\n\r\nassert(isequal(r,br))\r\nassert(isequal(c,bc))\r\n\r\n% find battleship,cruisers,destroyers,subs\r\n% conv2 to locate pieces\r\n% bsh,bsv\r\n% ch,cv,dh,dv,s\r\n mconvsub=conv2(b,[2 2 2;2 1 2;2 2 2],'same');\r\n subs_ptr=find(mconvsub==1); % Isolated valid subs\r\n assert(size(subs_ptr,1)==4)\r\n % Qty of subs_ptr must be 4\r\n mconvBH=conv2(b,[5 5 5 5 5 5;5 1 1 1 1 5;5 5 5 5 5 5],'same');\r\n mconvBV=conv2(b',[5 5 5 5 5 5;5 1 1 1 1 5;5 5 5 5 5 5],'same');\r\n BS_ptr=[find(mconvBH==4);find(mconvBV==4)];\r\n assert(size(BS_ptr,1)==1)\r\n % Qty of BS_ptr must be 1\r\n mconvCH=conv2(b,[5 5 5 5 5;5 1 1 1 5;5 5 5 5 5],'same');\r\n mconvCV=conv2(b',[5 5 5 5 5;5 1 1 1 5;5 5 5 5 5],'same');\r\n CS_ptr=[find(mconvCH==3);find(mconvCV==3)];\r\n assert(size(CS_ptr,1)==2)\r\n % Qty of CS_ptr must be 2\r\n mconvDH=conv2(b,[5 5 5 5;5 1 1 5;5 5 5 5],'same');\r\n mconvDV=conv2(b',[5 5 5 5;5 1 1 5;5 5 5 5],'same');\r\n DS_ptr=[find(mconvDH==2);find(mconvDV==2)];\r\n assert(size(DS_ptr,1)==3)\r\n % Qty of DS_ptr must be 3\r\ntoc\r\n%%\r\nglobal tt\r\nm=zeros(12);\r\nm(2:end-1,2:end-1)=7;\r\n\r\n% Games August 2013 2-Petty Officer\r\nr=[0 0 1 4 1 3 3 3 3 2 0 0]';\r\nc=[0 2 3 2 0 5 0 4 0 2 2 0];\r\nm(5,4)=3;\r\nm(6,11)=3;\r\nm(9,8)=0;\r\n\r\ntz=tt; % anti-cheat\r\ntic\r\ntime0=cputime;\r\nb=solve_battleship(m,r,c);\r\ntt=tz+cputime-time0\r\n%toc\r\n\r\n\r\nb(b\u003e1)=0;\r\nb(b\u003c0)=0;\r\n\r\nbr=sum(b,2);\r\nbc=sum(b);\r\n\r\nassert(isequal(r,br))\r\nassert(isequal(c,bc))\r\n\r\n% find battleship,cruisers,destroyers,subs\r\n% conv2 to locate pieces\r\n% bsh,bsv\r\n% ch,cv,dh,dv,s\r\n mconvsub=conv2(b,[2 2 2;2 1 2;2 2 2],'same');\r\n subs_ptr=find(mconvsub==1); % Isolated valid subs\r\n assert(size(subs_ptr,1)==4)\r\n % Qty of subs_ptr must be 4\r\n mconvBH=conv2(b,[5 5 5 5 5 5;5 1 1 1 1 5;5 5 5 5 5 5],'same');\r\n mconvBV=conv2(b',[5 5 5 5 5 5;5 1 1 1 1 5;5 5 5 5 5 5],'same');\r\n BS_ptr=[find(mconvBH==4);find(mconvBV==4)];\r\n assert(size(BS_ptr,1)==1)\r\n % Qty of BS_ptr must be 1\r\n mconvCH=conv2(b,[5 5 5 5 5;5 1 1 1 5;5 5 5 5 5],'same');\r\n mconvCV=conv2(b',[5 5 5 5 5;5 1 1 1 5;5 5 5 5 5],'same');\r\n CS_ptr=[find(mconvCH==3);find(mconvCV==3)];\r\n assert(size(CS_ptr,1)==2)\r\n % Qty of CS_ptr must be 2\r\n mconvDH=conv2(b,[5 5 5 5;5 1 1 5;5 5 5 5],'same');\r\n mconvDV=conv2(b',[5 5 5 5;5 1 1 5;5 5 5 5],'same');\r\n DS_ptr=[find(mconvDH==2);find(mconvDV==2)];\r\n assert(size(DS_ptr,1)==3)\r\n % Qty of DS_ptr must be 3\r\ntoc\r\n%%\r\nglobal tt\r\nm=zeros(12);\r\nm(2:end-1,2:end-1)=7;\r\n\r\n% Games August 2013 3-Ensign\r\nr=[0 3 0 4 1 0 0 1 2 1 8 0]';\r\nc=[0 5 1 1 3 1 1 1 1 3 3 0];\r\nm(4,7)=1;\r\nm(4,11)=3;\r\n\r\ntz=tt; % anti-cheat\r\ntic\r\ntime0=cputime;\r\nb=solve_battleship(m,r,c);\r\ntt=tz+cputime-time0\r\n%toc\r\n\r\n\r\nb(b\u003e1)=0;\r\nb(b\u003c0)=0;\r\n\r\nbr=sum(b,2);\r\nbc=sum(b);\r\n\r\nassert(isequal(r,br))\r\nassert(isequal(c,bc))\r\n\r\n% find battleship,cruisers,destroyers,subs\r\n% conv2 to locate pieces\r\n% bsh,bsv\r\n% ch,cv,dh,dv,s\r\n mconvsub=conv2(b,[2 2 2;2 1 2;2 2 2],'same');\r\n subs_ptr=find(mconvsub==1); % Isolated valid subs\r\n assert(size(subs_ptr,1)==4)\r\n % Qty of subs_ptr must be 4\r\n mconvBH=conv2(b,[5 5 5 5 5 5;5 1 1 1 1 5;5 5 5 5 5 5],'same');\r\n mconvBV=conv2(b',[5 5 5 5 5 5;5 1 1 1 1 5;5 5 5 5 5 5],'same');\r\n BS_ptr=[find(mconvBH==4);find(mconvBV==4)];\r\n assert(size(BS_ptr,1)==1)\r\n % Qty of BS_ptr must be 1\r\n mconvCH=conv2(b,[5 5 5 5 5;5 1 1 1 5;5 5 5 5 5],'same');\r\n mconvCV=conv2(b',[5 5 5 5 5;5 1 1 1 5;5 5 5 5 5],'same');\r\n CS_ptr=[find(mconvCH==3);find(mconvCV==3)];\r\n assert(size(CS_ptr,1)==2)\r\n % Qty of CS_ptr must be 2\r\n mconvDH=conv2(b,[5 5 5 5;5 1 1 5;5 5 5 5],'same');\r\n mconvDV=conv2(b',[5 5 5 5;5 1 1 5;5 5 5 5],'same');\r\n DS_ptr=[find(mconvDH==2);find(mconvDV==2)];\r\n assert(size(DS_ptr,1)==3)\r\n % Qty of DS_ptr must be 3\r\ntoc\r\n%%\r\nglobal tt\r\nm=zeros(12);\r\nm(2:end-1,2:end-1)=7;\r\n\r\n% Games August 2013 4-Captain\r\nr=[0 1 2 2 2 2 5 0 5 0 1 0]';\r\nc=[0 5 0 0 0 2 1 4 2 1 5 0];\r\nm(4,8)=0;\r\nm(7,10)=4;\r\n\r\ntz=tt; % anti-cheat\r\ntic\r\ntime0=cputime;\r\nb=solve_battleship(m,r,c);\r\ntt=tz+cputime-time0\r\n%toc\r\n\r\n\r\nb(b\u003e1)=0;\r\nb(b\u003c0)=0;\r\n\r\nbr=sum(b,2);\r\nbc=sum(b);\r\n\r\nassert(isequal(r,br))\r\nassert(isequal(c,bc))\r\n\r\n% find battleship,cruisers,destroyers,subs\r\n% conv2 to locate pieces\r\n% bsh,bsv\r\n% ch,cv,dh,dv,s\r\n mconvsub=conv2(b,[2 2 2;2 1 2;2 2 2],'same');\r\n subs_ptr=find(mconvsub==1); % Isolated valid subs\r\n assert(size(subs_ptr,1)==4)\r\n % Qty of subs_ptr must be 4\r\n mconvBH=conv2(b,[5 5 5 5 5 5;5 1 1 1 1 5;5 5 5 5 5 5],'same');\r\n mconvBV=conv2(b',[5 5 5 5 5 5;5 1 1 1 1 5;5 5 5 5 5 5],'same');\r\n BS_ptr=[find(mconvBH==4);find(mconvBV==4)];\r\n assert(size(BS_ptr,1)==1)\r\n % Qty of BS_ptr must be 1\r\n mconvCH=conv2(b,[5 5 5 5 5;5 1 1 1 5;5 5 5 5 5],'same');\r\n mconvCV=conv2(b',[5 5 5 5 5;5 1 1 1 5;5 5 5 5 5],'same');\r\n CS_ptr=[find(mconvCH==3);find(mconvCV==3)];\r\n assert(size(CS_ptr,1)==2)\r\n % Qty of CS_ptr must be 2\r\n mconvDH=conv2(b,[5 5 5 5;5 1 1 5;5 5 5 5],'same');\r\n mconvDV=conv2(b',[5 5 5 5;5 1 1 5;5 5 5 5],'same');\r\n DS_ptr=[find(mconvDH==2);find(mconvDV==2)];\r\n assert(size(DS_ptr,1)==3)\r\n % Qty of DS_ptr must be 3\r\ntoc\r\n%%\r\nglobal tt\r\nm=zeros(12);\r\nm(2:end-1,2:end-1)=7;\r\n\r\n% Games August 2013 5-Commodore\r\nr=[0 1 1 5 0 3 1 3 2 1 3 0]';\r\nc=[0 2 2 1 0 2 1 6 0 5 1 0];\r\nm(6,4)=1;\r\nm(6,8)=0;\r\nm(7,10)=3;\r\n\r\ntz=tt; % anti-cheat\r\ntic\r\ntime0=cputime;\r\nb=solve_battleship(m,r,c);\r\ntt=tz+cputime-time0\r\n%toc\r\n\r\n\r\nb(b\u003e1)=0;\r\nb(b\u003c0)=0;\r\n\r\nbr=sum(b,2);\r\nbc=sum(b);\r\n\r\nassert(isequal(r,br))\r\nassert(isequal(c,bc))\r\n\r\n% find battleship,cruisers,destroyers,subs\r\n% conv2 to locate pieces\r\n% bsh,bsv\r\n% ch,cv,dh,dv,s\r\n mconvsub=conv2(b,[2 2 2;2 1 2;2 2 2],'same');\r\n subs_ptr=find(mconvsub==1); % Isolated valid subs\r\n assert(size(subs_ptr,1)==4)\r\n % Qty of subs_ptr must be 4\r\n mconvBH=conv2(b,[5 5 5 5 5 5;5 1 1 1 1 5;5 5 5 5 5 5],'same');\r\n mconvBV=conv2(b',[5 5 5 5 5 5;5 1 1 1 1 5;5 5 5 5 5 5],'same');\r\n BS_ptr=[find(mconvBH==4);find(mconvBV==4)];\r\n assert(size(BS_ptr,1)==1)\r\n % Qty of BS_ptr must be 1\r\n mconvCH=conv2(b,[5 5 5 5 5;5 1 1 1 5;5 5 5 5 5],'same');\r\n mconvCV=conv2(b',[5 5 5 5 5;5 1 1 1 5;5 5 5 5 5],'same');\r\n CS_ptr=[find(mconvCH==3);find(mconvCV==3)];\r\n assert(size(CS_ptr,1)==2)\r\n % Qty of CS_ptr must be 2\r\n mconvDH=conv2(b,[5 5 5 5;5 1 1 5;5 5 5 5],'same');\r\n mconvDV=conv2(b',[5 5 5 5;5 1 1 5;5 5 5 5],'same');\r\n DS_ptr=[find(mconvDH==2);find(mconvDV==2)];\r\n assert(size(DS_ptr,1)==3)\r\n % Qty of DS_ptr must be 3\r\ntoc\r\n%%\r\nglobal tt\r\nm=zeros(12);\r\nm(2:end-1,2:end-1)=7;\r\n\r\n% Games August 2013 6-Admiral\r\nr=[0 5 1 4 2 3 1 1 0 3 0 0]';\r\nc=[0 4 0 1 2 4 2 1 1 5 0 0];\r\nm(5,2)=1;\r\nm(10,7)=6;\r\n\r\ntz=tt; % anti-cheat\r\ntic\r\ntime0=cputime;\r\nb=solve_battleship(m,r,c);\r\ntt=tz+cputime-time0\r\n%toc\r\n\r\n\r\nb(b\u003e1)=0;\r\nb(b\u003c0)=0;\r\n\r\nbr=sum(b,2);\r\nbc=sum(b);\r\n\r\nassert(isequal(r,br))\r\nassert(isequal(c,bc))\r\n\r\n% find battleship,cruisers,destroyers,subs\r\n% conv2 to locate pieces\r\n% bsh,bsv\r\n% ch,cv,dh,dv,s\r\n mconvsub=conv2(b,[2 2 2;2 1 2;2 2 2],'same');\r\n subs_ptr=find(mconvsub==1); % Isolated valid subs\r\n assert(size(subs_ptr,1)==4)\r\n % Qty of subs_ptr must be 4\r\n mconvBH=conv2(b,[5 5 5 5 5 5;5 1 1 1 1 5;5 5 5 5 5 5],'same');\r\n mconvBV=conv2(b',[5 5 5 5 5 5;5 1 1 1 1 5;5 5 5 5 5 5],'same');\r\n BS_ptr=[find(mconvBH==4);find(mconvBV==4)];\r\n assert(size(BS_ptr,1)==1)\r\n % Qty of BS_ptr must be 1\r\n mconvCH=conv2(b,[5 5 5 5 5;5 1 1 1 5;5 5 5 5 5],'same');\r\n mconvCV=conv2(b',[5 5 5 5 5;5 1 1 1 5;5 5 5 5 5],'same');\r\n CS_ptr=[find(mconvCH==3);find(mconvCV==3)];\r\n assert(size(CS_ptr,1)==2)\r\n % Qty of CS_ptr must be 2\r\n mconvDH=conv2(b,[5 5 5 5;5 1 1 5;5 5 5 5],'same');\r\n mconvDV=conv2(b',[5 5 5 5;5 1 1 5;5 5 5 5],'same');\r\n DS_ptr=[find(mconvDH==2);find(mconvDV==2)];\r\n assert(size(DS_ptr,1)==3)\r\n % Qty of DS_ptr must be 3\r\ntoc\r\n%%\r\nglobal tt\r\nm=zeros(12);\r\nm(2:end-1,2:end-1)=7;\r\n\r\n% December 2013 1-Seaman\r\nr=[0 1 1 1 1 2 3 3 3 1 4 0]';\r\nc=[0 3 2 0 1 6 0 3 1 4 0 0];\r\nm(2,3)=1;\r\nm(8,5)=1;\r\nm(7,8)=6;\r\n\r\ntz=tt; % anti-cheat\r\ntic\r\ntime0=cputime;\r\nb=solve_battleship(m,r,c);\r\ntt=tz+cputime-time0\r\n%toc\r\n\r\n\r\nb(b\u003e1)=0;\r\nb(b\u003c0)=0;\r\n\r\nbr=sum(b,2);\r\nbc=sum(b);\r\n\r\nassert(isequal(r,br))\r\nassert(isequal(c,bc))\r\n\r\n% find battleship,cruisers,destroyers,subs\r\n% conv2 to locate pieces\r\n% bsh,bsv\r\n% ch,cv,dh,dv,s\r\n mconvsub=conv2(b,[2 2 2;2 1 2;2 2 2],'same');\r\n subs_ptr=find(mconvsub==1); % Isolated valid subs\r\n assert(size(subs_ptr,1)==4)\r\n % Qty of subs_ptr must be 4\r\n mconvBH=conv2(b,[5 5 5 5 5 5;5 1 1 1 1 5;5 5 5 5 5 5],'same');\r\n mconvBV=conv2(b',[5 5 5 5 5 5;5 1 1 1 1 5;5 5 5 5 5 5],'same');\r\n BS_ptr=[find(mconvBH==4);find(mconvBV==4)];\r\n assert(size(BS_ptr,1)==1)\r\n % Qty of BS_ptr must be 1\r\n mconvCH=conv2(b,[5 5 5 5 5;5 1 1 1 5;5 5 5 5 5],'same');\r\n mconvCV=conv2(b',[5 5 5 5 5;5 1 1 1 5;5 5 5 5 5],'same');\r\n CS_ptr=[find(mconvCH==3);find(mconvCV==3)];\r\n assert(size(CS_ptr,1)==2)\r\n % Qty of CS_ptr must be 2\r\n mconvDH=conv2(b,[5 5 5 5;5 1 1 5;5 5 5 5],'same');\r\n mconvDV=conv2(b',[5 5 5 5;5 1 1 5;5 5 5 5],'same');\r\n DS_ptr=[find(mconvDH==2);find(mconvDV==2)];\r\n assert(size(DS_ptr,1)==3)\r\n % Qty of DS_ptr must be 3\r\ntoc\r\n%%\r\nglobal tt\r\nm=zeros(12);\r\nm(2:end-1,2:end-1)=7;\r\n\r\n% December 2013 2-Petty\r\nr=[0 2 2 2 3 2 0 0 7 0 2 0]';\r\nc=[0 2 5 1 4 1 4 0 2 1 0 0];\r\nm(3,3)=3;\r\nm(5,7)=1;\r\nm(9,4)=0;\r\n\r\ntz=tt; % anti-cheat\r\ntic\r\ntime0=cputime;\r\nb=solve_battleship(m,r,c);\r\ntt=tz+cputime-time0\r\n%toc\r\n\r\n\r\nb(b\u003e1)=0;\r\nb(b\u003c0)=0;\r\n\r\nbr=sum(b,2);\r\nbc=sum(b);\r\n\r\nassert(isequal(r,br))\r\nassert(isequal(c,bc))\r\n\r\n% find battleship,cruisers,destroyers,subs\r\n% conv2 to locate pieces\r\n% bsh,bsv\r\n% ch,cv,dh,dv,s\r\n mconvsub=conv2(b,[2 2 2;2 1 2;2 2 2],'same');\r\n subs_ptr=find(mconvsub==1); % Isolated valid subs\r\n assert(size(subs_ptr,1)==4)\r\n % Qty of subs_ptr must be 4\r\n mconvBH=conv2(b,[5 5 5 5 5 5;5 1 1 1 1 5;5 5 5 5 5 5],'same');\r\n mconvBV=conv2(b',[5 5 5 5 5 5;5 1 1 1 1 5;5 5 5 5 5 5],'same');\r\n BS_ptr=[find(mconvBH==4);find(mconvBV==4)];\r\n assert(size(BS_ptr,1)==1)\r\n % Qty of BS_ptr must be 1\r\n mconvCH=conv2(b,[5 5 5 5 5;5 1 1 1 5;5 5 5 5 5],'same');\r\n mconvCV=conv2(b',[5 5 5 5 5;5 1 1 1 5;5 5 5 5 5],'same');\r\n CS_ptr=[find(mconvCH==3);find(mconvCV==3)];\r\n assert(size(CS_ptr,1)==2)\r\n % Qty of CS_ptr must be 2\r\n mconvDH=conv2(b,[5 5 5 5;5 1 1 5;5 5 5 5],'same');\r\n mconvDV=conv2(b',[5 5 5 5;5 1 1 5;5 5 5 5],'same');\r\n DS_ptr=[find(mconvDH==2);find(mconvDV==2)];\r\n assert(size(DS_ptr,1)==3)\r\n % Qty of DS_ptr must be 3\r\ntoc\r\n%%\r\nglobal tt\r\nm=zeros(12);\r\nm(2:end-1,2:end-1)=7;\r\n\r\n% December 2013 3-Ensign\r\nr=[0 3 0 0 2 4 3 2 1 4 1 0]';\r\nc=[0 2 2 5 2 3 0 3 0 2 1 0];\r\nm(7,2)=1;\r\nm(7,4)=3;\r\nm(9,8)=0;\r\n\r\ntz=tt; % anti-cheat\r\ntic\r\ntime0=cputime;\r\nb=solve_battleship(m,r,c);\r\ntt=tz+cputime-time0\r\n%toc\r\n\r\n\r\nb(b\u003e1)=0;\r\nb(b\u003c0)=0;\r\n\r\nbr=sum(b,2);\r\nbc=sum(b);\r\n\r\nassert(isequal(r,br))\r\nassert(isequal(c,bc))\r\n\r\n% find battleship,cruisers,destroyers,subs\r\n% conv2 to locate pieces\r\n% bsh,bsv\r\n% ch,cv,dh,dv,s\r\n mconvsub=conv2(b,[2 2 2;2 1 2;2 2 2],'same');\r\n subs_ptr=find(mconvsub==1); % Isolated valid subs\r\n assert(size(subs_ptr,1)==4)\r\n % Qty of subs_ptr must be 4\r\n mconvBH=conv2(b,[5 5 5 5 5 5;5 1 1 1 1 5;5 5 5 5 5 5],'same');\r\n mconvBV=conv2(b',[5 5 5 5 5 5;5 1 1 1 1 5;5 5 5 5 5 5],'same');\r\n BS_ptr=[find(mconvBH==4);find(mconvBV==4)];\r\n assert(size(BS_ptr,1)==1)\r\n % Qty of BS_ptr must be 1\r\n mconvCH=conv2(b,[5 5 5 5 5;5 1 1 1 5;5 5 5 5 5],'same');\r\n mconvCV=conv2(b',[5 5 5 5 5;5 1 1 1 5;5 5 5 5 5],'same');\r\n CS_ptr=[find(mconvCH==3);find(mconvCV==3)];\r\n assert(size(CS_ptr,1)==2)\r\n % Qty of CS_ptr must be 2\r\n mconvDH=conv2(b,[5 5 5 5;5 1 1 5;5 5 5 5],'same');\r\n mconvDV=conv2(b',[5 5 5 5;5 1 1 5;5 5 5 5],'same');\r\n DS_ptr=[find(mconvDH==2);find(mconvDV==2)];\r\n assert(size(DS_ptr,1)==3)\r\n % Qty of DS_ptr must be 3\r\ntoc\r\n%%\r\nglobal tt\r\nm=zeros(12);\r\nm(2:end-1,2:end-1)=7;\r\n\r\n% December 2013 4-Captain\r\nr=[0 2 0 2 2 2 3 2 3 0 4 0]';\r\nc=[0 4 0 3 1 3 1 4 0 1 3 0];\r\nm(8,2)=2;\r\nm(2,5)=5;\r\nm(11,7)=4;\r\nm(8,11)=6;\r\n\r\n\r\ntz=tt; % anti-cheat\r\ntic\r\ntime0=cputime;\r\nb=solve_battleship(m,r,c);\r\ntt=tz+cputime-time0\r\n%toc\r\n\r\n\r\nb(b\u003e1)=0;\r\nb(b\u003c0)=0;\r\n\r\nbr=sum(b,2);\r\nbc=sum(b);\r\n\r\nassert(isequal(r,br))\r\nassert(isequal(c,bc))\r\n\r\n% find battleship,cruisers,destroyers,subs\r\n% conv2 to locate pieces\r\n% bsh,bsv\r\n% ch,cv,dh,dv,s\r\n mconvsub=conv2(b,[2 2 2;2 1 2;2 2 2],'same');\r\n subs_ptr=find(mconvsub==1); % Isolated valid subs\r\n assert(size(subs_ptr,1)==4)\r\n % Qty of subs_ptr must be 4\r\n mconvBH=conv2(b,[5 5 5 5 5 5;5 1 1 1 1 5;5 5 5 5 5 5],'same');\r\n mconvBV=conv2(b',[5 5 5 5 5 5;5 1 1 1 1 5;5 5 5 5 5 5],'same');\r\n BS_ptr=[find(mconvBH==4);find(mconvBV==4)];\r\n assert(size(BS_ptr,1)==1)\r\n % Qty of BS_ptr must be 1\r\n mconvCH=conv2(b,[5 5 5 5 5;5 1 1 1 5;5 5 5 5 5],'same');\r\n mconvCV=conv2(b',[5 5 5 5 5;5 1 1 1 5;5 5 5 5 5],'same');\r\n CS_ptr=[find(mconvCH==3);find(mconvCV==3)];\r\n assert(size(CS_ptr,1)==2)\r\n % Qty of CS_ptr must be 2\r\n mconvDH=conv2(b,[5 5 5 5;5 1 1 5;5 5 5 5],'same');\r\n mconvDV=conv2(b',[5 5 5 5;5 1 1 5;5 5 5 5],'same');\r\n DS_ptr=[find(mconvDH==2);find(mconvDV==2)];\r\n assert(size(DS_ptr,1)==3)\r\n % Qty of DS_ptr must be 3\r\ntoc\r\n%%\r\nglobal tt\r\nm=zeros(12);\r\nm(2:end-1,2:end-1)=7;\r\n\r\n% December 2013 5-Commodore\r\nr=[0 3 2 3 1 1 1 3 3 2 1 0]';\r\nc=[0 1 2 4 1 4 1 1 0 5 1 0];\r\nm(2,10)=5;\r\nm(8,4)=6;\r\nm(8,6)=5;\r\n\r\ntz=tt; % anti-cheat\r\ntic\r\ntime0=cputime;\r\nb=solve_battleship(m,r,c);\r\ntt=tz+cputime-time0\r\n%toc\r\n\r\n\r\nb(b\u003e1)=0;\r\nb(b\u003c0)=0;\r\n\r\nbr=sum(b,2);\r\nbc=sum(b);\r\n\r\nassert(isequal(r,br))\r\nassert(isequal(c,bc))\r\n\r\n% find battleship,cruisers,destroyers,subs\r\n% conv2 to locate pieces\r\n% bsh,bsv\r\n% ch,cv,dh,dv,s\r\n mconvsub=conv2(b,[2 2 2;2 1 2;2 2 2],'same');\r\n subs_ptr=find(mconvsub==1); % Isolated valid subs\r\n assert(size(subs_ptr,1)==4)\r\n % Qty of subs_ptr must be 4\r\n mconvBH=conv2(b,[5 5 5 5 5 5;5 1 1 1 1 5;5 5 5 5 5 5],'same');\r\n mconvBV=conv2(b',[5 5 5 5 5 5;5 1 1 1 1 5;5 5 5 5 5 5],'same');\r\n BS_ptr=[find(mconvBH==4);find(mconvBV==4)];\r\n assert(size(BS_ptr,1)==1)\r\n % Qty of BS_ptr must be 1\r\n mconvCH=conv2(b,[5 5 5 5 5;5 1 1 1 5;5 5 5 5 5],'same');\r\n mconvCV=conv2(b',[5 5 5 5 5;5 1 1 1 5;5 5 5 5 5],'same');\r\n CS_ptr=[find(mconvCH==3);find(mconvCV==3)];\r\n assert(size(CS_ptr,1)==2)\r\n % Qty of CS_ptr must be 2\r\n mconvDH=conv2(b,[5 5 5 5;5 1 1 5;5 5 5 5],'same');\r\n mconvDV=conv2(b',[5 5 5 5;5 1 1 5;5 5 5 5],'same');\r\n DS_ptr=[find(mconvDH==2);find(mconvDV==2)];\r\n assert(size(DS_ptr,1)==3)\r\n % Qty of DS_ptr must be 3\r\ntoc\r\n%%\r\nglobal tt\r\nm=zeros(12);\r\nm(2:end-1,2:end-1)=7;\r\n\r\n% December 2013 6-Admiral\r\nr=[0 5 1 0 3 0 1 5 2 3 0 0]';\r\nc=[0 0 4 2 5 2 1 2 1 1 2 0];\r\nm(2,10)=0;\r\nm(8,7)=0;\r\nm(10,5)=1;\r\n\r\ntz=tt; % anti-cheat\r\ntic\r\ntime0=cputime;\r\nb=solve_battleship(m,r,c);\r\ntt=tz+cputime-time0\r\n%toc\r\n\r\n\r\nb(b\u003e1)=0;\r\nb(b\u003c0)=0;\r\n\r\nbr=sum(b,2);\r\nbc=sum(b);\r\n\r\nassert(isequal(r,br))\r\nassert(isequal(c,bc))\r\n\r\n% find battleship,cruisers,destroyers,subs\r\n% conv2 to locate pieces\r\n% bsh,bsv\r\n% ch,cv,dh,dv,s\r\n mconvsub=conv2(b,[2 2 2;2 1 2;2 2 2],'same');\r\n subs_ptr=find(mconvsub==1); % Isolated valid subs\r\n assert(size(subs_ptr,1)==4)\r\n % Qty of subs_ptr must be 4\r\n mconvBH=conv2(b,[5 5 5 5 5 5;5 1 1 1 1 5;5 5 5 5 5 5],'same');\r\n mconvBV=conv2(b',[5 5 5 5 5 5;5 1 1 1 1 5;5 5 5 5 5 5],'same');\r\n BS_ptr=[find(mconvBH==4);find(mconvBV==4)];\r\n assert(size(BS_ptr,1)==1)\r\n % Qty of BS_ptr must be 1\r\n mconvCH=conv2(b,[5 5 5 5 5;5 1 1 1 5;5 5 5 5 5],'same');\r\n mconvCV=conv2(b',[5 5 5 5 5;5 1 1 1 5;5 5 5 5 5],'same');\r\n CS_ptr=[find(mconvCH==3);find(mconvCV==3)];\r\n assert(size(CS_ptr,1)==2)\r\n % Qty of CS_ptr must be 2\r\n mconvDH=conv2(b,[5 5 5 5;5 1 1 5;5 5 5 5],'same');\r\n mconvDV=conv2(b',[5 5 5 5;5 1 1 5;5 5 5 5],'same');\r\n DS_ptr=[find(mconvDH==2);find(mconvDV==2)];\r\n assert(size(DS_ptr,1)==3)\r\n % Qty of DS_ptr must be 3\r\ntoc\r\n%%\r\nglobal tt\r\nm=zeros(12);\r\nm(2:end-1,2:end-1)=7;\r\n\r\n% September 2013 1-Seaman\r\nr=[0 1 1 2 4 1 0 2 2 5 2 0]';\r\nc=[0 1 1 1 1 4 0 7 0 2 3 0];\r\nm(2,8)=0;\r\nm(8,3)=1;\r\nm(9,6)=0;\r\nm(5,11)=6;\r\n\r\ntz=tt; % anti-cheat\r\ntic\r\ntime0=cputime;\r\nb=solve_battleship(m,r,c);\r\ntt=tz+cputime-time0\r\n%toc\r\n\r\n\r\nb(b\u003e1)=0;\r\nb(b\u003c0)=0;\r\n\r\nbr=sum(b,2);\r\nbc=sum(b);\r\n\r\nassert(isequal(r,br))\r\nassert(isequal(c,bc))\r\n\r\n% find battleship,cruisers,destroyers,subs\r\n% conv2 to locate pieces\r\n% bsh,bsv\r\n% ch,cv,dh,dv,s\r\n mconvsub=conv2(b,[2 2 2;2 1 2;2 2 2],'same');\r\n subs_ptr=find(mconvsub==1); % Isolated valid subs\r\n assert(size(subs_ptr,1)==4)\r\n % Qty of subs_ptr must be 4\r\n mconvBH=conv2(b,[5 5 5 5 5 5;5 1 1 1 1 5;5 5 5 5 5 5],'same');\r\n mconvBV=conv2(b',[5 5 5 5 5 5;5 1 1 1 1 5;5 5 5 5 5 5],'same');\r\n BS_ptr=[find(mconvBH==4);find(mconvBV==4)];\r\n assert(size(BS_ptr,1)==1)\r\n % Qty of BS_ptr must be 1\r\n mconvCH=conv2(b,[5 5 5 5 5;5 1 1 1 5;5 5 5 5 5],'same');\r\n mconvCV=conv2(b',[5 5 5 5 5;5 1 1 1 5;5 5 5 5 5],'same');\r\n CS_ptr=[find(mconvCH==3);find(mconvCV==3)];\r\n assert(size(CS_ptr,1)==2)\r\n % Qty of CS_ptr must be 2\r\n mconvDH=conv2(b,[5 5 5 5;5 1 1 5;5 5 5 5],'same');\r\n mconvDV=conv2(b',[5 5 5 5;5 1 1 5;5 5 5 5],'same');\r\n DS_ptr=[find(mconvDH==2);find(mconvDV==2)];\r\n assert(size(DS_ptr,1)==3)\r\n % Qty of DS_ptr must be 3\r\ntoc\r\n%%\r\nglobal tt\r\nm=zeros(12);\r\nm(2:end-1,2:end-1)=7;\r\n\r\n% September 2013 2-Petty\r\nr=[0 5 1 4 1 0 5 1 2 1 0 0]';\r\nc=[0 2 3 3 2 0 5 0 3 1 1 0];\r\nm(9,2)=1;\r\nm(2,7)=0;\r\nm(3,9)=1;\r\n\r\ntz=tt; % anti-cheat\r\ntic\r\ntime0=cputime;\r\nb=solve_battleship(m,r,c);\r\ntt=tz+cputime-time0\r\n%toc\r\n\r\n\r\nb(b\u003e1)=0;\r\nb(b\u003c0)=0;\r\n\r\nbr=sum(b,2);\r\nbc=sum(b);\r\n\r\nassert(isequal(r,br))\r\nassert(isequal(c,bc))\r\n\r\n% find battleship,cruisers,destroyers,subs\r\n% conv2 to locate pieces\r\n% bsh,bsv\r\n% ch,cv,dh,dv,s\r\n mconvsub=conv2(b,[2 2 2;2 1 2;2 2 2],'same');\r\n subs_ptr=find(mconvsub==1); % Isolated valid subs\r\n assert(size(subs_ptr,1)==4)\r\n % Qty of subs_ptr must be 4\r\n mconvBH=conv2(b,[5 5 5 5 5 5;5 1 1 1 1 5;5 5 5 5 5 5],'same');\r\n mconvBV=conv2(b',[5 5 5 5 5 5;5 1 1 1 1 5;5 5 5 5 5 5],'same');\r\n BS_ptr=[find(mconvBH==4);find(mconvBV==4)];\r\n assert(size(BS_ptr,1)==1)\r\n % Qty of BS_ptr must be 1\r\n mconvCH=conv2(b,[5 5 5 5 5;5 1 1 1 5;5 5 5 5 5],'same');\r\n mconvCV=conv2(b',[5 5 5 5 5;5 1 1 1 5;5 5 5 5 5],'same');\r\n CS_ptr=[find(mconvCH==3);find(mconvCV==3)];\r\n assert(size(CS_ptr,1)==2)\r\n % Qty of CS_ptr must be 2\r\n mconvDH=conv2(b,[5 5 5 5;5 1 1 5;5 5 5 5],'same');\r\n mconvDV=conv2(b',[5 5 5 5;5 1 1 5;5 5 5 5],'same');\r\n DS_ptr=[find(mconvDH==2);find(mconvDV==2)];\r\n assert(size(DS_ptr,1)==3)\r\n % Qty of DS_ptr must be 3\r\ntoc\r\n%%\r\nglobal tt\r\nm=zeros(12);\r\nm(2:end-1,2:end-1)=7;\r\n\r\n% September 2013 3-Ensign\r\nr=[0 3 0 2 3 1 1 2 2 2 4 0]';\r\nc=[0 1 1 0 6 1 4 0 3 1 3 0];\r\nm(4,3)=0;\r\nm(5,6)=4;\r\nm(7,9)=6;\r\n\r\ntz=tt; % anti-cheat\r\ntic\r\ntime0=cputime;\r\nb=solve_battleship(m,r,c);\r\ntt=tz+cputime-time0\r\n%toc\r\n\r\n\r\nb(b\u003e1)=0;\r\nb(b\u003c0)=0;\r\n\r\nbr=sum(b,2);\r\nbc=sum(b);\r\n\r\nassert(isequal(r,br))\r\nassert(isequal(c,bc))\r\n\r\n% find battleship,cruisers,destroyers,subs\r\n% conv2 to locate pieces\r\n% bsh,bsv\r\n% ch,cv,dh,dv,s\r\n mconvsub=conv2(b,[2 2 2;2 1 2;2 2 2],'same');\r\n subs_ptr=find(mconvsub==1); % Isolated valid subs\r\n assert(size(subs_ptr,1)==4)\r\n % Qty of subs_ptr must be 4\r\n mconvBH=conv2(b,[5 5 5 5 5 5;5 1 1 1 1 5;5 5 5 5 5 5],'same');\r\n mconvBV=conv2(b',[5 5 5 5 5 5;5 1 1 1 1 5;5 5 5 5 5 5],'same');\r\n BS_ptr=[find(mconvBH==4);find(mconvBV==4)];\r\n assert(size(BS_ptr,1)==1)\r\n % Qty of BS_ptr must be 1\r\n mconvCH=conv2(b,[5 5 5 5 5;5 1 1 1 5;5 5 5 5 5],'same');\r\n mconvCV=conv2(b',[5 5 5 5 5;5 1 1 1 5;5 5 5 5 5],'same');\r\n CS_ptr=[find(mconvCH==3);find(mconvCV==3)];\r\n assert(size(CS_ptr,1)==2)\r\n % Qty of CS_ptr must be 2\r\n mconvDH=conv2(b,[5 5 5 5;5 1 1 5;5 5 5 5],'same');\r\n mconvDV=conv2(b',[5 5 5 5;5 1 1 5;5 5 5 5],'same');\r\n DS_ptr=[find(mconvDH==2);find(mconvDV==2)];\r\n assert(size(DS_ptr,1)==3)\r\n % Qty of DS_ptr must be 3\r\ntoc\r\n%%\r\nglobal tt\r\nm=zeros(12);\r\nm(2:end-1,2:end-1)=7;\r\n\r\n% September 2013 4-Captain\r\nr=[0 0 6 0 2 2 4 1 3 2 0 0]';\r\nc=[0 3 1 3 1 2 2 2 2 0 4 0];\r\nm(5,2)=0;\r\nm(9,4)=0;\r\nm(3,5)=4;\r\nm(6,11)=2;\r\nm(8,11)=3;\r\n\r\ntz=tt; % anti-cheat\r\ntic\r\ntime0=cputime;\r\nb=solve_battleship(m,r,c);\r\ntt=tz+cputime-time0\r\n%toc\r\n\r\n\r\nb(b\u003e1)=0;\r\nb(b\u003c0)=0;\r\n\r\nbr=sum(b,2);\r\nbc=sum(b);\r\n\r\nassert(isequal(r,br))\r\nassert(isequal(c,bc))\r\n\r\n% find battleship,cruisers,destroyers,subs\r\n% conv2 to locate pieces\r\n% bsh,bsv\r\n% ch,cv,dh,dv,s\r\n mconvsub=conv2(b,[2 2 2;2 1 2;2 2 2],'same');\r\n subs_ptr=find(mconvsub==1); % Isolated valid subs\r\n assert(size(subs_ptr,1)==4)\r\n % Qty of subs_ptr must be 4\r\n mconvBH=conv2(b,[5 5 5 5 5 5;5 1 1 1 1 5;5 5 5 5 5 5],'same');\r\n mconvBV=conv2(b',[5 5 5 5 5 5;5 1 1 1 1 5;5 5 5 5 5 5],'same');\r\n BS_ptr=[find(mconvBH==4);find(mconvBV==4)];\r\n assert(size(BS_ptr,1)==1)\r\n % Qty of BS_ptr must be 1\r\n mconvCH=conv2(b,[5 5 5 5 5;5 1 1 1 5;5 5 5 5 5],'same');\r\n mconvCV=conv2(b',[5 5 5 5 5;5 1 1 1 5;5 5 5 5 5],'same');\r\n CS_ptr=[find(mconvCH==3);find(mconvCV==3)];\r\n assert(size(CS_ptr,1)==2)\r\n % Qty of CS_ptr must be 2\r\n mconvDH=conv2(b,[5 5 5 5;5 1 1 5;5 5 5 5],'same');\r\n mconvDV=conv2(b',[5 5 5 5;5 1 1 5;5 5 5 5],'same');\r\n DS_ptr=[find(mconvDH==2);find(mconvDV==2)];\r\n assert(size(DS_ptr,1)==3)\r\n % Qty of DS_ptr must be 3\r\ntoc\r\n%%\r\nglobal tt\r\nm=zeros(12);\r\nm(2:end-1,2:end-1)=7;\r\n\r\n% September 2013 5-Commodore %\r\nr=[0 5 2 1 1 7 1 2 0 0 1 0]';\r\nc=[0 2 3 1 2 1 3 1 2 0 5 0];\r\nm(8,2)=1;\r\nm(5,11)=2;\r\n\r\ntz=tt; % anti-cheat\r\ntic\r\ntime0=cputime;\r\nb=solve_battleship(m,r,c);\r\ntt=tz+cputime-time0\r\n%toc\r\n\r\n\r\nb(b\u003e1)=0;\r\nb(b\u003c0)=0;\r\n\r\nbr=sum(b,2);\r\nbc=sum(b);\r\n\r\nassert(isequal(r,br))\r\nassert(isequal(c,bc))\r\n\r\n% find battleship,cruisers,destroyers,subs\r\n% conv2 to locate pieces\r\n% bsh,bsv\r\n% ch,cv,dh,dv,s\r\n mconvsub=conv2(b,[2 2 2;2 1 2;2 2 2],'same');\r\n subs_ptr=find(mconvsub==1); % Isolated valid subs\r\n assert(size(subs_ptr,1)==4)\r\n % Qty of subs_ptr must be 4\r\n mconvBH=conv2(b,[5 5 5 5 5 5;5 1 1 1 1 5;5 5 5 5 5 5],'same');\r\n mconvBV=conv2(b',[5 5 5 5 5 5;5 1 1 1 1 5;5 5 5 5 5 5],'same');\r\n BS_ptr=[find(mconvBH==4);find(mconvBV==4)];\r\n assert(size(BS_ptr,1)==1)\r\n % Qty of BS_ptr must be 1\r\n mconvCH=conv2(b,[5 5 5 5 5;5 1 1 1 5;5 5 5 5 5],'same');\r\n mconvCV=conv2(b',[5 5 5 5 5;5 1 1 1 5;5 5 5 5 5],'same');\r\n CS_ptr=[find(mconvCH==3);find(mconvCV==3)];\r\n assert(size(CS_ptr,1)==2)\r\n % Qty of CS_ptr must be 2\r\n mconvDH=conv2(b,[5 5 5 5;5 1 1 5;5 5 5 5],'same');\r\n mconvDV=conv2(b',[5 5 5 5;5 1 1 5;5 5 5 5],'same');\r\n DS_ptr=[find(mconvDH==2);find(mconvDV==2)];\r\n assert(size(DS_ptr,1)==3)\r\n % Qty of DS_ptr must be 3\r\ntoc\r\n%%\r\nglobal tt\r\nm=zeros(12);\r\nm(2:end-1,2:end-1)=7;\r\n\r\n% September 2013 6-Admiral % Solved with with Bship HV .10 \r\n% solved recur .023\r\nr=[0 0 2 4 1 4 1 0 2 0 6 0]';\r\nc=[0 3 1 3 1 3 2 1 2 1 3 0];\r\nm(3,2)=0;\r\nm(4,5)=4;\r\nm(9,9)=5;\r\n\r\ntz=tt; % anti-cheat\r\ntic\r\ntime0=cputime;\r\nb=solve_battleship(m,r,c);\r\ntt=tz+cputime-time0\r\n%toc\r\n\r\n\r\nb(b\u003e1)=0;\r\nb(b\u003c0)=0;\r\n\r\nbr=sum(b,2);\r\nbc=sum(b);\r\n\r\nassert(isequal(r,br))\r\nassert(isequal(c,bc))\r\n\r\n% find battleship,cruisers,destroyers,subs\r\n% conv2 to locate pieces\r\n% bsh,bsv\r\n% ch,cv,dh,dv,s\r\n mconvsub=conv2(b,[2 2 2;2 1 2;2 2 2],'same');\r\n subs_ptr=find(mconvsub==1); % Isolated valid subs\r\n assert(size(subs_ptr,1)==4)\r\n % Qty of subs_ptr must be 4\r\n mconvBH=conv2(b,[5 5 5 5 5 5;5 1 1 1 1 5;5 5 5 5 5 5],'same');\r\n mconvBV=conv2(b',[5 5 5 5 5 5;5 1 1 1 1 5;5 5 5 5 5 5],'same');\r\n BS_ptr=[find(mconvBH==4);find(mconvBV==4)];\r\n assert(size(BS_ptr,1)==1)\r\n % Qty of BS_ptr must be 1\r\n mconvCH=conv2(b,[5 5 5 5 5;5 1 1 1 5;5 5 5 5 5],'same');\r\n mconvCV=conv2(b',[5 5 5 5 5;5 1 1 1 5;5 5 5 5 5],'same');\r\n CS_ptr=[find(mconvCH==3);find(mconvCV==3)];\r\n assert(size(CS_ptr,1)==2)\r\n % Qty of CS_ptr must be 2\r\n mconvDH=conv2(b,[5 5 5 5;5 1 1 5;5 5 5 5],'same');\r\n mconvDV=conv2(b',[5 5 5 5;5 1 1 5;5 5 5 5],'same');\r\n DS_ptr=[find(mconvDH==2);find(mconvDV==2)];\r\n assert(size(DS_ptr,1)==3)\r\n % Qty of DS_ptr must be 3\r\ntoc\r\n%%\r\nglobal tt\r\ntt\r\nassignin('caller','score',min(2000,floor(1000*tt)));","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":3097,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":3,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2013-11-17T23:26:01.000Z","updated_at":"2013-11-18T00:27:11.000Z","published_at":"2013-11-18T00:27:11.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:hyperlink w:docLocation=\\\"http://www.conceptispuzzles.com/index.aspx?uri=puzzle/battleships\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eGames Magazine Battleships\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e is a logic puzzle to find the Fleet given some map information and the number of Ship cells in every column and row. The fleet is made of a Battleship(4), two Cruisers(3), three Destroyers(2), and four Submarines(1). Thus the total filled cells is 20.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis Challenge is to complete three full sets of Battleship in minimal time.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eMap information contains Water(0), Subs(1), Middle of a ship(6), Unknown(7), and the Aft(rear) of a ship. Ship going Up(2), Down(3), Left(4), and Right(5).\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eShips have no diagonal or UDLR adjacency. The best way in Seaman to deal with Midship segments is to determine where it can not go to determine an orientation.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe map is ringed by zeros to make m a 12x12 array.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eInput:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e m,r,c; m 12x12 of map values, r(12,1) of row sums, c(1,12) of col sums\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eOutput:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e b; A binary 12x12 array\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eScoring:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e Total Time (msec)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eExample:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[r=[0 2 0 2 2 2 3 2 3 0 4 0]';\\nc=[0 4 0 3 1 3 1 4 0 1 3 0];\\n\\nm              b\\n000000000000  000000000000\\n077757777770  000011000000\\n077777777770  000000000000\\n077777777770  000100010000\\n077777777770  000100010000\\n077777777770  010000010000\\n077777777770  010000010010\\n027777777760  010000000010\\n077777777770  000101000010\\n077777777770  000000000000\\n077777477770  010001100100\\n000000000000  000000000000]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eAlgorithm:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[1) Initialize processing array based upon input matrix.\\n2) Implement a cycling check of driven array changes\\n3) Quick Test of Change every single Unknown serially\\n4) Evolve and check if complete solution created\\n5) Robustly recursively check all potential Battleships, Cruisers, Destroyers, Subs]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"}],"term":"tag:\"battleship\"","current_player_id":null,"fields":[{"name":"page","type":"integer","callback":null,"default":1,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":null,"static":null,"prepend":true},{"name":"per_page","type":"integer","callback":null,"default":50,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":null,"static":null,"prepend":true},{"name":"sort","type":"string","callback":null,"default":null,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":null,"static":null,"prepend":true},{"name":"body","type":"text","callback":null,"default":"*:*","directive":null,"facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":false},{"name":"group","type":"string","callback":null,"default":null,"directive":"group","facet":true,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"difficulty_rating_bin","type":"string","callback":null,"default":null,"directive":"difficulty_rating_bin","facet":true,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"id","type":"integer","callback":null,"default":null,"directive":"id","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"tag","type":"string","callback":null,"default":null,"directive":"tag","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"product","type":"string","callback":null,"default":null,"directive":"product","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"created_at","type":"timeframe","callback":{},"default":null,"directive":"created_at","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"profile_id","type":"integer","callback":null,"default":null,"directive":"author_id","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"created_by","type":"string","callback":null,"default":null,"directive":"author","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"player_id","type":"integer","callback":null,"default":null,"directive":"solver_id","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"player","type":"string","callback":null,"default":null,"directive":"solver","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"solvers_count","type":"integer","callback":null,"default":null,"directive":"solvers_count","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"comments_count","type":"integer","callback":null,"default":null,"directive":"comments_count","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"likes_count","type":"integer","callback":null,"default":null,"directive":"likes_count","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"leader_id","type":"integer","callback":null,"default":null,"directive":"leader_id","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"leading_solution","type":"integer","callback":null,"default":null,"directive":"leading_solution","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true}],"filters":[{"name":"asset_type","type":"string","callback":null,"default":null,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":null,"static":"\"cody:problem\"","prepend":true},{"name":"profile_id","type":"integer","callback":{},"default":null,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":"author_id","static":null,"prepend":true}],"query":{"params":{"per_page":50,"term":"tag:\"battleship\"","current_player":null,"sort":"map(difficulty_value,0,0,999) asc"},"parser":"MathWorks::Search::Solr::QueryParser","directives":{"term":{"directives":{"tag":[["tag:\"battleship\"","","\"","battleship","\""]]}}},"facets":{"#\u003cMathWorks::Search::Field:0x00007fbf32be2960\u003e":null,"#\u003cMathWorks::Search::Field:0x00007fbf32be28c0\u003e":null},"filters":{"#\u003cMathWorks::Search::Field:0x00007fbf32be1f60\u003e":"\"cody:problem\""},"fields":{"#\u003cMathWorks::Search::Field:0x00007fbf32be2be0\u003e":1,"#\u003cMathWorks::Search::Field:0x00007fbf32be2b40\u003e":50,"#\u003cMathWorks::Search::Field:0x00007fbf32be2aa0\u003e":"map(difficulty_value,0,0,999) asc","#\u003cMathWorks::Search::Field:0x00007fbf32be2a00\u003e":"tag:\"battleship\""},"user_query":{"#\u003cMathWorks::Search::Field:0x00007fbf32be2a00\u003e":"tag:\"battleship\""},"queried_facets":{}},"query_backend":{"connection":{"configuration":{"index_url":"http://index-op-v2/solr/","query_url":"http://search-op-v2/solr/","direct_access_index_urls":["http://index-op-v2/solr/"],"direct_access_query_urls":["http://search-op-v2/solr/"],"timeout":10,"vhost":"search","exchange":"search.topic","heartbeat":30,"pre_index_mode":false,"host":"rabbitmq-eks","port":5672,"username":"cody-search","password":"78X075ddcV44","virtual_host":"search","indexer":"amqp","http_logging":"true","core":"cody"},"query_connection":{"uri":"http://search-op-v2/solr/cody/","proxy":null,"connection":{"parallel_manager":null,"headers":{"User-Agent":"Faraday v1.0.1"},"params":{},"options":{"params_encoder":"Faraday::FlatParamsEncoder","proxy":null,"bind":null,"timeout":null,"open_timeout":null,"read_timeout":null,"write_timeout":null,"boundary":null,"oauth":null,"context":null,"on_data":null},"ssl":{"verify":true,"ca_file":null,"ca_path":null,"verify_mode":null,"cert_store":null,"client_cert":null,"client_key":null,"certificate":null,"private_key":null,"verify_depth":null,"version":null,"min_version":null,"max_version":null},"default_parallel_manager":null,"builder":{"adapter":{"name":"Faraday::Adapter::NetHttp","args":[],"block":null},"handlers":[{"name":"Faraday::Response::RaiseError","args":[],"block":null}],"app":{"app":{"ssl_cert_store":{"verify_callback":null,"error":null,"error_string":null,"chain":null,"time":null},"app":{},"connection_options":{},"config_block":null}}},"url_prefix":"http://search-op-v2/solr/cody/","manual_proxy":false,"proxy":null},"update_format":"RSolr::JSON::Generator","update_path":"update","options":{"url":"http://search-op-v2/solr/cody"}}},"query":{"params":{"per_page":50,"term":"tag:\"battleship\"","current_player":null,"sort":"map(difficulty_value,0,0,999) asc"},"parser":"MathWorks::Search::Solr::QueryParser","directives":{"term":{"directives":{"tag":[["tag:\"battleship\"","","\"","battleship","\""]]}}},"facets":{"#\u003cMathWorks::Search::Field:0x00007fbf32be2960\u003e":null,"#\u003cMathWorks::Search::Field:0x00007fbf32be28c0\u003e":null},"filters":{"#\u003cMathWorks::Search::Field:0x00007fbf32be1f60\u003e":"\"cody:problem\""},"fields":{"#\u003cMathWorks::Search::Field:0x00007fbf32be2be0\u003e":1,"#\u003cMathWorks::Search::Field:0x00007fbf32be2b40\u003e":50,"#\u003cMathWorks::Search::Field:0x00007fbf32be2aa0\u003e":"map(difficulty_value,0,0,999) asc","#\u003cMathWorks::Search::Field:0x00007fbf32be2a00\u003e":"tag:\"battleship\""},"user_query":{"#\u003cMathWorks::Search::Field:0x00007fbf32be2a00\u003e":"tag:\"battleship\""},"queried_facets":{}},"options":{"fields":["id","difficulty_rating"]},"join":" "},"results":[{"id":1982,"difficulty_rating":"medium"},{"id":2004,"difficulty_rating":"medium"},{"id":2005,"difficulty_rating":"medium"}]}}