Michael Fogleman


Projects tagged "c"

Hopefully something here will catch your eye.

Table of Contents

Mister Queen October 2014

40 C Game AI

Mr. Queen is a nice little chess engine written in C.

I wrote my first chess engine back in college. It didn't play very well because I never really figured out the advanced search techniques. More recently, after a long hiatus, I tried my hand at writing a chess engine again, and Mister Queen is the result. It's pretty weak among computer chess engines, but it can beat me handily. Features include:

  • Bitboards and "magic" bitboards for board representation and super-fast move generation.
  • Custom, hash-based opening book based on over three million games from the FICS database.
  • Zobrist hashing and a transposition table storing exact values and the best move.
  • Null move pruning, aspiration windows, iterative deepening, quiescence search.
  • Supports the Universal Chess Interface (UCI).
  • Passes all perft tests.

David Kopec used Mister Queen in a chess app for the Apple TV! Read what he wrote about that here.

AllRGB March 2014

25 Python C 2D Graphics

Generate images that use all 16,777,216 RGB colors exactly once.

Efficiently create AllRGB images that target an input image. The input must be 4096x4096px. The output will also be 4096x4096px and will contain all 16,777,216 distinct RGB values once and only once.

See allrgb.com for details on the concept.


Graph Layout February 2014

64 Python C Graphs Optimization

Experimenting with graph visualization using simulated annealing for layout.

Graphviz is the main player when it comes to graph visualization. But its output isn't very appealing, at least not by default. With this in mind, and being a fan of simulated annealing, I experimented with using annealing for graph layout. The results are pretty good, but it probably doesn't scale very well. The algorithm basically tries to minimize the following metrics, with different weights applied to each:

  • Node-Node Intersections
  • Node-Edge Intersections
  • Edge-Edge Intersections
  • Edge Lengths
  • Total Graph Area
  • Node Rank Violations

Craft April 2013

4,465 C Python Game OpenGL

Minecraft clone for Windows, Mac and Linux.

A very performant Minecraft clone written in just a few thousand lines of C using modern OpenGL (shaders). Online multiplayer support is included using a Python-based server. Many people have used this as a base upon which a more complex game was built.



DCPU-16 April 2012

34 Python C Emulator

An assembler, disassembler and emulator for the virtual DCPU-16 written in Python and C.

The DCPU-16 was intended to form the basis of a video game by Mojang called 0x10c. Work on the game has since discontinued, but at the time there was a lot of excitement around this virtual hardware.

Implemented Specifications

  • DCPU-16 1.7
  • LEM1802
  • Generic Keyboard
  • Generic Clock

Ricochet Robot February 2012

31 Python C Game AI

Implementation of a board game called Ricochet Robot including a GUI and a very fast solver.

My friend introduced me to a board game called Ricochet Robot (or Rasende Roboter in its original German form). It's a fun game, but I found it even more fun as a programming problem. I implemented the game in Python, including a user interface and a solver. After that, I sped up the solver tremendously by porting it to C. My solver includes several "tricks" that make it quite fast. See these slides for more details.