Skip to content

Instantly share code, notes, and snippets.


Johannes Holzfuß DataWraith

View GitHub Profile
DataWraith /
Created Jul 22, 2020
Solve LunarLander-v2 using CMA-ES
#!/usr/bin/env python3
""" Solve LunarLander-v2 using CMA-ES.
This code solves the LunarLander-v2 environment from the OpenAI gym using CMA-ES.
You need to pip-install the packages numpy, gym[box2d] and cma in order for it to work.
It doesn't seem to solve the environment in every run, but if it does, it
DataWraith /
Created Jan 23, 2019
A high-level description of my Halite III bot.


This is a high-level description of my Halite III bot. At the time of writing, a few days before the end of the competition, it has a rating of slightly over 74, which puts it at rank ~115.

Bot description

The bot is based on Value Iteration and Uniform Cost Search for mining halite and returning it to the nearest dropoff. Dropoffs are not pre-planned -- a ship

DataWraith / FizzBuzz.exs
Created Aug 6, 2017
Flexible FizzBuzz implementation using Streams in Elixir
View FizzBuzz.exs
defmodule FizzBuzz do
@moduledoc """
FizzBuzz outputs integers interspersed with configurable words
at configurable intervals.
def fizzbuzz(count, words \\ [{3, "Fizz"}, {5, "Buzz"}]) do
DataWraith / fizzbuzz.clj
Created Mar 3, 2017
FizzBuzz using lazy seqs in Clojure.
View fizzbuzz.clj
(ns clj-fizzbuzz.core
(defn hitword
[word n]
(cycle (cons word (repeat (dec n) nil))))
(defn fizzbuzz
(let [fizzes (hitword "Fizz" 3)
DataWraith / Main.elm
Last active Feb 22, 2017
Simple two-player Go-Moku game written in Elm
View Main.elm
"dependencies": {
"eeue56/elm-flat-matrix": "3.0.2 <= v < 4.0.0",
"elm-lang/core": "5.1.1 <= v < 6.0.0",
"elm-lang/html": "2.0.0 <= v < 3.0.0",
"elm-lang/svg": "2.0.0 <= v < 3.0.0"
"elm-version": "0.18.0 <= v < 0.19.0"
DataWraith /
Created Feb 8, 2017
Simple image regression using Tensorflow and an ad hoc network that turned out to work well
import math
import tensorflow as tf
import numpy as np
import tensorflow.contrib.slim as slim
from scipy import misc
class IMR(object):
def __init__(self, sess, channels = 3):
self.sess = sess
self.num_channels= channels
DataWraith /
Created Dec 11, 2016
SARSA implementation for the OpenAI gym Frozen Lake environment
import gym
import numpy as np
# This is a straightforwad implementation of SARSA for the FrozenLake OpenAI
# Gym testbed. I wrote it mostly to make myself familiar with the OpenAI gym;
# the SARSA algorithm was implemented pretty much from the Wikipedia page alone.
env = gym.make("FrozenLake-v0")
def choose_action(observation):
View scrape_zim.go
package main
// This program takes a .zim-file and dumps all contained articles below the
// current directory. I tested it with a Wikipedia snapshot; that did not
// contain deleted articles or LinkTargetEntrys, so I'm unsure how to handle
// those, for now I'm ignoring them.
// Redirects are handled by simply writing out the page pointed to by the
// redirect. IPFS deduplication should take care of it, so I think this is the
// most economical solution, even better than writing out small HTML files with
DataWraith / koremutake
Created Feb 7, 2014
A simple passwort generator based on koremutake
View koremutake
#!/usr/bin/env ruby
require 'securerandom'
# Generates a random password made up of NUM_SYLLABLES koremutake syllables.
# See for more on koremutake.
DataWraith /
Created Apr 5, 2013
A rock-paper-scissors player written in Python for As of April 2013 it was ranked 85th out of 1318 contestants.
# This entry is based on Prediction by Partial Matching, a method that is used
# in data compression.
import random
from collections import defaultdict
if input == "":
# Initialize data structure