Thursday, April 2, 2015

Binary Logic, puzzles and Boolean Algebra

Today, I give you a nice, simple Sudoku like puzzle to start with, called binary puzzle. It comes in 3 sizes: 6x6, 8x8, and 10x10. Check it out here and here are the rules.

Simple, fun, something to do and now for an actual discussion on Binary and Boolean logic. Keeping these posts short and sweet is nice, sort of. This will help me practice for some other short posts I need to write on other topics.

I used to enjoy converting numbers into binary in high school and working with them because it was so damn easy. And it helped me understand how places work. When working with any counting system, the first number on the right is always the ones place, or x0 where x is the base. 20 = 1. 100 = 1. 10000000000000666000000000000010 = 1. Why? Well, Dr. Math has the answer. For those looking to just read this before moving on to the next blog, here's his proof:
While the above argument might help convince your intuitive side that any number to the zero power is 1, the following argument is a little more rigorous.
This proof uses the laws of exponents. One of the laws of exponents is:
   n^x
   --- = n^(x-y)
   n^y   
for all n, x, and y. So for example,
   3^4
   --- = 3^(4-2) = 3^2
   3^2


   3^4 
   --- = 3^(4-3) = 3^1
   3^3
   
Now suppose we have the fraction:
    3^4
    ---
    3^4
This fraction equals 1, because the numerator and the denominator are the same. If we apply the law of exponents, we get:
       3^4
   1 = --- = 3^(4-4) = 3^0 
       3^4
So 3^0 = 1. We can plug in any in number in the place of three, and that number raised to the zero power will still be 1. In fact, the whole proof works if we just plug in x for 3:
                  x^4 
  x^0 = x^(4-4) = --- = 1
                  x^4   
Anyway, back to binary. So one's place is always 1 * whatever the number is. Next to that is x1, so in base 10 it's the ten's place, base 16 it's the sixteenth, and the Mayans called it the 20's place. Binary was simple to convert for this reason: 1001001 would be 1 * 26 + 0 * 25 + 0 * 24 + 1 * 23 + 0 * 22 + 0 * 21 + 0 * 20 or 64 + 8 + 1 or 73 in base 10. I can't believe I just wrote that out. Just showing my work like a good student.

Boolean algebra is good stuff too. What to say about that is simple, since I already dug myself this hole yesterday? Well, here are details about it all. Boolean and binary are not the same, but Boolean can help you build a binary calculator with LEDs. That's all I have today. Come back tomorrow when I try something a little easier. Or celebrate Good Friday, that's okay too.

Twitter: @aristotlesmstk, facebook, you know the whole usual drill.

Wednesday, April 1, 2015

A* algorithm

The theme for my A to Z challenge is puzzles, games, and algorithms. I already have to spend my time looking for this my math group, so hopefully this cuts down on the amount of brain juice I have to excrete in my day.

To start with A, I choose the A* algorithm. The linked video is "short", about 14 minutes but can be run in the in the background. It explains the math behind this path-finding algorithm.

I like computers and making computers and running computers and such, but I never took comp sci so I didn't start learning about A.I. algorithms until the past year or so. What grabbed my interest in these programs are two videos, and for your viewing pleasure I'll link them. Originally, it was videos of slime mold solving mazes. I'm also a mushroom man, so watching videos about slime mold solving mazes really got me excited.


Of course, this was just a novelty video we were showing around work to each other. "OOH! Look at the mold! It thinks it's smart!" It wasn't until I started finding GIFs on StumbleUpon demonstrating the maze solving capabilities of Dijkstra and A* that it changed from "novel curiosity" to "Holy shit, that looks exactly like slime mold!"


That's the best video I could find to try and show what I'm talking about. Sadly, I'm not as good at saving links I find as I should be, so I can't show the actual webpage that made me excited. Now, wouldn't you rather see this used to control Mario?


There was an AI competition where people wrote programs that control Mario in an attempt to complete a level. This is the video that got me interested in learning more about the algorithm, and it was the winner of the first competition.

Enjoy watching videos as you surf through A to Z today. Come back tomorrow for "Binary Logic, puzzles, and Boolean Algebra". I'll do a better explanation of how this algorithm works on Saturday with "Dijkstra". Also, I'm on the usual social network sites with Facebook, @aristotlemstk on twitter, and there's a Google+ link.