Coding

I have enjoyed coding since my childhood. While I have coded in a variety of programming languages, I usually reach for C++ and Python. I love problem solving and tinkering around until I end up with something that works. Below are my two most recent projects.


rela-tracer

I've been busy wri­ting a rela­ti­vis­tic ray­tracer: a (physics-based, sto­chastic) ray­tracer which incor­porates the effects of special relativity. Below are a couple of videos I generated using rela-tracer. They showcase, in particular:

  • the relativistic Doppler effect: The color of incoming light is red- or blue-shifted, depending on the relative movement and position of emitter and receiver.
  • relativistic aberration and its most famous consequence, the headlight effect: Angles are distorted when transforming from one restframe to another, leading to the effect that a fast-moving light source emits predominantly along its direction of movement.
  • artefacts of light travel time: different light travel times lead to apparent distortions in the image. In particular, objects are often ahead of their mirror images, and looking through dielectric media such as glass or diamond leads introduces a time delay.
This scene showcases the relativistic Doppler effect. The three balls all emit the same spectrum of light in their rest frame: the bright green exhibited by the stationary ball in the middle. The top ball appears blue because it is moving towards the camera, and the bottom ball appears red because it is moving away from the camera. In the mirror at the back left, the balls swap colors, because the relative movement of their mirror images is the opposite to their actual relative movement to us. (The mirror is darkened so it may be seen more easily against the background.)
Two identical light-emitting balls travel downwards. The view towards the left ball is blocked by a box made of glass (top) and a box made of diamond (bottom). Light travels more slowly in these media, hence the image of the obscured ball behind them is time-delayed. The Doppler effect further leads to apparent colour changes: The balls appear to become redder the further down they move because of the change in angle between the incoming light ray and the movement direction of the balls. The images of the left ball under internal reflection exhibit further Doppler shifts.
Three identical diffusely scattering balls are placed inside a box. The left and right side of the box emit light (the remaining four sides are made of fuzzy metal). While the middle ball is illuminated evenly, the travelling balls are experiencing an `inverse headlight effect`: Just as moving emitters send light predominantly along their direction of movement, moving objects receive light predominantly along the opposite direction. This leads to the travelling balls being illuminated mostly on the side they are moving towards. Further, the colors of the scattered light are Doppler shifted.

hexbot

I have been working on an AI which learns to play the game Hex, together with Chris Dorn. The main idea of this project was to hand-code Proxi­mal Policy Optimi­zation (PPO) in pytorch. We achieve learning through self-play by following an evolution-style algorithm: hexbots collect sample data by playing against a specified pool of fixed opponent policies and train on them using our implementation of PPO. After a fixed amount of training, we start a new generation: The policies learned by the bots are added to the opponent pool, the worst performers are discarded and the best performers multiplied. Our implementation further features monitoring capabilities that allow inspection of play between two trained bots.

The end position of a game of Hex played by two hexbots.