Month of Code 24/25 – Space+Cursor

As you know, I’ve been a little busy this past week, getting ready for Germany. However, I decided to take some time to throw together a little something [warning – autoplaying music] for Month of Code. I started this on the 24th, when the theme was “space”. I didn’t have time to finish it then, so I rolled in the 25th’s theme, “cursor.” It’s still not done (and is actually part of a bigger, secret project I eventually aspire to do), but enjoy! At the very least, enjoy the soothing music of Kevin MacLeod.

Bird’s Eye View

I’ve got just a few more days left at RIT, so I just want to take a quick moment to give an update on what I’ve been working on this past week and upcoming endeavors. First off, Month of Code day 17’s theme was “random.” I decided to start working on a random tree generator built using Three.js. At this point, I’m only capable of generating a trunk, but I have the algorithm fleshed out for when I get a little time to work on it. Secondly, I am working hard to try and wrap up my Google Glass project in time. This is the hardest deadline, because when I leave RIT, I lose access to the Glass that I have been using. Lastly, I finally “started” working on my upcoming Minecraft mod, Minecraft Expand (name pending). I use start in quotations, because I haven’t actually done any coding yet, but I started looking at the current technologies that will help make the mod a reality, as well doing an informal design document. Lastly, I’ve been knee-deep in establishing a mobile app in the “things to do” domain through an entrepreneurship class here at RIT. I’ll reveal more about this as I continue to progress in the development lifecycle. I also silently released my RIT Next Bus app to the public, and I intend on marketing it a little before I leave.

Over the next week and a half, I’ll be preparing to move home from RIT, prepare for Germany, and then fly over, so I’ll have less time to commit to projects. It’s probably at this point where I’ll take some time to write a few of the blog posts that I’ve been pushing off in favor of working on projects.

Updated Site

I rebooted my personal site, essentially starting from scratch. The design isn’t finalized, but I like the direction it’s going in!

Things to do:

  • Make the site handle better on mobile
  • Do a writeup on the cool spinner that I made with JavaScript and CSS for the front page
  • Translating the design to this blog for a unified feel
  • Create a projects page rather than just linking to GitHub
  • Create a month of code gallery

EDIT: I updated my site to better support mobile browsers and small screens. New features include: setting the viewport width, so the content is prominent on mobile sites, creating a responsive menu, and fixing the interests spinner to work properly on small screens.

Month of Code 14 – Loop

HAPPY PI DAY!

In honor of this day, I decided to make a pi-related loop hack. Don’t take the results to seriously, but it’s a fun little demo.

The code for the loop is using the Leibniz approximation of pi. The for loop uses

var pi=0;
var n=1;
for(var i=0;i<100000000;i++) {
    pi=pi+(4/n)-(4/(n+2));
    n = n+4;
}

The while loop looks like this:

var pi=0;
var n=1;
var i=0;
while(i<100000000) {
    pi=pi+(4/n)-(4/(n+2));
    n = n+4;
    i++;
}

Informally, my testing showed that the while loop was consistently just a hair faster.

Month of Code 11 – ASCII

I’m going off-canvas today! Today’s entry is an ASCII background generator. It’s really quite straightforward. The background is really just a div. The background color of the div and the font color are similar to create a cohesive feel. The div is then filled with random characters from the ASCII set, codes 33-255 (uses the extended ASCII table). Over top of that, a slight blur is applied so the user can’t immediately distinguish the characters.

I think it turned out pretty well! You can even try resizing it – the background will respond, giving almost a static-like effect. The concept is actually pretty simple and significantly lighter weight than a full-screen image, but provides a similar effect. Additionally, it would be pretty simple to change colors and character sets, and I’ve even considered subtle patterns as well, but didn’t really have time for it today. Look for this in the future.

EDIT: Added a few color variations and two additional basic patterns!

Month of Code 10 – Switch

Today’s theme connection is most definitely a stretch, but I wanted to do a little work on something I started a long time ago, a space shooter. This space shooter is built using the Animatron player, a tool built by the company I worked for over the summer.

The shooter, just like yesterday’s submission, just contains some basic game features and is nowhere close to a full product, but what I’ve got is pretty decent. The background is randomly generated, the “spaceship” can move up and down, and fires bullets. The “switch” tie-in is a stretch, but when the ship fires, the ship switches colors. The idea would be that the shot style changes with each shot. Like the Raiden series, but a little more rapid.

Give it a whirl!

Month of Code 9 – Jump

Have you ever played Thomas Was Alone? Today I played it for the first time, so naturally this was my inspiration for today’s daily code.

Month of Code 9 – Jump

The controls are either wasd or arrow keys, and spacebar to jump. The red rectangle (AKA “Thomas”) is bounded by the sandbox, but the idea would be to add an environment as a 2d platformer.

Edit: I added some basic randomly generated terrain as a demo.

Month of Code 7 – Input

Today I wrote a quick little input chart. The x-axis is time as it passes, and the y-axis is change in cursor position (using Euclidean distance). Rather than reinvent the wheel, I used Smoothie Charts to handle the graphing aspect. All I did was track the mouse position and generate the data to throw onto the chart.

There’s an interesting bug that I’m working on. Currently, it’s working properly for a few seconds (about 5), and then it seems to zero out the change value every other data point, generating a very noisy graph. I’ll be taking a look at this later tonight in more depth to try to fix it.

Demo here.

Month of Code 6 – Time

Today’s theme was Time. I went literal again and made…a clock. It’s not your ordinary clock, but it’s pretty close to it.

Month of Code 6 – Time

My largest challenge was initially trying to calculate the triangles to draw, but then I decided to just draw arcs (the canvas crops the rest). Outside of that, the program is straightforward. Each hour is based on a root color from an accented analogic set of colors. For each “minute” section, the root color is then shaded to add a little more dynamic feel to it.

In case it’s not clear, the longest hand is the seconds, the middle-sized is the minutes hand, and the short wide one is the hour hand.