This file contains 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 <vector> | |
#include <iostream> | |
#include <string> | |
#include <fstream> | |
#include <unordered_map> | |
class Interpreter { | |
public: | |
using SourceType = std::vector<char>; |
This file contains 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 <fstream> | |
#include <string> | |
#include <vector> | |
int main(int argc, char** argv) { | |
if (argc == 1) { | |
std::cout << "Usage: " << argv[0] << " <word list path>" << std::endl; | |
return -1; | |
} |
This file contains 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 <ncurses.h> // curses library | |
#include <vector> | |
#include <cstdlib> // rand() | |
#include <ctime> // for initializing random | |
#include <unistd.h> // usleep() | |
// Amount of drops to create on the screen | |
const unsigned int DROP_AMOUNT = 50; |
This file contains 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 <thread> | |
#include <chrono> | |
double benchmark(void (*f)()) { | |
auto start = std::chrono::high_resolution_clock::now(); | |
// Call the function | |
(*f)(); | |
auto end = std::chrono::high_resolution_clock::now(); | |
// Subtract times and return result as a double |
This file contains 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 <string> | |
#include <sstream> | |
class FizzBuzz { | |
private: | |
int m_Current; | |
std::ostringstream m_Stream; | |
public: | |
FizzBuzz() { |
This file contains 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> | |
std::vector<double> linearSpace(double a, double b, int amount) { | |
std::vector<double> result; | |
double step = (std::max(a, b) - std::min(a, b)) / amount; | |
for (double i = a; i <= b; i += step) { | |
result.push_back(i); | |
} | |
return result; |
This file contains 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 sys | |
def error(linenumber, clause): | |
print("Error at line \#" + str(linenumber) + ": " + clause) | |
sys.exit() | |
with open("code.diy") as f: | |
data = [line.lstrip("\t") for line in f.read().splitlines()] | |
labels = {} | |
for linenum, line in enumerate(data): | |
if line.endswith(":"): | |
labels[line.rstrip(":")] = linenum + 1 |
This file contains 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
using System; | |
using System.Text; | |
namespace TicTacToe | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
Random rand = new Random(); |