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
function GroupInvitations() { | |
this.event_id = 517949684905901; | |
this.member_ids = []; | |
this.semaphore = 0; | |
} | |
GroupInvitations.prototype = { | |
unlock: function() { | |
if (++(this.semaphore) === 3) { | |
resultStr = this.member_ids.join(','); |
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
function GroupMining() { | |
this.member_ids = []; | |
this.semaphore = 0; | |
this.groupsCount = 1; | |
} | |
GroupMining.prototype = { | |
unlock: function() { | |
if (++(this.semaphore) === this.groupsCount) { | |
resultStr = this.member_ids.join(','); |
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
class AdversarialSearchAI { | |
private PieceType piece; | |
public AdversarialSearchAI(PieceType piece) { | |
this.piece = piece; | |
} | |
/** | |
* Returns the best move given the state of the game | |
*/ |
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
-- Previous tables before this simply included members, events, projects and the auxiliaries. | |
-- I'm beginning to consider migrating this database from SQLite3 to MySQL 5.x | |
CREATE TABLE IF NOT EXISTS member_teams { | |
member_id INTEGER NOT NULL, | |
team_id INTEGER NOT NULL, | |
PRIMARY KEY (member_id, team_id), | |
FOREIGN KEY (member_id) REFERENCES members (member_id), | |
FOREIGN KEY (team_id) REFERENCES teams (team_id) | |
} |
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 <thread> | |
#include <mutex> | |
class semaphore { | |
public: | |
semaphore(unsigned int count) : count_(count) {} | |
void wait() { | |
std::lock_guard<std::mutex> lock(mutex_); | |
while (!count_) |
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
# No progress | |
def algo1(): | |
while turn != i: | |
# no-op | |
# crit section | |
turn = j | |
# remainder section | |
# No progress | |
def algo2(): |
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
from math import sqrt | |
def prob10(mass, height, radius, mom_of_inertia, friction_work): | |
g = 9.8 | |
# potential energy | |
mgh = mass * g * height | |
# total work after descent | |
work = mgh + friction_work | |
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
#ifndef BASECLASS_H | |
#define BASECLASS_H | |
#include <string> | |
#include <iostream> | |
template <class Derived> | |
class BaseClass | |
{ | |
public: |
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
#ifndef EVENT_H | |
#define EVENT_H | |
#include "DiscreteClock.h" | |
#include "SimulationState.h" | |
#include <functional> | |
class EventHandler; |
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
int sum = 1; | |
for (int i = 0; i < 100; i++) | |
sum = sum + 1 | |
return sum // returns 101 |