Saturday, 29 December 2012

Melc


Every life form wants to live, naturally, but as our lifespan is limited the next best thing we can do is making sure our species survives. This applies to programmers too, as a species. For some time I've been haunted by the thought that I'll never be a real programmer until I write a compiler and the species metaphor I've come up with 5 minutes ago made a lot of sense. Joking aside, now I'm going to present Melc, a compiler-compiler.

Melc is a compiler-compiler or compiler generator that builds a recursive descent parser corresponding to whatever grammar it's been given. The grammar is written in SEBNF, which is a variation on EBNF. The specification including some examples is available on GitHub. I'm going to go on developing this and writing more examples in the year to come.

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

Friday, 27 July 2012

Hello Tarflex, RU gets updated and wiki page on Esolang

First of all, I'd like to introduce you to Tarflex. It's a reflective Turing tarpit. In short the whole program is treated as a list of lists consisting of simple instructions, and some of these instructions can perform operations on the lists.

And second of all, I've added the ability to export RU programs as HTML tables or Wiki tables.
RU has also made it on Esolang - probably the best resource for esoteric programming languages --> link

Here's an HTML table!
                          
    >>>>>>++ v            
   v<<<<<<++ <            
   > ><<>>>> +  << +   v  
     v     +>>   -<<<< <  
     >>> ->> +  >> -   v  
   ^        -->> v #>> <  
                          
                          
                          
                          
                          
                          

Saturday, 21 July 2012

RU online interpreter is up and running

It's been almost 2 years since I devised Robot Unlock. Due to the positive feedback and seeing how people shared solutions for levels online I thought Robot Unlock is a fun toy language and deserves more development. That is why I have made an online interpreter for the language. You can program in it and share your marvels with others.

In the future I will add more instruction sets (some more expressive, some more restrictive and some quirky ones too).

Mudboy salutes you!

Saturday, 14 July 2012

From Under the Rock

This is my entry for miniLD #36 (Contrast)
Download link for Windows/Linux/OSX + Source: http://gamejolt.com/open-source/games/other/from-under-the-rock/8666/
Explore, listen, see, taste.

Monday, 2 July 2012

Global Optimization to the max!

GOAT, or Global Optimization AT is a framework/sandbox for testing of global optimization algorithms. I've started tinkering with optimization algorithms back in feb 2011 and this whole thing ended up becoming my bachelor's thesis. Now I think the project is mature (ok, it still needs some tidying up) and modular enough so that others can build on it too. That's why I have released it under the GNU GPL on GitHub. https://github.com/madflame991/gloptat

Thus far its main components are:
  1. A function plotter to see how objective functions look like and why they're so much of a challenge. It also points out where candidate solutions are at every iteration in the search space
  2. Basic benchmarking features - so that one can compare the performance of different algorithms
  3. An implementation of Genetic Algorithms and many variations
  4. Here's a list of operators and variations implementd thus far:

    • [Standard stuff]
      Tournament and Roulette wheel selection
      Singlepoint, 2-point and uniform crossover
      Uniform mutation

    • [Not so standard stuff]
      Population reduction
      Random immigrants
      Iversion

    • [Unique* as far as I know]
      Biased crossover (inheriting the significant part of a chromosome from the better parent)
      Non-uniform mutation with dynamic parameters
      Growth (a hillclimbing step each generation)
      Some methods to adjust selection pressure at runtime ("Damping functions")

      *I haven't found any mention of the last 4 variations. As far as I know they're my original contributions, but I'm sure someone else interested in the field has thought of them already and documented these...

  5. An inplementation of the Particle Swarm Optimization algorithm and variations.
    Here are some features implemented for PSO:

    • Nighbour networks
    • Population reduction
    • Random immigrants

...and here's a list of things I'm planning to implement:
  1. Split the application in 2 parts: one entitled "demo mode" - this should be used to see how the simulation progresses with fancy 3D graphics and one entitled "benchmark mode" for well... benchmarking. It will probably run simultaneous jobs to minimize the time it takes to benchmark
  2. Add more objective functions
  3. Add more optimization algorithms

Monday, 21 May 2012

Sword and Circle for miniLD 34

I managed to participate in the miniLD this weekend and I came up with the game you can see in the image here. It's a  simple tactical game with swords and circles. Surprisingly enough, I also managed to pass all my exams...
And speaking of LD, it came as a nice surprise that my LD23 entry came in 22nd in the Humor category, out of 1072 submissions. That means I'm in the top 2%, which is awesome!

Play Sword and Circle game here: http://madflame991.blogspot.com/p/sword-and-circle.html

