chaostangent

Posts with the “Code” tag

Spiffy!

Short version: if you enjoyed a post and don’t want to comment, click the Spiffy Button to let me know.

Feedback from people on the internet is hard; I can monitor hits and visits and bounces and loading times until the heat death of the universe and I still wouldn’t know whether the people visiting my site enjoy my content. Comments are often cited as a good indicator of blog interaction, some would say that a blog starts when its comments do, but especially with anime blogs (which I guess given the volume of content on the subject I’ve produced, mine falls into) comments tend to be about the subject (episode, series, movie etc.) rather than about what has been written. Just check out any well frequented anime blog (RandomC, The Cart Driver, Metanorn et. al.) for examples.

Read the rest of this entry

Anime barcodes

I’ve been keeping up with Noragami (Stray God) this season and got to thinking about the colour palette used in the show. To my eyes it has a cold, wintery palette without being obnoxiously colour graded (looking at you here GoHands). This is different from other shows set during winter (Mikakunin et. al.) that still manage to stay bright and cheerful, perhaps thanks to luminous hair colouring but that’s an aside. I idly wondered if there was a way to get a high-level view of a series’ colour palette without resorting to wooly adjectives?

Short version, kind of:

Long version, not really.

Read the rest of this entry

Announcing n.adesi.co

Because the world needs another URL shortener: http://n.adesi.co/

Not as short as many others but anime related. At the moment it's very lo-fi and doesn't have an API or any integration points so it isn't currently compatible with your favourite Twitter client - this will come soon enough along with stats and other paraphernalia. Built from scratch in less than a couple of hours so any bugs drop me a line, likewise with feature requests, otherwise enjoy.

Edit: Forgot to say, it is currently gathering data, so once a frontend is built existing links will reveal their stats.

Read the rest of this entry

50 frames of Life

My Sunday afternoon project wasn't something that I could just let lie and it didn't take long for work to start on it again. Using the list of improvements I had identified, I began with the aesthetics and then moved on to other, more number intensive areas of research.

Before even touching the code I subsumed everything into a Git repository; I'm a long time Subversion user but relatively new to Git so I still regularly refer back to the "Git - SVN Crash Course" which is pleasantly concise. With this done, I attacked the GIF output method first:

gameoflife2-sample-1 gameoflife2-sample-2 gameoflife2-sample-3 gameoflife2-sample-4

cooked up in a few hours and wasn't subject to any stringent mathematical basis
First was visibly increasing the size of the cells, I had originally used a multiplier of four for previous iterations but that made them very indistinct, and with only fifty generations it meant a large portion of the space wasn't used. The result was an increase in cell size to seven with a one pixel border: this was the result of a happy accident while crafting the previous post and resulted in the introductory images, however the calculations for the edge cells was incorrect which is why those animations don't appear to "loop"  at the edges as they should. This implementation fixed that and with a vastly smaller environment (only 8x8 with a 5x5 seed), each generation of cells and their progression is easier to see. Next was addressing the colour issue, generating both a background and foreground colour met with mixed results so taking a leaf from WP_Identicon's book, I kept the background colour constant and generated the foreground colour only:

Read the rest of this entry

Sunday afternoon project: Conway's Game of Life in PHP

gameoflife-1 gameoflife-2

As a way of spending my bank holiday Sunday afternoon, I decided to embark on a small project; I didn't know what the project would be when I first began browsing through Wikipedia but eventually I ended up in About.com's C++ challenge section, one of which concerned John Horton Conway's "Game of Life": a rudimentary cellular automaton which, after its inception in 1970, had immeasurable impact on fields as diverse as philosophy and theology. After toying with some ideas, I decided to build a script which automatically creates animations of a number of generations of the game. From that seed the project grew into the first steps towards an avatar system, much like the automatically generated Gravatars that currently adorn so many Wordpress based blogs.

I wanted something that was deterministic and identifiable
The first step was getting the algorithm working, and as I had already decided to make it web-based, that meant a PHP implementation. Using only the Wikipedia page as reference, I threw together a very basic script that allowed me to enter in some settings (grid dimensions, seed and generation limit) and for it to spit out the states between the seed and the generation cut off. After some wrangling with minor bugs (spelling errors, incorrect typing etc.) an unoptimised first version of the algorithm was complete:

Read the rest of this entry