Skip to content

Instantly share code, notes, and snippets.

@erkyrath
erkyrath / Advent.asm.diff
Created February 22, 2022 17:31
Assembly diff of compiling Advent.inf with the new branch optimizations
*** /tmp/old.out 2022-02-22 12:28:47.000000000 -0500
--- /tmp/new.out 2022-02-22 12:28:47.000000000 -0500
***************
*** 352,358 ****
print "him"
rtrue
.L11
- .L10
.L4
print "that"
@erkyrath
erkyrath / gametext.txt
Created April 6, 2021 00:21
Transcript generated by compiling Advent.inf with the -r option
I: Transcript of the text of "Advent.inf"
I: [From Inform 6.35 (in development)]
I: [I:info, G:game text, V:veneer text, L:lowmem string, A:abbreviation, D:dict word, O:object name, S:symbol, X:infix]
I: [H:game text inline in opcode, W:veneer text inline in opcode]
I:
O: Class
O: Object
O: Routine
O: String
G: ADVENTURE
@erkyrath
erkyrath / config.mk
Last active March 22, 2021 04:33
Fizmo config file for building with remglk.
CC = gcc
AR = ar
override CFLAGS += -Wall -Wextra
# Since the "fizmo-all" metapackage will install all modules into a separate
# "build" directory -- in order not to install dev-files into the installation
# directory, but to keep the dev-files available for other modules which
# depend on these -- we need to tell pkg-config where to find these files.
PKG_CONFIG_PATH \
@erkyrath
erkyrath / SETUP.md
Last active March 21, 2021 17:43
Step-by-step instructions for running the Inform 6 library test script on MacOS.

Fetch everything

You will need git installed. You will also need libxml2 and python3. If you use homebrew:

brew install git
brew install libxml2
brew install python

Download the the inform6-test repository and the various compiler and interpreter repositories.

@erkyrath
erkyrath / abbrev.py
Created December 21, 2020 20:40
Trying to implement the suffix-tree algorithm for finding abbreviations
# This uses the suffix-tree library (https://pypi.org/project/suffix-tree/).
# pip3 install suffix-tree
import sys
from suffix_tree import Tree
from suffix_tree.node import Internal, Leaf
from suffix_tree.util import UniqueEndChar
if len(sys.argv) <= 1:
print('usage: work.py game.txt')
@erkyrath
erkyrath / weighted_choice.py
Last active February 23, 2020 06:36
Weighted choice with temperature parameter
#!/usr/bin/env python3
import math
import random
# This code is in the public domain.
def weighted_choice(ls, temp=1.0, verbose=False):
"""The argument to this function should be a list of tuples, representing
a weighted list of options. The weights must be non-negative numbers.
1: $395.85
2: $380.72
3: $365.89
4: $351.37
5: $337.15
6: $323.23
7: $309.61
8: $296.30
9: $283.28
10: $270.58
@erkyrath
erkyrath / protect.ni
Created January 19, 2018 06:12
Example of Inform protected memory array
"Test Case" by Andrew Plotkin.
The Kitchen is a room. "The Kitchen is a room."
The Bathroom is a room.
The Bathroom is south of the Kitchen.
The rock is a thing. The player carries the rock.
The stone is in the Kitchen.
@erkyrath
erkyrath / makedist.py
Created November 16, 2017 14:01
makedist.py script customized for Windows by David Cornelson
#!/usr/bin/env python3
# Usage: python3 makedist.py
#
# This script copies the working files (everything needed to run Lectrote)
# into prebuilt Electron app packages. Fetch these from
# https://github.com/atom/electron/releases
# and unzip them into a "dist" directory.
import sys
@erkyrath
erkyrath / prize.py
Last active November 28, 2017 15:38
IFComp prize pool math
#!/usr/bin/env python3
# A quick script to compute the IFComp cash prize pool distribution
# under various conditions.
#
# Options:
#
# -p POOL size of prize pool (default=4800)
# -e ENTRIES number of entries (default=60)
# -m MINPRIZE minimum prize (default=10)