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
import java.util.*; | |
/** | |
* A class that simulates a Tic-Tac-Toe game. | |
* | |
* @author Noble Mushtak | |
* @version 1.1 (8 Oct 2016) | |
*/ | |
public class TicTacToe | |
{ |
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
import java.util.*; | |
/** | |
* A class that makes input for numbers and booleans easier. | |
* | |
* @author Noble Mushtak | |
* @version 1.1 (3 Nov 2016) | |
*/ | |
public class EasyInput { | |
/** |
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
//Run in JavaScript console on maml.net/indv.htm | |
//Then, run sortStudents(n) where n is the number of the meet, i.e. sortStudents(1), sortStudents(2), ... sortStudents(5) | |
//Run sortStudents(6) to get back to original sorting. | |
//Get the table body: | |
var tableBody = document.querySelector("tbody"); | |
//Get the rows from the table of students: | |
var scoreRows = tableBody.children; | |
//Get the true rows, not including the header: | |
var trueRows = Array.prototype.slice.call(scoreRows, 1, scoreRows.length); |
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<iostream> | |
#include<cstdlib> | |
#include<cstring> | |
using namespace std; | |
bool isValidSudoku(int board[9][9]) { | |
//board[i][j] represents ith row, jth column | |
//goodBoard[i][j][k][l] represents ith group of 3 rows, jth row in that group, kth group of 3 columns, lth column in that group | |
//goodBoard[i][j][k][l] == board[3*i+j][3*k+l]; | |
int (*goodBoard)[3][3][3] = (int (*)[3][3][3])board; |
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
calculator.pro.user |
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
% Finds min between two numbers. | |
min_nums(X,Y,X) :- X =< Y. | |
min_nums(X,Y,Y) :- Y =< X. | |
% Finds min of list. | |
% Obviously, if there's only one item, then that's the minimum. | |
min([Item|[]],Item). | |
% If there's more than one item, find the minimum of the tail, | |
% then take the minimum of the tail's minimum and the head element. | |
min([Head|Tail],Min) :- |
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 pi, sqrt, atan2, asin | |
def count_collisions(ratio): | |
masses = [1, ratio] | |
vels = [0, -1] | |
collisions = 0 | |
angles = [] | |
while vels[0] < 0 or vels[1] < vels[0]: | |
collisions += 1 |
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
//Based off https://gist.github.com/matthewaveryusa/a721aad80ae89a5c69f7c964fa20fec1 and https://www.kernel.org/doc/html/latest/input/uinput.html | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <unistd.h> | |
#include <fcntl.h> | |
#include <time.h> | |
#include <stdint.h> | |
#include <string.h> | |
#include <stdbool.h> |
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
#!/usr/bin/env stack | |
-- stack --resolver lts-13.30 script --package random | |
import Control.Monad (foldM) | |
import Data.List (elemIndex, minimumBy) | |
import Data.Maybe (fromMaybe) | |
import Debug.Trace (trace) | |
import System.IO (getLine) | |
import System.Random (randomIO, randomRIO) |
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
import unittest | |
UNKNOWN = None | |
def ackermann(m, n): | |
last_answer = None | |
stack = [] | |
stack.append((m, n)) | |
while len(stack) > 0: |