Link to Sword and Circle LD submission: http://www.ludumdare.com/compo/minild-34/?action=preview&uid=5035

Tuesday, 24 April 2012

Space Bear is up and running

"Flying around a bear-head with 6 stars trailing behind it is quite a sight." Ergo

I've managed to upload the game to this blog (which was pretty tedious having in mind Bloggers' limitations...). So instead of downloading the game from GameJolt (which is currently offline) you can play it here --> http://madflame991.blogspot.com/p/space-bear.html


Sunday, 22 April 2012

Space Bear - my LD23 submission and 10th released game

For now I'm just going to post a screenshot and a download link. I'll upload the game to the blog as quick as I can...
Download from --> http://gamejolt.com/open-source/games/space-bear/files/space-bear/download/7747/9813/


Sunday, 15 April 2012

Functions meet Particle Swarm Optimization, Gears meet Update, LD 10 year anniversary


I've posted a little demo showing a Particle Swarm Optimization algorithm in action. Check it out here!

...and I've also updated the "More Gears" thingie. It now supports gears that orbit other gears and I've added  examples to go with this.

And in other news, Ludum Dare 23 is coming up between April 20th - 23rd and it's going to be big since it's the 10 year anniversary edition. Woohoo!

Saturday, 14 April 2012

2 gear problems


Consider two gears placed as illustrated in the first picture below. The bottom gear is fixed (it can not rotate or move in any way). The top gear is not fixed and can spin around the bottom gear while maintaining contact (thus spinning around its own axis).
Try to answer the following questions:

a. How much will the free gear have spinned around its own axis if its initial position is that in fig. 1 and its final position is that in fig. 3?

b. Solve the same problem, but for gears with different radiuses.


Monday, 9 April 2012

Let there be more gears!

This is a 3 hour experiment I've been cooking -->
http://madflame991.blogspot.com/p/more-gears.html

There are 3 mechanisms so far and more will come (you can also build your own). I hope to add gears that spin around other gears, some form of latches (yeah, I'll try to make something Turing complete out of these) and more geary stuff to it.

Sunday, 1 April 2012

Cube Cube Cat is here

This is why I haven't been updating Langtonia in the past month or so, I was hatching Cube Cube Cat. It's my take on arena shooters like Robotron: 2084 and Mutant Storm.


Cube Cube Cat is near




Wednesday, 15 February 2012

Langtonia guide - Part 2: Mobs

Now you don't have to guess anymore what mobs do - you can read all about it in part 2 of the guide. It has just been uploaded --> link

Saturday, 11 February 2012

Langtonia update: v0.1.4

As promised, I have resumed working on Langtonia after my exams.
Version 0.1.4 adds collision between mobs. In the future they will be able to interact more with each other. Sand generation & poisonous berries are next on my priority list.

Download the latest version from: http://gamejolt.com/freeware/games/other/langtonia/6884/

Thursday, 2 February 2012

Langtonia: upcoming features

I haven't abandoned Langtonia, it's just that I'm in my exam period and I don't have too much free time. I've been working on adding collisions between mobs -  in the future expect to see them interacting, eating each other...

Also, on my to-do list:
+ rewrite sand generation
+ allow multiple saves
+ add snakes

In the meantime here's a screenshot

Sunday, 15 January 2012

Langtonia gets creative mode

Changes in this version (0.1.4):
+ added creative mode
+ fixed some bugs
+ zombies now see you from farther away
+ executors die if they don't move for too long

Friday, 6 January 2012

Langtonia update, manual and news!

Good news, everyone! Robot unlock has been reviewed on DIYGamer.
Since Langtonia's release I've been tinkering with the graphics a little and it now looks nice and crispy. I've also mended the game a bit. Expect to see more updates in the future.
Also, the game lacks any in-game instructions so I've started to work on an online manual. The first sheet covers the basic terrain tiles. Link --> http://madflame991.blogspot.com/p/langtonia-guide-part-1-blocks.html

Sunday, 1 January 2012

Langtonia release


Download it from --> http://gamejolt.com/freeware/games/other/langtonia/6884/


Your goal is to survive as long as you can.
Eat berries to stay alive or seek light sources. Minerals located in mountains can be dug out and turned into light sources. Some monsters process minerals, some turn into bushes, some follow you and hunt you down.

This is a project I'm going to be working for some time and this is the first playable version.
I've made it because I love Minecraft but I think it's too easy - in Langtonia it's much harder to survive. ...and you can't build self-replicating structures/mechanisms in Minecraft, but you can in Langtonia!