mailerkeron.blogg.se

Automaton tracer
Automaton tracer








automaton tracer
  1. #Automaton tracer generator#
  2. #Automaton tracer full#
  3. #Automaton tracer code#

My first idea was to work as a brainless compiler and cut everything I could. When I started I did not think to learn a lot.

#Automaton tracer code#

For this reason, it not just a code producing a random cave when executed, but it is a (relatively) “complete” library, so it is possible, in theory, to build any N*M map and apply different sets of rules. In fact, I could probably remove many other chars by hardcoding some value, but I prefer to have the code (relatively) scalable and functional. Because I reached this point without doing too much obfuscated stuffs, I decided to keep the code “usable” as much as possible.

#Automaton tracer full#

In a full morning, I reduced the original 3000 chars implementation into a <700 chars version. Most of the work went into reducing the automaton rules into a head-hurting sequence of ternary operators ?:, plus removing/inlining all the unnecessary functions. Reaching this point was not particularly hard.

#include // Info: using i = int template struct minicavem.

The final code ( version 1.1) is shown below: Then I remembered that I already had a C++ code doing something I like (Procedural Content Generation) that is a good candidate for this: my cellular automaton code. Of course, I could not do the same with a ray tracer algorithm I already had my problems with the non-obfuscated version. Even if I never got into code obfuscation challenges -it makes my OCD side to cringe and lay down in pain- I thought it was a nice idea for a business card. In it, he describes his challenge of writing a ray tracer algorithm that fits a business card. The project is going well, however, looking for resources I found this article by Matt Zucker. I decided to do the most unoriginal thing I could imagine: a ray tracer algorithm. Therefore, after updating my internal knowledge base to the most recent standards and best practices, I decided to test it with a small project. I need to keep C++ in my resume, someway. Anyway… C++ is important, in particular for people like me that are in continuous contact with the game developer world. A module system for C++ will never arrive soon enough. It makes my head hurts, it makes compilation slow, it introduces an entire class of compilation errors that I hate to debug, and more. I think the language is cool, especially when you work with the most recent standard, C++14. In the last couple of week I decided to start refreshing my C++ knowledge.

automaton tracer

Why I did that? Let’s start from the beginning. It is my personal approach to “Hello World”: when I want to try a new language, write a PCG algorithm in it.

automaton tracer

I already did it in C++, Rust, Javascript and many more languages.

#Automaton tracer generator#

Yesterday I wrote a cellular automaton based procedural caves generator algorithm that fits in a business card.










Automaton tracer