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
#!/usr/bin/env python | |
# | |
# Willpower trainer | |
# | |
# It's a really bad, ad hoc state machine | |
# | |
import random | |
import pygame |
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 "disjoint_set.h" | |
void disjoint_set_new(disjoint_set_t *set) { | |
set->parent = set; | |
set->rank = 0; | |
} | |
disjoint_set_t *disjoint_set_find(disjoint_set_t *set) { | |
disjoint_set_t *root = set->parent; |
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 <semaphore.h> | |
#include <pthread.h> | |
#include <stdlib.h> | |
#include <stdio.h> | |
#include <string.h> | |
#include "channel.h" | |
struct channel_s { | |
sem_t empty_semaphore; | |
sem_t fill_semaphore; |
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 <semaphore.h> | |
#include <pthread.h> | |
#include <stdlib.h> | |
#include <stdio.h> | |
#include <string.h> | |
#include "channel.h" | |
struct channel_s { | |
sem_t empty_semaphore; | |
sem_t fill_semaphore; |
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
from types import FunctionType | |
class cell: | |
def __init__(self, *args): | |
self.i_depend_on = [] | |
self.depends_on_me = [] | |
self.set(*args) | |
def get(self): | |
return self.value |
NewerOlder