Latest recipes tagged "puzzle"http://code.activestate.com/recipes/tags/puzzle/new/2013-02-11T10:32:26-08:00ActiveState Code RecipesPuzzle: Four cubes with different colors on their sides (Python)
2013-02-11T10:32:26-08:00Thomas Lehmannhttp://code.activestate.com/recipes/users/4174477/http://code.activestate.com/recipes/578454-puzzle-four-cubes-with-different-colors-on-their-s/
<p style="color: grey">
Python
recipe 578454
by <a href="/recipes/users/4174477/">Thomas Lehmann</a>
(<a href="/recipes/tags/colors/">colors</a>, <a href="/recipes/tags/cube/">cube</a>, <a href="/recipes/tags/puzzle/">puzzle</a>).
</p>
<p>I have four cubes (in real) with different colors on their sides as a puzzle with the final goal to place each cube side by side that way that on each visible side (except the two ends) you can see four different colors.</p>
<p>I have placed the cubes as they are (side by side) writing down the current colors (see function main). The CubesChecker class is searching for one solution. You don't see the operation on how to rotate but knowing the final state it's really easy to do it yourself then.</p>
Takuzu solver (Python)
2013-01-12T05:26:55-08:00Eviatar Bachhttp://code.activestate.com/recipes/users/4184885/http://code.activestate.com/recipes/578414-takuzu-solver/
<p style="color: grey">
Python
recipe 578414
by <a href="/recipes/users/4184885/">Eviatar Bach</a>
(<a href="/recipes/tags/constraint/">constraint</a>, <a href="/recipes/tags/constraint_solver/">constraint_solver</a>, <a href="/recipes/tags/puzzle/">puzzle</a>, <a href="/recipes/tags/takuzu/">takuzu</a>).
Revision 2.
</p>
<p>A Takuzu solver implemented using Google's Constraint Programming solver, part of the or-tools project.</p>
<p>A Takuzu board consists of a square grid of binary cells. There must be an equal number of 0s and 1s in every row and column, no duplicate rows or columns, and no more than two of the same bit consecutive in every row and column.</p>
Martin Gardner's "The Monkey and the Coconuts" Problem (Python)
2010-07-26T16:32:08-07:00Jack Trainorhttp://code.activestate.com/recipes/users/4076953/http://code.activestate.com/recipes/577335-martin-gardners-the-monkey-and-the-coconuts-proble/
<p style="color: grey">
Python
recipe 577335
by <a href="/recipes/users/4076953/">Jack Trainor</a>
(<a href="/recipes/tags/martingardner/">martingardner</a>, <a href="/recipes/tags/mathematical/">mathematical</a>, <a href="/recipes/tags/puzzle/">puzzle</a>).
</p>
<p>Five sailors arrive at a deserted island that has only coconuts and one monkey. The sailors collect all the coconuts into one big pile and agree to divide up the coconuts into equal shares the next morning. However during the night each sailor wakes up one at a time afraid to trust the others and decides to take his share secretly. So each sailor takes 1/5 of the coconuts and hides it. Each time there is one coconut left over and the sailor gives that to the monkey. In the morning they divide what is left of the pile into equal shares and there is still one coconut left for the monkey.</p>
<p>How many coconuts were in the original pile?</p>
Sudoku solver/creator (Python)
2008-09-12T00:18:27-07:00Collin Stockshttp://code.activestate.com/recipes/users/4149235/http://code.activestate.com/recipes/576505-sudoku-solvercreator/
<p style="color: grey">
Python
recipe 576505
by <a href="/recipes/users/4149235/">Collin Stocks</a>
(<a href="/recipes/tags/just_for_fun/">just_for_fun</a>, <a href="/recipes/tags/puzzle/">puzzle</a>, <a href="/recipes/tags/sudoku/">sudoku</a>).
</p>
<p>This program can solve and create sudoku puzzles</p>