This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
import random | |
import matplotlib.pyplot as plt | |
class UniformDistribution: | |
def __init__(self, a: float, b: float) -> None: | |
self.a = a | |
self.b = b |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct Array1D | |
{ | |
float vals[WIDTH]; | |
float& operator[] (int index) | |
{ | |
return vals[index]; | |
} | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <chrono> | |
struct Timer | |
{ | |
void start() | |
{ | |
startTime = std::chrono::steady_clock::now(); | |
} | |
long long elapsed() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// create images | |
std::vector<vk::Image> images = ...; | |
// gather information | |
uint32_t memoryTypeBits = ~0; // 0b11111111... | |
vk::DeviceSize totalSize = 0; | |
std::vector<vk::DeviceSize> offsets; | |
for (auto&& image : images) { | |
offsets.push_back(totalSize); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <array> | |
class Particle | |
{ | |
public: | |
Particle() : m_frameLeft(0) {} | |
void init(double x, double y, int lifeTime) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <vector> | |
#include <array> | |
#include <chrono> | |
class AIComponent | |
{ | |
public: | |
void update() | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
class Audio | |
{ | |
public: | |
virtual ~Audio() {} | |
virtual void playSound(int soundId) = 0; | |
virtual void stopSound(int soundId) = 0; | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <queue> | |
struct PlayMessage | |
{ | |
int soundId; | |
int volume; | |
}; | |
class Audio |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <vector> | |
#include <string> | |
class GameObject; | |
class Component | |
{ | |
public: | |
virtual void update(GameObject &gameObject) = 0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <vector> | |
#include <array> | |
#include <stack> | |
struct Wizard | |
{ | |
int health; | |
int wisdom; | |
}; |