Skip to content

Instantly share code, notes, and snippets.

@Ohohcakester
Ohohcakester / sample_game.cpp
Created May 17, 2016 23:33
A Sample SFML Game - used as a compilation test.
#include <SFML/Graphics.hpp>
#include <iostream>
#include <string>
#include <sstream>
// Globals
sf::RenderWindow* window;
int RES_X = 800;
int RES_Y = 600;
@Ohohcakester
Ohohcakester / sample_minimal.cpp
Created May 17, 2016 23:31
A minimal SFML sample
#include <SFML/Graphics.hpp>
#include <iostream>
int RES_X = 800;
int RES_Y = 600;
sf::RenderWindow window(sf::VideoMode(RES_X, RES_Y), "Sample Game");
int main() {
std::cout << "Success";
}
@Ohohcakester
Ohohcakester / hornfc.py
Created May 24, 2015 05:44
Forward Chaining algorithm for solving HORNSAT. I made this to visualise how the FC algorithm works.
import random
#horn clause: at most one true
pGoal = 0.1
def randToVar(val, vars):
val -= vars
if val >= 0:
val += 1
@Ohohcakester
Ohohcakester / dpll.py
Created May 24, 2015 05:42
DPLL algorithm for solving 3-SAT. I made this to visualise how the algorithm works. In the backtracking search, variable selection is done by lowest entropy score, domain value [true,false] ordering is done by choosing the value which satisfies the most clauses first.
import random
import math
def randToVar(val, vars):
val -= vars
if val >= 0:
val += 1
return val
def randClause(vars):
@Ohohcakester
Ohohcakester / javacombiner.py
Last active April 15, 2024 20:57
A simple java project combiner to merge all of your .java files into one nice, long single-file java program. Probably doesn't work with abstract classes yet.
import os
folderPath = 'InsertDirectoryPathHere/src/'
# mainFile is the file containing the main class.
mainFile = 'ProjectMainClass.java'
# exclude these files from the project.
excluded = ['State.java', 'Frame.java', 'Label.java']
def printSafe(s):
s = str(s).encode('ascii', 'ignore')