Skip to content

Instantly share code, notes, and snippets.

@phenomist
phenomist / add_puzzlink.user.js
Last active November 9, 2021 02:18
Userscript to add back puzz.link links
import copy
f = open("ltri8x8-34.psv")
a = f.read().split("\n")
orient_list = (((0,0),(0,1),(1,1)),((1,0),(0,1),(1,1)),((0,0),(1,0),(1,1)),((0,0),(0,1),(1,0)))
def boardgen(s):
board = [[0 for i in range(8)] for j in range(8)]
piece = 1
for e in s.split("(")[2:]:
orientation = int(e[4])
@phenomist
phenomist / jailbreak-solver.py
Last active July 1, 2019 14:29
Solver for the puzzle game Jailbreak
import collections
moves = {"N":(-1,0),"E":(0,1),"W":(0,-1),"S":(1,0)}
def level_collection(lvnum): # Level collection including some variations found.
if lvnum == 11:
return [
"#######",
"#@....G",
"#....X#",
@phenomist
phenomist / bf.py
Created July 8, 2017 01:49
Brainfuck interpreter written in Python - note print buffer is instead returned, so the behavior may be different from programs that run indefinitely long, printing during the program. I also really didn't test input so that might not work.
from collections import Counter as x,deque as y
def interpret(i):
j,u,t,s,g,h,k,r=0,0,x(),{43:(lambda a,b,c,d,e,f:(a+1,b+1,c,d)),45:(lambda a,b,c,d,e,f:(a+1,b-1,c,d)),62:(lambda a,b,c,d,e,f:(a+1,b,c+1,d)),60:(lambda a,b,c,d,e,f:(a+1,b,c-1,d)),46:(lambda a,b,c,d,e,f:(a+1,b,c,d+chr(b))),44:(lambda a,b,c,d,e,f:(a+1,ord(input()[0]),c,d)),91:(lambda a,b,c,d,e,f:(a+1+e*(b==0),b,c,d)),93:(lambda a,b,c,d,e,f:(a+1-f*(b!=0),b,c,d))},x(),x(),y(),""
for e in range(len(i)):
if i[e]=="[":k.append(e)
if i[e]=="]":q=k.pop();h[e]=g[q]=e-q
while j<len(i):j,t[u],u,r=s[ord(i[j])](j,t[u],u,r,g[j],h[j])
return r
@phenomist
phenomist / hello2.py
Created July 8, 2017 01:46
Obfuscated Hello World printer #2.
import sys
def hello_world():
return ' '.join(map(lambda x:chr(ord(x[0])&223)+x[1:],sys._getframe().f_code.co_name.split("_")))
@phenomist
phenomist / hello1.py
Created July 8, 2017 01:44
Just another obfuscated Hello World printer
import re
def hello_world():
x=y=1
for i in [5, 2, 1, 1, 22, 6, 1, 5, 2, 1, 5, 3, 2, 1, 271, 3, 1, 3, 1, 1, 1]:
x,y=y,x+y*i
return ''.join(map(lambda x: chr(int(re.sub(r"\D","",str(x)))+30),zip(str(x*y)[::2],str(x*y)[1::2])))
@phenomist
phenomist / ca_bldgrip.py
Last active June 10, 2017 19:19
Python script to download a list of every single building in CA by ID
import requests
f = open("buildinglist.csv", "w")
cookies = {"PHPSESSID":"insert", "phpbb2mysql_data":"cookies",
"phpbb2mysql_sid":"here"} #get your own cookies from inspecting network headers
player = "qwerqwerqwer" #replace with player running it (technically, the player whose cookies are used)
pemp = " Overpowered" #same thing
errorstreak = 0
@phenomist
phenomist / ca_bldgplotter.py
Created June 9, 2017 22:12
Python script to plot color-coded buildings in the game Castle Age
from PIL import Image
f = open("buildinglist.csv")
colordict = {"Castle":(255,0,0),
"Gold Mine":(255,255,0),
"Iron Mine":(192,192,192),
"Sawmill":(128,64,0),
"Quarry":(64,64,64),
"Forge":(255,0,255),
@phenomist
phenomist / llcitycount.js
Created March 13, 2017 11:49
JS script to create easily pastable LearnedLeague city counts
x = document.body.innerHTML.split("<table class=\"l\">")[1].split("</table>")[0].split("<td class=\"city\">");
names = [];
counts = [];
for(i = 1; i < x.length; i++){
z = x[i].split("</td>");
names[i-1] = z[0];
counts[i-1] = z.length-2;
}
x = ""
for(i = 0; i < names.length; i++){
@phenomist
phenomist / elem3stats.py
Created August 16, 2016 02:19
Composes stats for the game Elemental 3. Requires @-formatted CSV.
import string
import operator
printable = set(string.printable)
f = open("5020.neat.csv", "rt", encoding='utf8')
g = open("elem3stats.txt", "w", encoding='utf8')
ff = f.read()
st = [i.split("@") for i in ff.split('\n')][0:4997]