Skip to content

Instantly share code, notes, and snippets.

View Fasand's full-sized avatar

Peter Manas Fasand

View GitHub Profile
@Fasand
Fasand / inf2dcw1_test.py
Last active March 9, 2018 13:01
A simple testing tool for Inf2D Coursework 1
import subprocess, timeit
def construct_command(type, algorithm, start=None, ends=None, moves_set=None):
"""
type: "search" | "game"
algorithm: [1..6] | [1..2]
moves_set: [[(4,1), (4,2), ...],] | None
start: (1,1) | None
ends: [(1,2), (2,1), ...] | None
// 2015 Sitting 1 - Rabbit.java
public class Rabbit {
private Integer[][] r; // Array of past sequences
private int n; // Number of sequences in r
public Rabbit(int n) {
this.n = n;
r = new Integer[n][];
lookUp :: Char -> [(Char, Char)] -> Char
lookUp c [] = c
lookUp c charset = if not (null y) then head y else c
where y = [b | (a,b) <- charset, a == c]
contains phrase word = word `elem` [take (length word) (drop x phrase) | x <- [0..(length phrase - length word)]]
contains phrase word = True `elem` [word `isPrefixOf` drop n phrase | n <- [0..(length phrase - length word)]]
user www-data;
worker_processes 4;
pid /run/nginx.pid;
events {
worker_connections 768;
# multi_accept on;
}
http {