Monday, 19 November 2012

Saturday, 17 November 2012

Amandine

Rewriting rules:


Input string:


Output string:



Amandine is a string-rewriting system.

The input given is rewritten accoding to the specified rules. This is how the process goes:
The first rule is applied repeatedly to the string until no more changes are made. Then the second rule is applied, followed by the third and so on. This process is repeated until the string can not be modified with any of the rules anymore. Rules are of the form source -> replacement where source is a JavaScript regular expression and replacement is a normal string. Lines that start with a ; are ignored.

The default example shows how sorting a sequence of numbers is possible.

Sunday, 7 October 2012

OpenCL Experiments

While there are many applications (not necessarily scientific ones) for OpenCL and the technology has been available for some years, I have yet to see any piece of software that took advantage of this. There aren't even many tutorials and books on OpenCL. Now, I'm no expert but I thought I could make some OpenCL demos and share them on Github. Here's what I have so far:

  • Simulation of repulsive particles - similar to the n-body problem, except here all particles want to stay apart and all particles are attracted to just one. This makes them chase each other which results in some neat patterns and dynamics.
  • Hillclimbing! - the hillclimbing algorithm is a very simple stochastic optimization algorithm. The algorithm can be described as follows: a dwarf is placed in the search space (the hills). The dwarf chooses a random direction and goes that way as long as he keeps climbing, after which he chooses another direction and does that until he's on top of the hill. Obviously the hillclimbing algorithm is prone to getting stuck in local maxima, but that's where OpenCL comes in to save us: initialize N parallel hill climbers (dwarves) from random positions in the search space. Thus, we get N local maxima, one of which is the global maxima (hopefully).
  • Particle Swarm Optimization (actually Parallel Asynchronous PSO) - I've already covered PSO in this online demo and extensively in my Bachelor's graduation thesis and Gloptat. PAPSO is more suitable for the GPU since synchronizing "threads" is costly. There is also no clear disadvantage in using asynchronous PSO and there are even scientific studies that show how reliable PAPSO is. PAPSO is even closer to what it simulates, to the natural model.
  • Shadow demo - it's just a little demo showing a simple way to compute shadows using rays. It also shows how you can have more than one kernel on the same context/queue and that they can use the same allocated global memory without issues.

Tuesday, 4 September 2012

RU gets reflection, GOAT gets full benchmarking functionality

RU
+ added instruction for sending commands to the other Executor. Executors can now control each other.
+ added instructions for telling the other Executor to place or erase instructions on the "playfield"
+ added a much needed instruction for synchronizing Executors

Now that the language is reflective it's probably even harder to make a compiler for it than for Befunge.
Check it out here: http://madflame991.blogspot.se/p/ru-online-interpreter.html


GOAT
+ separated the application into 2 parts: one for visualising how simulations advance and one for benchmarking which launches simulations in parallel and outputs much more detailed results (output in CSV, XML and JSON formats are in the making)
+ added proper classes for intervals and function domains
* streamlined some sections

Check it out on GitHub: https://github.com/madflame991/gloptat

Sunday, 2 September 2012

Homo Vermes for LD #24

Evolution was finally voted for this LD event.
My entry is called Homo Vermes and it's something between Pipe Mania and Entanglement

Check the entry here: http://www.ludumdare.com/compo/ludum-dare-24/?action=preview&uid=5035
...and play it here: http://madflame991.blogspot.se/p/homo-vermes.html

Wednesday, 22 August 2012

LD coming up - particles activate!

In less than 48 hours a new LD begins and this time I've prepared a little library/framework for particle systems.

After seeing an awesome speech by Martin Jonasson and Petri Purho I am now convinced that there can never be too many particles on the screen. They're mesmerizing, fun to program and make your game JUICY.
I've implemented 7 types of particles and 3 types of emitters, but as I use it I'll add more.

Still, screenshots don't do this justice so check the thing in action --> link

Saturday, 4 August 2012

Lindenmayer power update

Here's an update for Lindenmayer power! I've rewritten the whole thing and switched from simple context-free grammars to stochastic context-free grammars. The turtle commands have been streamlined and I've also added some new commands. Now you can change the colour of the lines, their thickness and you draw little squares and text.
Link --> http://madflame991.blogspot.ro/p/lindenmayer-power.html