Skip to content

Instantly share code, notes, and snippets.

@bi3mer
bi3mer / CMakeLists.txt
Created September 7, 2025 13:59
BOIDs Visualization with Raylib
cmake_minimum_required(VERSION 3.11) # FetchContent is available in 3.11+
project(cpp-boid)
# Generate compile_commands.json
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set (CMAKE_CXX_STANDARD 23)
# Dependencies
set(RAYLIB_VERSION 5.5)
find_package(raylib ${RAYLIB_VERSION} QUIET) # QUIET or REQUIRED
if (NOT raylib_FOUND) # If there's none, fetch and build raylib
include(FetchContent)
@bi3mer
bi3mer / sorting_visualization.cpp
Last active August 18, 2025 13:03
c++ and raylib sorting visualizaiton
#include <algorithm>
#include <array>
#include <print>
#include <random>
#include "raylib.h"
const int RECTANGLE_HEIGHT_MODIFIER = 10;
const int SCREEN_WIDTH = 800;
const int SCREEN_HEIGHT = 450;
@bi3mer
bi3mer / bit-sokobon.cpp
Created June 8, 2025 18:25
cpp-bit-sokobon
#include <cassert>
#include <cstring>
#include <fstream>
#include <iostream>
#include <string>
#include <vector>
struct Point {
int x;
int y;
@bi3mer
bi3mer / tarjan.py
Created June 6, 2025 12:29
strongly_connected_components_algorithm
# https://en.wikipedia.org/wiki/Tarjan\%27s_strongly_connected_components_algorithm
def fully_connect(self):
# A vertex is: [index, low_link, on_stack_or_not]
groupings = []
vertices = {}
s = []
index = 0
def tarjan_strong_connect(prior):
nonlocal index
@bi3mer
bi3mer / imp.rkt
Created March 8, 2020 03:30
IMP implemented in Racket Redex
#lang racket
(require redex)
;; from class notes and ":" represents a semicolon
(define-language IMP
(c ::= skip a (c ...) (if b c c) (for x = a to a do c) (x := a))
(skip ::= s (s ...))
(a ::= x av (a O a))
(av ::= number)
(O ::= + - *)
using System.Collections.Generic;
using UnityEngine;
public class GameObjectPool
{
private GameObject gameObject = null;
private Stack<GameObject> pool = new Stack<GameObject>();
public GameObjectPool(GameObject gameObject)
{
@bi3mer
bi3mer / c++_python_bindings.md
Last active October 26, 2017 02:59
C++ to Python Bindings

C++ to Python: Bindings with Swig

This is a quick walk through of how to take c++ and run it with Python through bindings. If you find yourself wishing to learn more on the topic, Swig's website for working with Python is a good start. My experience in setting this up was far more tedious than it had to be and I hope this will save people some time. As a note, I currently work on Ubuntu 16.04 and Python 2.7, this will be tailored to those dependencies, however, I do not believe any major changes will be required to the setup.py file based on Swig's website and a Stackoverflow question for Python 3. In addition, the majority of operating systems should be covered by this walkthrough, with minor tweaks such as yum instead of apt-get for select operating systems.

1. Install

python-dev

sudo apt-get install p

Before starting to create a pull request, please take a moment to consider what a pull request should be. The answer is that it should fix one thing and one thing only. Bigger pull requests take more time and are more complicated to review. With smaller ones higher code quality is assured and will get your work into the repository faster. With that said, let's get started.

Setting Up a Branch

Before creating your branch you should make sure that you have the most up to date version of the repository.

git pull origin master

The style guide is broken into two parts. The first part is on the clear cut details on the style of code such as commenting before each function and using ++i instead of i++. The second part, design, however, touches on more grayer parts of computer programming where we discuss how each function should behave as well as class design for best practices.

Style

Directories

Unity allows us to place our code into different directories. This means there is no reason, whatsover, that our scirpts folder should be filled with one hundred different C# files. This makes it difficult to find file and impossible to

# @author Colan Biemer
from cira.ciragame import *
from random import randint
## Characters
characters = {}
characters['d'] = [[1, 1, 1, 0], [1, 0, 0, 1], [1, 0, 0, 1], [1, 0, 0, 1], [1, 1, 1, 0]]
characters['o'] = [[1, 1, 1, 1], [1, 0, 0, 1], [1, 0, 0, 1], [1, 0, 0, 1], [1, 1, 1, 1]]
characters['g'] = [[1, 1, 1, 1], [1, 0, 0, 0], [1, 0, 1, 1], [1, 0, 0, 1], [1, 1, 1, 1]]