Skip to content

Instantly share code, notes, and snippets.

View BrooksPatton's full-sized avatar

Brooks Patton BrooksPatton

View GitHub Profile
@BrooksPatton
BrooksPatton / conf.lua
Created April 29, 2017 03:15
love2d conf file
function love.conf(t)
t.window.width = 1024
t.window.height = 1000
end
@BrooksPatton
BrooksPatton / mover.lua
Last active May 25, 2017 03:29
Mover class for love2d nature of code
-- GistID: 3f8a0d2a40325dc358cccab2aa124984
local Vector = require('./vector')
local Mover = {}
Mover.__index = Mover
function Mover.new(location, mass)
local t = {}
setmetatable(t, Mover)
@BrooksPatton
BrooksPatton / main.lua
Last active April 29, 2017 03:15
Main love2d for nature of code
local Ball = require('./ball')
local Vector = require('./vector')
local Water = require('./water')
local balls
local water
function love.load()
width = love.graphics.getWidth()
height = love.graphics.getHeight()
@BrooksPatton
BrooksPatton / ld38ideas.txt
Created April 21, 2017 13:55
Ludum Dare 38 ideas
Dark / Light
Infinite runner where you are racing against a wall of light that is following you at increasing speed. There are obstacles and gaps that you have to jump over.
You control the game, not the player
Infinite runner where jumping actually drops the game level down. The farther you go the more points you get, you can use these points to unlock game changes like gravity settings, wind settings, and speed.
Parallel Dimensions
@BrooksPatton
BrooksPatton / lua-class.lua
Last active April 20, 2017 01:25
lua pvector
local Class = {}
Class.__index = Class
function Class.new()
local t = {}
setmetatable(t, Class)
return t
end
@BrooksPatton
BrooksPatton / apps-and-packages.md
Created January 11, 2017 17:40
Applications and packages that I install on a new Mac

Markdown editor

  • abricotine
@BrooksPatton
BrooksPatton / bogosort.js
Created November 7, 2016 19:16
Bogo sort implemented in JavaScript
// Note that this required lodash to work.
function bogoSort(arr) {
while(!sorted(arr)) {
arr = _.shuffle(arr);
}
return arr;
}
@BrooksPatton
BrooksPatton / bubblesort.js
Created November 7, 2016 18:49
Bubble sort implementation in JavaScript
function bubbleSort(arr) {
let temp;
while(true) {
let swaps = 0;
for(let i = 0; i < arr.length -1; i++) {
if(arr[i + 1] < arr[i]) {
temp = arr[i];
arr[i] = arr[i + 1];
arr[i + 1] = temp;
@BrooksPatton
BrooksPatton / insertsort.js
Created November 7, 2016 18:37
Insert sort implemented in JavaScript
function insertionSort(arr) {
let temp;
let i;
for(let current = 0; current < arr.length; current++) {
temp = arr[current];
for(i = current - 1; i >= 0 && arr[i] > temp; i--) {
arr[i + 1] = arr[i];
}
@BrooksPatton
BrooksPatton / selectsort.js
Created November 7, 2016 18:02
Select sort implemented in javascript
function selectSort(arr) {
let smallestIndex;
let temp;
for(let i = 0; i < arr.length - 1; i++) {
smallestIndex = i;
for(let j = i + 1; j < arr.length; j++) {
if(arr[j] < arr[smallestIndex]) {
smallestIndex = j;