This commit is contained in:
Benjamin Kyd
2019-02-12 13:25:31 +00:00
6 changed files with 2606 additions and 1 deletions

68
C++/Maze/main.cpp Normal file
View File

@@ -0,0 +1,68 @@
#define OLC_PGE_APPLICATION
#include "olcPixelGameEngine.h"
#include <iostream>
#include <stack>
typedef enum class Direction {
NORTH,
SOUTH,
EAST,
WEST
} Direction;
struct Cell {
bool visited = false;
int width = 3;
};
class Maze : public olc::PixelGameEngine {
public:
Maze()
: m_mazeDimensions(50, 50) {
sAppName = "Maze";
}
bool OnUserCreate() {
m_maze = new Cell[m_mazeDimensions.x * m_mazeDimensions.y];
m_maze[0].visited = true;
m_stack.push({0, 0});
return true;
}
bool OnUserUpdate(float fElapsedTime) {
draw();
return true;
}
void draw() {
for (int x = 0; x < m_mazeDimensions.x; x++) {
for (int y = 0; y < m_mazeDimensions.y; y++) {
int index = x + y * m_mazeDimensions.x;
int width = m_maze[index].width;
if (m_maze[index].visited) {
DrawRect(x + m_mazeDimensions.x * width, y + m_mazeDimensions.y * width, width, width, olc::BLACK);
} else {
DrawRect(x + m_mazeDimensions.x * width, y + m_mazeDimensions.y * width, width, width, olc::RED);
}
}
}
}
private:
std::stack<Vec2<int>> m_stack;
Vec2<int> m_mazeDimensions;
Cell* m_maze;
};
int main(int argc, char** argv) {
Maze maze;
maze.Construct(500,500,2,2);
maze.Start();
// return 0;
}

File diff suppressed because it is too large Load Diff

BIN
C++/Maze/output.o Executable file

Binary file not shown.

1
C++/Soph/README.md Normal file
View File

@@ -0,0 +1 @@
These files were made by william maltby-wheiner (https://github.com/b-boy-ww) im not taking credit for this awful code

View File

@@ -1,4 +1,4 @@
To do
Totally not stollen ToDo list
- [ ] Forward kinematics
- [ ] Inverse kinematics

View File

@@ -1,3 +1,5 @@
### Code Samples
This is basically a repo of some of my random small scale projects which i may some day come back and reference. Feel free to contribute and add to it yourself.
This repository contains multiple instances of a personally modified olcPixelGameEngine for use in multiple projects (www.onelonecoder.com), the main branch can be found at https://github.com/OneLoneCoder/olcPixelGameEngine.