Skip to content

Instantly share code, notes, and snippets.

View Ratstail91's full-sized avatar
💭
Back in my day, we didn't need no AI.

Kayne Ruse Ratstail91

💭
Back in my day, we didn't need no AI.
View GitHub Profile
+ ---------------------------------------------------------------------------- +
| TODOS @ Sunday 20 April 2014 01:41 |
| 124 files scanned |
+ ---------------------------------------------------------------------------- +
## NOTE (4)
1. region_pager.hpp:53 don't change the sizes mid-program, it will cause issues
2. raster_font.cpp:43 This class can only take a raster font with 16*16 characters, and the
3. server_application.cpp:109 I might need to rearrange the init process so that lua & SQL can interact
4. server_application.cpp:300 assigning each field one-by-one so adding or moving a field doesn't break this code
diff --git a/common/network/serial.cpp b/common/network/serial.cpp
index 2aa88cb..5130841 100644
--- a/common/network/serial.cpp
+++ b/common/network/serial.cpp
@@ -21,7 +21,7 @@
*/
#include "serial.hpp"
-#include "map_generator.hpp"
+#include "map_allocator.hpp"
@Ratstail91
Ratstail91 / gist:a1facb724de18afc08ed
Created May 5, 2014 12:05
Me familiarizing myself with SQL. Good god this shit is irritating.
#include "sqlite3/sqlite3.h"
#include <iostream>
#include <string>
using namespace std;
const char* command = "CREATE TABLE accounts(username VARCHAR(100)); INSERT INTO accounts VALUES(\"Ratstail91\"); SELECT * FROM accounts;";
int main(int argc, char* argv[]) {
//check for collisions
for (int i = -6; i < 6; ++i) {
for (int j = -6; j < 6; ++j) {
Vector2 wallPoint = {
snapToBase(32.0, character.GetOrigin().x),
snapToBase(32.0, character.GetOrigin().y)
};
wallPoint.x += i * 32;
wallPoint.y += j * 32;
@Ratstail91
Ratstail91 / Container.h
Created July 27, 2014 04:31
This is a failed application for a game development job. I'm posting it here to display it on my blog.
/* Rules
* Write the implementation in Container.h, do not change ContainerTest.cpp.
* No memory allocation is allowed (implicit or explicit).
* Use of the STL (Standard Template Library) is not allowed.
* You can add member functions and variables.
* All storage management data structures must use the buffer memory, not additional member variables.
* You must test your solution in debug (or any configuration that have asserts enabled) so that the requirements are tested.
* Your solution must be efficient and scalable.
* Try to maximize the number of elements in the given buffer, and also perform well whether you have ten elements or thousands.
* Optionally, you can uncomment the _ADVANCED macro at the top of ContainerTest.cpp and implement the sorting algorithm.
@Ratstail91
Ratstail91 / hash_coordinates.cpp
Last active August 29, 2015 14:04
A simple hashing function, to emulate a procedural number generator for perlin noise.
unsigned hashuint(unsigned x) {
//found this on stack overflow
x = ((x >> 16) ^ x) * 0x45d9f3b;
x = ((x >> 16) ^ x) * 0x45d9f3b;
x = ((x >> 16) ^ x);
return x;
}
unsigned hashCoordinates(unsigned seed, int x, int y) {
//default values when 0 is a parameter
@Ratstail91
Ratstail91 / ackermann_brainfuck
Created August 9, 2014 14:46
This is an incomplete implementation of the ackermann function written in the brainfuck language.
ack(m, n):
m == 0 ? n + 1 : ;
n == 0 ? ack(m - 1, 1) : ;
ack(m, ack(m, n - 1))
Each stack frame is structured as (a,n,m,x), each referred to as arguments (@x). Everything to the right of the following stack frame is essentially a local variable, and must be cleared before the current frame "returns". Each stack frame is refered to as s@x where s is the current frame, s+1@x is the next, etc. Always assume the pointer will enter the next stage of the function by pointing to the top of a stack frame.
A way to test the precise value of a cell is like this. Assuming the cell @x has the value of 2:
@Ratstail91
Ratstail91 / epic_quicksort.cpp
Created September 27, 2014 06:50
Stack-based, inplace, recursive quicksort. I'm quite proud of this, I think it's quite clever. Odd numbers are sorted to the front, BTW.
int CompareOddEven(int lhs, int rhs)
{
//lhs < rhs ? -1, 1, 0
//odd vs even
if (lhs % 2 == 1 && rhs % 2 == 0) {
return -1;
}
if (lhs % 2 == 0 && rhs % 2 == 1) {
return 1;
@Ratstail91
Ratstail91 / USBBackup.bat
Created October 16, 2014 07:07
I wrote this during high school, when I was only just beginning to use programming languages over 3rd party engines (Game Maker); 6 years later it's aged really well. Built for Windows, it copies the entire contents of a USB drive to a defined folder. There are checks and precautions in place: the name of the backup folder is defined in the scri…
@ECHO OFF
ECHO USB Backup Utility designed by Kayne Ruse.
SET folder=USBBackup
ECHO Instructions
ECHO.
ECHO 1) There must be a folder called "%folder%" in this directory.
ECHO 2) The USB must have a copy of this file in it's root directory.
ECHO.
/* Copyright: (c) Kayne Ruse 2014
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*