-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathparams.json
1 lines (1 loc) · 3.77 KB
/
params.json
1
{"name":"Unblockme","tagline":"","body":"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\r\n\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\">\r\n<head>\r\n <title>Untitled Page</title>\r\n</head>\r\n<body>\r\n<div style=\"text-align:center;font-weight: bold;\">The Cat</div>\r\n<br />\r\nLike many programmers, when I see a puzzle, I cannot help thinking \"Can I devise an algorithm to solve that\" ?\r\n<br />\r\nIt is probably the same urge, that drives a cat crazy, when it sees something dangling, to play with it :)\r\n<br />\r\nThen I saw the Unblock Me puzzle, you can read about it here, and many have it on their Android phone.\r\n<br />\r\nImmediately, I started thinking about how to solve that game, too.\r\n<br />\r\nOf course, in a couple of days I managed to write a program, using a depth first search. I did the recursion, the backtracking, I kept a trace of values, like a Stack.\r\n<br />\r\nBut when I ran it, it kept running, and running... and running...\r\n<br />\r\nIt seemed that the space for searching was something big, almost like the central supermassive black hole of the galaxy :(\r\n<br />\r\n<br />\r\n<div style=\"text-align:center;font-weight: bold;\">The Prune</div>\r\n<br />\r\nSo, i decided i need some imaginative pruning. That is, to eliminate some of the branches of that awful tree.\r\n<br />\r\nWhat came to my mind ?\r\nWhen a piece moves, it enters (cover)a new zone, and leaves (uncover)an old zone.\r\n<br />\r\nThese zones are, like a piece, the have a length, an orientation, and a position on the table. I thought these might be useful.\r\n<br />\r\n<img src=\"zones70.png\"/>\r\n\r\n<br />\r\n<div style=\"text-align:center;font-weight: bold;\">The decision functions for pruning</div>\r\n<div style=\"text-align:center;\">(some horror code will follow)</div>\r\n<br />\r\nThese functions decide whether I will continue to search from a node, or not.\r\nOf course, I played with some functions, but two remained.\r\n<br />\r\nOne says that\r\n<br />\r\n\"For a move to be valid, it needs to be historically purposeful\"\r\n<br />\r\nGood use was made for these zones I talked about.\r\nSo, this function, validates a move if some moves before( remember I keep track of moves) uncover a zone that is covered by this move(the one being tested).\r\n<br />\r\n<img src=\"nopurpose.png\"/>\r\n<br />\r\n<br />\r\nAnother function, tests whether\r\n\r\n\"between the current move and an older one of the same piece, are some moves that helps me to do these 2 moves ?\"\r\n<br />\r\nSo, if between current move, and an older move of the same piece, the pieces are moving unpurposefully(similar to the previous function) the move is invalid.\r\n\r\nThe idea is that, between the moves of the same piece, one must cover the uncovered zone of the oldest move, and another must leave a zone for the newest move to cover.\r\n<br />\r\nAnd also, the move that covers must be older that the one that uncovers.\r\n<br />\r\n<img src=\"cycles.png\"/>\r\n<br />\r\n<div style=\"text-align:center;font-weight: bold;\">Happy end</div>\r\n\r\nSo, i ran the program, and voila ! It solves all the puzzles that I thrown at it.\r\n<br />\r\nExamples :\r\n<a href=\"out643f.cs\">643</a>\r\n<a href=\"out743f.cs\">743</a>\r\n<a href=\"out750f.cs\">750</a>\r\npuzzles\r\n<br />\r\nThe source code is a plain C# named <a href=\"unblme.cs\">unblme.CS</a>, can be compiled with any .NET Framework's CSC\r\n<br />\r\nThe command line to run this executable is unblme file.txt, where the input file is like this <a href=\"in750.cs\">file.txt</a>\r\n<br />\r\n<div style=\"text-align:center;font-weight: bold;\">Enjoy!</div>\r\n\r\n\r\n</body>\r\n</html>\r\n","google":"","note":"Don't delete this file! It's used internally to help with page regeneration."}