Skip to content

Instantly share code, notes, and snippets.

📉
ᕕ( ᐛ )ᕗ I am davloper

Quinlan Pfiffer qpfiffer

📉
ᕕ( ᐛ )ᕗ I am davloper
Block or report user

Report or block qpfiffer

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@qpfiffer
qpfiffer / gist:674796
Created Nov 12, 2010
hashing function
View gist:674796
// I think this works correctly...
int stringSize = strlen(s);
int i(0), j(0);
int runTotal(0);
for(;i<stringSize;i++) {
int temp = (int)s[i];
for(j=0;j<(stringSize-(i+1));j++) {
temp *= 31;
}
runTotal += temp;
View reyes.cpp
#include <iostream>
#include <string>
#include <fstream>
#include <iomanip>
using namespace std;
const int N = 16;
struct Names
@qpfiffer
qpfiffer / TerribleDetection.cpp
Created Jun 30, 2011
Shitty collision detection
View TerribleDetection.cpp
if (floorPads1.floorPadsPlaces[localPlayerPos[2]][localPlayerPos[0]] == 1) {
return 1;
}
else // Redundant but FUCK YOU
return 0;
//glEnable(GL_LIGHTING); //GO TO HELL
newRoomOrigin[i] = newRoomOrigin[i] + newRoomDim[i]; // Just look at it you dumbass
View snippets.cpp
/* This: */
if (((System::Collections::IList ^)filterData->OpenSubKey("day_filter")->GetSubKeyNames())->Contains("days") == true) {
...
}
/* Or this: */
using System::Collections;
...
View cardBS.java
for (int i=0;i<nHands;i++) {
ArrayList<pCard.Card> player = new ArrayList<pCard.Card>();
int playerScore = 0;
for (int j=0;j<cardsPerHand;j++) {
try {
player.add(deck.get(i+(j*nHands)));
} catch (IndexOutOfBoundsException e) {
System.out.println("Not enough cards for that player/hands combination.");
System.exit(1);
}
@qpfiffer
qpfiffer / awesome.xml
Created Jul 21, 2011
BEAUTIFUL XML FOR CAT
View awesome.xml
<?xml version="1.0" encoding="utf-8" ?>
<XnaContent>
<!-- TODO: replace this Asset with your own XML asset data. -->
<Asset Type="DataTypes.LevelData[]">
<Item>
<WorldSize>15 15</WorldSize>
<TileSize>5 5</TileSize>
<WormNum>1</WormNum>
<LineNum>0</LineNum>
<MazeRooms>4</MazeRooms>
@qpfiffer
qpfiffer / awesome.cpp
Created Jul 21, 2011
More .NET beauty, inorite?
View awesome.cpp
for each (Generic::KeyValuePair<String ^, List<String ^> ^> ^item in temp->NameToDataMap) {
if (mergeInto->NameToDataMap->ContainsKey(item->Key)) {
for each (String ^subString in temp->NameToDataMap[item->Key]) {
mergeInto->NameToDataMap[item->Key]->Add(subString);
}
} else {
mergeInto->NameToDataMap->Add(item->Key, item->Value);
}
}
View streakyConcrete.cs
public static void modConcrete(ref Texture2D modify, GraphicsDevice gDevice, Random tRandom)
{
if (modify == null)
throw new Exception("Null texture.");
//float colorFloat = (float)(tRandom.Next(25, 75)) / 255.0f;
//Color bgColor = new Color(colorFloat, colorFloat, colorFloat, 1.0f);
Color setColor;
simplexCarmody simC = new simplexCarmody(tRandom);
double noise = 0f;
@qpfiffer
qpfiffer / concGen.cs
Created Jul 27, 2011
Concrete TextureGen
View concGen.cs
public static void modConcrete(ref Texture2D modify, GraphicsDevice gDevice, Random tRandom)
{
if (modify == null)
throw new Exception("Null texture.");
//float colorFloat = (float)(tRandom.Next(25, 75)) / 255.0f;
//Color bgColor = new Color(colorFloat, colorFloat, colorFloat, 1.0f);
Color setColor;
simplexCarmody simC = new simplexCarmody(tRandom);
double noise = 0;
@qpfiffer
qpfiffer / simplexC.cs
Created Jul 27, 2011
Carmody's implementation of Simplex noise in C#
View simplexC.cs
public class simplexCarmody
{
int[] T;
private static int i, j, k;
private static int[] A = new int[3]{0, 0, 0};
private static float u, v, w, s;
private static float onethird = 0.333333333f;
private static float onesixth = 0.166666667f;
public simplexCarmody(Random randObj)
You can’t perform that action at this time.