Skip to content

Instantly share code, notes, and snippets.

View zane's full-sized avatar

Zane Shelby zane

View GitHub Profile
class Ticketing {
Entering: array [1..N] of boolean = {false};
Number: array [1..N] of integer = {0};
void lock(integer i) {
Entering[i] = true;
Number[i] = 1 + max(Number[1], ..., Number[N]);
Entering[i] = false;
for (j = 1; j <= N; j++) {
// Wait until thread j receives its number:
public void initColumn (ArrayList<Spaces> arr){
int index = 0;
while (index <= 5){
arr.set(index, new unFilled());
index++;
}
}
public void initColumn (ArrayList<Spaces> arr){
for (int index = 0; index <= 5; index++) {
String horizStringHelp(int now){
int index = 0;
String sofar = "";
while(index <= 6){
sofar = sofar +
this.columns.get(index).pieces.get(now).makeString() + " ";
index++;
}
return sofar;
}
;; integer, integer -> (Listof integer)
;;
;; Produces the starting indeces of all the diagonals of a board with the provided dimensions.
(define (list-starter-indeces width height)
(list-starter-indeces-helper 0 0 width height))
;; integer, integer, integer, integer -> (Listof integer)
;;
;; Produces the starting indeces of all the diagonals of a board with the provided dimensions, starting at the provided index.
(define (list-starter-indeces-helper x y width height)
(define λcon-rr
(reduction-relation
λcon
(D (aop i_1 i_2)
(δ (aop i_1 i_2))
δ)
(D (rop i_1 i_2)
(compare (rop i_1 i_2))
compare)
(D (string? v)
(--> (D || (e_q1 e_q2 ...) || (in-hole F e_1) || φ)
(D || (e_q1 e_q2 ...) || (in-hole F e_2) || φ)
(side-condition (not (null? (apply-reduction-relation λcon-local-rr
(term e_1)))))
(where e_2 ,(first (apply-reduction-relation λcon-local-rr
(term e_1))))
#lang scheme
(require scheme/control)
(define (identity x)
x)
(define (map* fun lst)
(cond [(empty? lst) lst]
[else (cons (fun (first lst))
hw09/sims.c+sissler.q - AVAILABLE!
hw09/sassani.n+stapczynski.n - AVAILABLE!
hw09/johnson.za+simons.jen - AVAILABLE!
hw09/jelly.c+kersch.d - AVAILABLE!
hw09/cardran.t+pellerano.j - AVAILABLE!
hw09/byrnes.l+waitte.b - AVAILABLE!
hw09/alibrahim.g+aljedawi.y - AVAILABLE!
hw08h/shargo.j+zych.r - AVAILABLE!
hw08h/hodge.k+pollock.j - AVAILABLE!
hw08h/heaps.n+millman.j - AVAILABLE!
import math
def rotate(array, steps):
steps = steps % len(array)
reverse(array, 0, len(array) - 1)
reverse(array, 0, steps - 1)
reverse(array, steps, len(array) - 1)
return array
def reverse(array, start, end):
#lang racket
(define floors
'((1 . 10)
(2 . 3)
(3 . 25)
(4 . 100)))
(define (probability-list floors)
(cond [(empty? floors) empty]