Some random programs I wrote (Part II)

March 6, 2019

Unrelated note: I turned 30 today and am currently at the final stage of deciding between offers for my next career (very exciting times & stay turned for updates =) )

42 profile as of March 6th, 2019

Somewhere in the middle of my time at 42, I took a “C++ piscine”, graduated from C to C++ and started writing object oriented programs. This post will give a pictorial outline of a few of those later projects. Again, most of those are 2-man projects I shared with my coding companion Liam Dehaudt.

Hashgraph

https://github.com/conanwu777/hashgraph

This is an off-the-galaxy project “custom created” for us by a guy named Gaetan who run the school here. The goal was to understand this paper, which presents a consensus algorithm comparable to block-chain and implement a small scale version of the system.

Hashgraph visualizer in action (intentionally slowed down for clarity)

In the example above we have 6 nodes in the network, they randomly ‘gossip’ to each other with gossips potentially carrying a payload. Every local graph is then updated through the gossip. New nodes representing the event of the gossip is added on (blue nodes), every ’round’ there is a layer of ‘witness nodes’ (red); when witness was well know they become ‘famous’ (yellow) and the famous witnesses then vote for the authenticity of other nodes (once nodes are approved, they turn green and is then logged into the database). If nodes are not approved (i.e. error or fraud), they will turn grey and a waring will be printed. We also implemented our own MD5 hashing algorithm to use for all connection and signatures.

Museum of Shaders

https://github.com/conanwu777/Museum_of_Shaders

A cool graphics project exploring the fantastic world of openGL fragment shaders (i.e. using a single shader applied to a quad to render things line 3 dimensional fractals). We place shaders in a museum environment (Which I definitely did not steal from the British Museum Elgin marble room) by using billboards to fake 3D and switch between two different display/perspective systems when far away and close to the shaders.

As some may have picked up, I was able to put in some not-so-subtle references from mathematics, the shaders exhibited are:

  • Mandelbox (the scale multiplier changes over time)
  • Mandelblub
  • Sierpinski’s tetrahedron
  • IFS based on Sierpinski symmetry
  • Semi-transparent Quaternion Julia set (4th dimension evolves over time)
  • Cloud with Volumetric ray-marching
  • Structure generated by Kleinian group in 3D torus
  • Galaxy (2D shader)
  • Kaleidoscope (2D shader with octagon symmetry)

Was a lot of fun playing with shader ray-marching to get them to work =) & in the process I have discovered some amazing online fractal and shader enthusiast communities such as ShaderToy.

Voxel World

https://github.com/conanwu777/Voxel_landscape

Sunset from a mountain top

Generated infinite Minecraft style terrains using a few layers of Perlin noise. Optimized in openGL by making block meshes etc. I had lots of fun making landscape look natural, included snow, mountains, grass, sand, water, trees and caves.

Moving, running or gliding through the world

Gomoku

https://github.com/conanwu777/GomokuAI

An AI capable of playing the classical board game Gomoku along with an implementation of the game mechanisms and UI.

We implemented a version of minimax algorithm with Alpha-Beta pruning enhanced by killer heuristics. One of the rather unconventional idea used was, to reach higher search depth and take full advantage of the entire game time as a real player would, I decided to make a parallel thread which continuously search and hash moves back-stage while human player is thinking, then we are able to cap the return time at 0.5 seconds once player placed a stone by iterative deepening.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: