This blog no longer exists.
You will be redirected to something cool.

Saturday, May 5, 2012

Logic Puzzle in Ruby

I wrote a puzzle that kind of takes some skill in the area of logic.

It's essentially a word puzzle that does a small bit to introduce a little bit of Ruby syntax. It's a string made up of characters.

There is one letter for each character given and one character for each letter. Meaning that if { = z, { ALWAYS = z and z ALWAYS = {.

Line 1 is the puzzle string. Do not edit this line or you will mess up the puzzle and you may be unable to solve it.

Line 3 shows syntax for inputting symbols (in this case it's "|") and inputting letters (in this case it's "i".)

Lines 5-7 are comments. You can edit these to look like three, inputting your own guesses at what symbols in the puzzle string mean. Use line 3 as a template. Your best bet is to NOT edit line 3 as, for this puzzle, it's correct. | does equal i. That's a huge hint that makes this puzzle significantly easier so don't edit line 3.

Remove the "#" at the beginning of lines 5-7 so they'll run. You can't put the "#" back in if, or some reason, you want to disable that line of code.

Line 8 prints the puzzle, including your guesses (as long as you've deleted the #.)

Of course, you don't NEED ruby at all to solve the puzzle. You can do it with good ole' paper and pencil.

0 comments: