Archive for Algorithms

Koch curve AS3 experiment

A simple Koch curve experiment in AS3, port from Java version. Koch curve discovered by the Swedish mathematician Helge von Koch in 1904.

Origin Java code: Computer Graphics for Java Programmers by Leen Ammeraal and Kang Zhang

You can download AS3 source code to try: koch.zip .

Game Algorithms

I’m checking game algorithms these days. Found a lot funny things and some not good enough or fit with Flash. Most of traditional algorithms are run directly on OS so there’s no much limitations for the speed and CPU/memory usage, but Flash not the case. Though it’s interest to try different algorithms and I could also get some ideas from those.

Algorithms are mathematics involved. But it could be trade-off and not necessary for all details due to my time. Some time I will try to look on math equations but most time I will directly to code them in Actionscript 3 first and see whether I understand and comment directly.

I saw some code written in C as someone discussed it as much effective than regular ‘best practise’ C code. He said it’s because those codes got idea from Assembly actually. Of course if you code C with assembly method, you could check the machine code (read: mov, add, goto) and you know they’re effective or not. But for Flash, it’s a little bit more hard. Maybe if some day I found an algorithm if necessary to be optimized, I will try to read low level code (similar to read Assembly) with the decompiler provided by Adobe. Also have to have some experiential testing.