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
# THROWBACK procedure from | |
# "Coding Fun: Rearranging All The Numbers" in | |
# Popular Computing #55, Oct. 1977, Vol. 5, No. 10 | |
# See <https://oeis.org/A155167/a155167.pdf> for a copy. | |
import math | |
# Display the array at each step and stop when the "leader" (the initial | |
# value in the array) is stopAtFirst or when maxsteps is reached. | |
def showprocess(stopAtFirst, maxsteps = 1000): |
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
# Adar implementation from | |
# https://esolangs.org/wiki/Adar | |
adar = lambda l: (lambda n: list(map(lambda x: (x[0] + n, x[1]), l)))(sum(map(lambda x: (x[0] >= 0) * x[1], l))) | |
# Basic code that I wrote to run & trace Adar programs | |
# prints only the value of the first register at each step | |
def run(prog, steps=10, outputInitial = False, adar=adar): | |
output = [] |
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
# Gaot++ Translator | |
# | |
# Converts Gaot++ code to and from Forth-like code | |
# that is easier to understand. | |
# | |
# See description of Gaot++ at | |
# https://esolangs.org/wiki/Gaot%2B%2B | |
# | |
# Anthony Kozar | |
# Nov. 24-27, 2021 |
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
# Standard MIDI file template (extension .mid) | |
# by Anthony Kozar | |
# | |
# Version: 2020-10-06 | |
# | |
# Supports all of the basic MIDI events (Note On, Control Change, etc.) | |
# but does not yet recognize some of the 0xFx events or show details for | |
# any meta-events. Also does not handle running status at all. | |
# | |
# The list of controller names only includes the ones that I thought would |
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
# SpragueGrundy.py | |
# | |
# A collection of functions using Sprague-Grundy theory to | |
# calculate the nim values of Grundy's Game and other | |
# impartial combinatorial games. | |
# | |
# Anthony Kozar | |
# October 4-11, 2018 | |
import operator |