Skip to content

Instantly share code, notes, and snippets.

View iemcd's full-sized avatar

Ian McDougall iemcd

View GitHub Profile
@iemcd
iemcd / 3-letter-wiki-10k
Created April 29, 2024 07:58
Finding new word squares
and, non
was, ana
was, aka
was, aaa
war, ana
war, aka
war, aaa
did, iii
led, eye
led, eve
@iemcd
iemcd / clash.py
Created January 30, 2024 03:12
Draw figures for an opposed-roll mechanic
#!/usr/bin/python3
# January 2024
# Ian McDougall
# Plotting some outcomes of opposed rolls from 1d6 vs 1d6 to 5d6*5 vs 5d6*5
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
@iemcd
iemcd / life.sh
Created October 29, 2023 18:28
Scripts for running Conway's Game of Life on arbitrary input images
#!/bin/bash
# 1. quantize input image to 3-bit colors (WRGBCMYK)
# 2. start the image stack
# 3. split into 3 channels (RGB)
# 4. apply 1 generation of the game of life to each channel
# 5. rejoin the 3 channels, append to image stack
# 6. loop to point 3 n times
# 7. output the image stack as an animated GIF
@iemcd
iemcd / rrf-dice-clean.py
Last active August 26, 2023 17:01
Dice Rules like Rod Reel & Fist
#!/usr/bin/python3
# Evaluating potential alternatives to the "Combining Dice" procedure of Rod, Reel, & Fist
# Ian McDougall, July 2023
# We roll a number of d6 from 1-7, determine a value by some rule, and compare it with a target number (TN) from 3-7. Equal or greater is a success
# A rule is good if:
# - The first and second derivatives are monotonic
# - Fewer results are saturated
# - Success is more likely
@iemcd
iemcd / switch.py
Created February 2, 2023 00:53
Switch Table Probabilities
#!/usr/bin/python3
# Calculating and plotting "Switch Tables" (see Marcia's blog)
# Ian McDougall, Feb 2023
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib as mpl
import matplotlib.pyplot as plt
@iemcd
iemcd / trails.py
Created January 25, 2023 23:15
Monte Carlo modeling of dice-based treasure trails
#!/usr/bin/python3
# Monte Carlo modeling of dice-based "treasure trails"
# Ian McDougall, Jan 2023
import math
import random
import numpy as np
import numpy.ma as ma
import matplotlib as mpl
@iemcd
iemcd / santa.pl
Last active December 5, 2022 03:23
Secret Santa Shuffling
#!/usr/bin/perl
use strict;
use warnings;
use 5.32.1;
# use Email::Sender::Simple qw(sendmail);
use Email::Stuffer;
# Ian McDougall, Dec 2022
# Takes a list in the format "email@example.com name", one per line
@iemcd
iemcd / curve.py
Created December 17, 2021 12:03
MtG Curves
#!/usr/bin/python3
import math
n = 60
for n7 in range(0, math.ceil(n/7)+1):
n6max = n - n7
for n6 in range(n7+1, n6max+1):
n5max = n6max - n6
@iemcd
iemcd / MagicSetEditor.desktop
Last active December 6, 2021 14:33
MSE breadcrumbs
[Desktop Entry]
Version=1.0
Type=Application
Terminal=false
Exec=wine64 $HOME/.MSE/magicseteditor.exe
Name=Magic Set Editor
Comment=Magic: The Gathering Design Tool
Icon=MagicSetEditor
Categories=Development