Skip to content

Instantly share code, notes, and snippets.

import re
import time
comp_re = re.compile(r'^1?$|^(11+?)\1+$')
def regex_prime(args):
primes = [2]
for n in xrange(*args):
if not re.match(comp_re, str(1) * n):
primes.append(n)
#!/usr/bin/env python
import random
import re
import sys
from collections import defaultdict, namedtuple
from itertools import chain, count
from operator import add
from random import choice
from string import uppercase
[[('NAME: elethiomel_entry_fortress_basement',
'MONS: gnoll, jackal, worm'),
('NAME: dpeg_entry_castle', 'MONS: fungus'),
('NAME: elethiomel_entry_diamonds', 'MONS: rat, goblin, bat, kobold'),
('NAME: erik_entry_gehennom', 'MONS: rat, goblin, kobold, ooze'),
('NAME: dpeg_entry_morbid_curiosity', 'MONS: goblin ; stone'),
('NAME: matt_entry_debris', 'MONS: plant'),
('NAME: dpeg_entry_circle_labyrinth_a',
'MONS: plant / bush w:3, fungus col:any, fungus col:yellow, fungus col:red'),
('NAME: minmay_entry_shoal_huts', 'MONS: plant'),
......................................................................................................................................................................
......................................................................................................................................................................
......................................................................................................................................................................
.**"****"**""***.....******.......***"****"***""**............""***"**"**"***.....**""**...................*"***""*..........**"*****""***"***...******....**""**.....
.****"*....***"*.....**"*"*....***""*.........................*"""*.....*""**.....*""***.................*"*""**""**.......****"*................**"***.***""*........
.*********"*"***.....**"***..."*"***.......********...........*"*"""*""""""***....***""*...............******...*"""**....*"*"**.................***"********.........
.******......******..*
..............................................................................................................................................
..............................................................................................................................................
................................................................................................................******........................
.*****...***"*....**""*....**"*****....****..........*****...*"*"*....*""""................"**""*"*.......""**"*.......**...**""*..******.....
.***"********.....*****..."**"*......................****"***"*"*.....***""..............*"""*..***"*...*"*"*...............****"**"**........
.*****.....*****..*****...*"*"*......***"*"*.........*""**.....**""*..*"*""............**""********""*...*"""*..............*****..*****......
.**************...*****.....***"******"""""*.........""*******"""**...**************..*"*"*........*"***....*"******"**""...*"***.....******..
.......................
import os
import sys
from math import ceil, floor
from PIL import Image
RATIO = (1/2.35)
SYMBOL_STRING = '&#.:*"..'
EIGHT_COLOR = [(0, 0, 0), # 0