Skip to content

Instantly share code, notes, and snippets.

View thquinn's full-sized avatar

Tom Quinn thquinn

View GitHub Profile
@thquinn
thquinn / magic.py
Last active December 12, 2019 21:41
A crappy "solver" for Magic: the Gathering combat. Update the declarations at the bottom and run.
#!/usr/bin/python
import sys
import itertools
POWER_EVAL = .6
TOUGHNESS_EVAL = .4
DOUBLE_STRIKE_MULT = 1.5
DEATHTOUCH_EVAL = 1
FLYING_EVAL = 1
@thquinn
thquinn / newmtgwords.txt
Last active May 22, 2020 07:26
A list of words that haven't appeared in the name of a Magic: the Gathering card. Ordered by descending frequency.
they
been
said
could
these
also
years
yeah
such
must
@thquinn
thquinn / asterangles.js
Created July 15, 2018 16:38
Cooperative asteroids for the Math Square exhibit at MoMath
/* MoMath Math Square Behavior
*
* Title: Asterangles
* Description: cooperative asteroids, form an equilateral triangle with an
* asteroid and another player to fire
* Framework: P5
* Author: Tom Quinn <thquinn.github.io>
* Created: 2018-07
* Status: works
*/
@thquinn
thquinn / waveforms.js
Created July 15, 2018 16:41
Waveform visualizer for the Math Square exhibit at MoMath
/* MoMath Math Square Behavior
*
* Title: Waveforms
* Description: stand on the knobs to combine simple waveforms into something
* more complex, stand on the wave to distort it
* Framework: P5
* Author: Tom Quinn <thquinn.github.io>
* Created: 2017-07
* Status: works
*/
@thquinn
thquinn / KabufudaSolver.cs
Created September 25, 2019 13:01
A quick 'n' dirty solver for Eliza's Kabufuda Solitaire
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace KabufudaSolver {
class Program {
static void Main(string[] args) {
Board board = new Board(Console.ReadLine(), int.Parse(Console.ReadLine()));
@thquinn
thquinn / spiralmelee.py
Created April 13, 2020 00:00
Drawing the patterns of N players' go stones placed in a spiral
import numpy as np, PIL
from PIL import Image
from queue import Queue
def within(board, coor):
return coor[0] >= 0 and coor[1] >= 0 and coor[0] < board.shape[0] and coor[1] < board.shape[1]
def get_neighbors(coor):
return [(coor[0] - 1, coor[1]), (coor[0] + 1, coor[1]), (coor[0], coor[1] - 1), (coor[0], coor[1] + 1)]
def next_diamond_coor(coor):
# Center
@thquinn
thquinn / NearWinMonteCarlo.cs
Last active December 8, 2020 18:15
Runs simplified goldfish games of Penny Dreadful Near-Death Experience Combo.
// Runs simplified goldfish games of Penny Dreadful Near-Death Experience Combo. Simplifications include:
// - no interaction from the opponent, obviously
// - doesn't simulate cards besides combo pieces and lands
// - no maximum hand size
// - Lost Auramancers doesn't actually remove NDE from the deck
// - generally poor decision making
// - lots of other stuff (see inline comments)
using System;
using System.Collections.Generic;
@thquinn
thquinn / Santaman.cs
Last active July 16, 2023 21:59
Quick 'n' dirty Stitcher Premium bulk downloader. Windows build: https://github.com/thquinn/thquinn.github.io/releases/tag/Santaman
using System;
using System.Collections.Generic;
using System.IO;
using System.Net;
using System.Text;
using System.Threading;
using System.Xml;
namespace Santaman
{
@thquinn
thquinn / MTGOTrophyScraper.cs
Last active August 9, 2021 16:58
Scrapes the MTGO trophy leaderboard and keeps a Gist updated
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ManagedWinapi; // this can be found here: http://mwinapi.sourceforge.net/
using System.Windows.Forms;
using System.Drawing;
using Octokit; // this is from NuGet
@thquinn
thquinn / gray_coded_partitions.py
Last active February 9, 2023 17:24
Enumerates integer partitions in Gray-code order
# An implementation of Dr. Carla Savage's algorithm described in her
# 1989 paper "Gray code sequences of partitions"
# https://www.sciencedirect.com/science/article/abs/pii/0196677489900072
# Referred to corrections made in a lecture by Dr. Sriram Pemmaraju
# https://homepage.cs.uiowa.edu/~sriram/196/fall01/lecture7.pdf
# Implemented by Tom Quinn (https://thquinn.github.io/)
# I've made my own corrections, see the comments.