Skip to content

Instantly share code, notes, and snippets.

View ClickerMonkey's full-sized avatar
💭
VPLs, ORMs, and Bag End

Philip Diffenderfer ClickerMonkey

💭
VPLs, ORMs, and Bag End
View GitHub Profile
@ClickerMonkey
ClickerMonkey / Sqrt.java
Last active July 3, 2022 17:57
1/Sqrt VS Fast Inverse Sqrt
import java.nio.ByteBuffer;
public class Sqrt
{
private static float invsqrt0(float x)
{
return 1.0f / (float)Math.sqrt( x );
}
@ClickerMonkey
ClickerMonkey / Elongate.java
Last active August 29, 2015 14:08
Transforms Java code to be as many lines as possible.
import java.util.Scanner;
public class Elongate
{
public static void main( String[] args )
{
Scanner in = new Scanner( System.in );
StringBuilder code = new StringBuilder();
while (in.hasNextLine())
@ClickerMonkey
ClickerMonkey / Veclerp.java
Created September 2, 2014 15:34
Interpolation between two points on a grid. The resulting points from iteration can be imagined as hitting all pixels on a screen that intersect a line that's drawn from any pixel to any pixel on the screen.
public class Veclerp
{
public int x, y;
private int x_inc, y_inc, dx, dy, error, n;
public void start( int x0, int y0, int x1, int y1 )
{
dx = Math.abs( x1 - x0 );
dy = Math.abs( y1 - y0 );
@ClickerMonkey
ClickerMonkey / Shuffle.java
Created September 2, 2014 15:27
Class used to iterate N items as if they were shuffled.
public class Shuffle
{
public int n;
public int[] index;
public long seed;
public Shuffle( int size )
{
this( System.currentTimeMillis(), size );
@ClickerMonkey
ClickerMonkey / Intlerp.java
Created August 30, 2014 00:56
Interpolation between two integers taking N moves without using floats and avoiding division and modulus.
package org.magnos.path;
import static org.junit.Assert.*;
import org.junit.Test;
public class TestIntlerp
{
public class Intlerp
@ClickerMonkey
ClickerMonkey / DriveYaNuts.java
Last active August 29, 2015 13:57
Drive Ya Nuts Game Solver
public class DriveYaNuts
{
public static void main(String[] args) {
new DriveYaNuts();
}
/**
* BOARD POSITIONS
*
* _-1-_
import java.util.ArrayList;
//Saving Maze as Monochrome Bitmap
import java.io.*;
import java.awt.Color;
import java.awt.image.BufferedImage;
import javax.imageio.ImageIO;
import java.io.IOException;
// __ _ ___ _____ _____ ______ _ __ _____
// / | / | / |/ ___// ___/__ __/| | / // ___/
@ClickerMonkey
ClickerMonkey / Array.java
Created December 12, 2013 15:48
Array class (similar to ArrayList) but with reordering options and automatic downsizing.
import java.util.Arrays;
import java.util.Collection;
import java.util.Comparator;
import java.util.Iterator;
public class Array<T> implements Iterable<T>
{
public T[] elements;
public int size;
@ClickerMonkey
ClickerMonkey / SetOperations.java
Created December 11, 2013 12:45
Set operations
public class SetOperations
{
//===========================================================================
// A set is an immutable group of unique numbers ordered from smallest to
// largest. The values in the set must be ordered for all set operations to
// function properly, so don't manually change/re-order these!
//===========================================================================
class Set {
// The ordered set of numbers.
@ClickerMonkey
ClickerMonkey / PointToCube.java
Last active December 29, 2015 03:08
Shader Fun
package com.axe.sandbox.gs;
import java.io.InputStream;
import java.nio.ByteBuffer;
import java.util.HashMap;
import java.util.Map;
import org.lwjgl.BufferUtils;
import org.lwjgl.input.Keyboard;
import org.lwjgl.opengl.ARBBufferObject;