Wednesday, January 14, 2015

Binary Tree Printer

Data Structures are often hard to visualize and understand.  I decided to do my best to create a visual representation of a binary tree.

I wanted it to be fast and easy to implement.  I ended up creating a system for printing a binary tree currently in Java and C#

My Results

Example Trees:


         /---  0  ---\             
      /  1  \     /  2  \          
      3     4     5     6          


        /2   3                     

                           /------------------------------ 2 ------------------------------\                               
           /-------------- 7 --------------\                                               1                               
   /------26 ------\                       3                                                                               
  90 --\          25 --\                                                                                                   
      36              19 \                                                                                                 

Huffman Tree

           /------------nul(5) ------------\                               /------------nul(8) ------------\               
         67(2)                     /----nul(3) ----\                     45(4)                     /----nul(4) ----\       
                                 34(1)         /nul(2) \                                         23(2)         /nul(2) \   
                                             78(1)   89(1)                                                   12(1)   56(1) 

Binary Heap Tree

       /------ 1 ------\           
   /-- 2 --\       /-- 3 --\       
  17      26      19     / 7 \     
                        25  90    

Toggle comment blocks with 1 character

IDEs that allow you block comment and uncomment seconds with a keystroke are awesome. Only problem is many IDEs have different keyboard combinations for this, and many times you may be working in a simple text editor for quick code.  I often disable chunks of code and never liked the amount of typing I would have to do. I developed a commenting style that works on any language that uses "//" for line comments and "/**/" for block comments.

The Basic Block

This will toggle a single block of code by adding 1 "/" to the first line

/* comment about block of code
inactive block of code

//* only line change is here
active code

You can toggle blocks by introducing a "/*/"

/* only line change is here
int active

//* only line change is here
int active
I have more examples here

GIF example:

OpenGL Lighting Demo

I was able to learn about OpenGL and how to write shaders. Lighting in games is an effect that I think everyone takes for granted. My application demonstrates basic aspects of lighting used in games.

It starts by rendering objects to the screen

Then adding basic diffuse lighting (the arrow is the light source)

I also included the ability to show the difference between the Fragment and Vertex Shader. The Vertex Shader runs for each point on the geometry that makes up the object on the screen.  The fragment shader is run for every pixel between those points and are displayed on the screen.  Lighting in the fragment shader is more intense, but looks much better.

The last lighting aspect I added was specularity.  The shiny effect surfaces get when they reflect some of the light into your eye.

The next examples show the difference between frag and vertex shaders

Vertex Shader
 Fragment Shader

Vertex Shader
 Fragment Shader

Friday, June 6, 2014

Battle Bots and NXT Robots

In principles of Software Engineering taught by Steve Halliday we created various hardware robots.

We created a slot machine and also battlebots.  My Group's slot machine featured excellent hardware that help make our software very simple. Our battle bot used gears to increase it's pushing power and won first place!

Overview of our second round

Slot Machine Pictures

Pre College Programs

Pre-College C++ Programs

I started computer programming my junior year of High School.  Before going to Neumont University I created quite a few small programs.  These are very small programs with the ASCII encryption being the most extensive.


ASCII Stream Cipher Encryption

Encrypts basic ASCII characters.  The encrypted text can be saved and loaded from a file.


After the time has depeated the timer will make a sound and also screw up mouse movements.  I made this so I wouldn’t be late for the bus.  It is actually one of the first programs I made and is very annoying, which was quite effective.

Polar Cartesian Converter

This was a one of the projects for my programming class.  It converts polar coordinates to the Cartesian plane

Collatz Conjecture validation

after learning about the Collatz Conjecture I created this to test to see if it was valid.  This program will verify that any inputted number is valid.  

Fibonaccci Sequence

This will give you the fibonaccci number at the given iteration.

Global Data C++ Functions

During my last 2 years of High School I created this project.  If I ever developed a function that I thought would be useful for me later on, I would add it to Global Data.  This code will run to show some of the methods I developed.

MD5 string hash generator

Truth be told most of this code is not my own.  I found most of it online but I enjoyed plugging data into here.

Fraction operations

This was an assignment testing operator overloads.  It will also simplify fractions.

Pascal’s Triangle row finder

A simple application that will derive the given row of pascal’s triangle.  This was the first time that I dabbled with recursion.



Very proud of this, and I still play it today.  This will create a word list on the client’s computer that it grabs all the generated words from.  Feel free to edit this document for single player enjoyment.  It also includes options for multiplayer.  It is the basics of hangman.

Player’s Choice Game (for BPA)

A strange number game.  It was a speed code assessment for Business Professionals Associations programming competition.  I went to the State level competition for Michigan.

Looks Cool

Robot Horz Vert

A loads a world from a text file that robots will bounce around it.

Robots lined

Another iteration of the program mentioned above, but this allows for diagonal movement, and uses different characters