Midgard, Closing Socket Cleanly

Using Ctrl-C to send SIGINT is the easiest and most habitual way to kill a program. When SIGINT is received by a program, unless explicitly handled, the program will be interrupted and close. In this case, the socket we are listening on is not closed cleanly. While not particularly necessary for future development, this becomes obnoxious, as it takes up to a minute for the OS to clean up the open socket, during which a new instance of the program cannot be started. Read more

Tags: C++ , Midgard

Simulated World, Threading

Currently, everything that happens on the C++ backend for Midgard is on a single thread. This includes the static file serving, the websocket handling, and the simulation itself all occur on a single thread. All computation is done at request from the browser, and can’t continue indefinitely, because the thread needs to return to waiting for the next thread. Read more

Tags: C++ , Midgard

Simulated World

A few years ago, I worked on a C++ implementation of NEAT, a method for generating novel neural net topologies. Rather than having a fixed topology, varying only the weights of a neural net, NEAT also varies which nodes are connected to each other. This allows for creation of minimal structures, capable of solving the problem presented without having significant excess neurons. Read more

Tags: C++ , Midgard

Pizza Crust

  • 1 cup warm water
  • 1 package yeast
  • 1 teaspoon sugar
  • 2 tablespoons vegetable oil
  • 1 teaspoon salt
  • 2.5 cups flour
Read more

Tags: Recipes

Cinnamon Bread

  • 1 1/2 cups water
  • 1 packet yeast
  • 3 tablespoons brown sugar
  • 3 tablespoons butter
  • 3/4 teaspoon salt
Read more

Tags: Recipes

Blueberry Pie

  • 1 baked pie shell
  • 1 cup water
  • 3/4 cup sugar
  • 6 tablespoons butter
  • 3 tablespoon flour
  • 2 tablespoons vanilla extract
  • 1 tablespoon almonds extract
  • 1 quart blueberries
Read more

Tags: Recipes

Compiling from emacs

Emacs can launch subprocesses, which can be used to compile code immediately. This is built in with the M-x compile command. It asks for the command to run, then runs it, saving the output in the *compile* buffer. This is remarkably convenient, removing the need to switch between terminal and editor. Read more

Tags: C++ , Make , Emacs

C++ Makefile, Config File

The makefile is starting to get rather large, and so it would be difficult for a user to know all options that are available. At this point, it is time to refactor the options into a separate configuration file. Read more

Tags: C++ , Make

C++ Makefile, Library Folders

Earlier, we allowed each library to have individual compilation flags. Here, we will re-implement this feature in a more flexible way, and allow libraries to specify multiple directories that contain source code. Read more

Tags: C++ , Make

C++ Makefile, C code

So far, we have dealt with C++ code exclusively. Today, I was looking at the makefile, and I realized that it would be quite simple to compile C code as well. In addition, we will generalize the code, so that our C++ files can have file extensions other than .cc. Read more

Tags: C++ , Make