Skip to content

Instantly share code, notes, and snippets.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@lifelike
lifelike / add_read_journal.pl
Last active August 29, 2015 14:27
Simple script I wrote a long, long time ago to quickly extract journal entries from the AD&D Goldbox games (provided as simple text-files plus PCX-images on the 1994 Goldbox CDROM).
#!/usr/bin/env perl -w
if (!$ARGV[0]) {
print "usage: $0 [entry nr]\n";
exit 1;
}
my $nr = $ARGV[0];
# name of utility to use to display PCX files
;;; decide.el --- rolling dice
;; Copyright 2014 Pelle Nilsson
;;
;; Author: Pelle Nilsson <perni@lysator.liu.se>
;; Version: 0.2
;;
;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
@lifelike
lifelike / gbpdflink.py
Created December 19, 2013 23:29
Add cross-references to gamebook PDF
@lifelike
lifelike / gist:6770967
Last active December 24, 2015 08:29
Quick attempt to try to solve a probability problem of how many turns it takes to exhaust the deck in a certain (unnamed) card game.
#!/usr/bin/env python2
import sys
from itertools import repeat
from random import shuffle
max_nest_size = 3
def make_deck(cardtypes_nr):
deck = []
@lifelike
lifelike / cl5.py
Created August 14, 2013 19:14
Solution to the constraint logic problem on http://intelligenceengine.blogspot.com/2013/08/decision-modeling-and-optimization-in.html using the python-constraint library (http://labix.org/python-constraint) instead of a spreadsheet.
from constraint import *
cl = ['Warlock', 'Wizard', 'Mage', 'Runecaster', 'Sorcelator']
sp = ['Fireball', 'Iceball', 'SpellSteal', 'Drain Life', 'Smashing Hand']
pk = ['Mana Regeneration', 'Endurance', 'Haste', 'Fire Mastery', 'Ice Mastery']
clsv = [c + 'Spell' for c in cl]
clpv = [c + 'Perk' for c in cl]
p = Problem()