Skip to content

Instantly share code, notes, and snippets.

@BlueNexus
BlueNexus / rot13.py
Last active July 19, 2016 13:00
44-line Python rot13 script
import string
charset = list(string.ascii_lowercase)
def rem_numbers(source):
new_string = []
to_remove = list(string.digits)
source = list(source.lower())
for char in source:
if char not in to_remove:
@BlueNexus
BlueNexus / ireland.py
Last active July 19, 2016 12:58
Determines registration date and location when given an irish license plate number
import string
index_codes = {
"C":"Cork", "CE":"Clare",
"CN":"Cavan", "CW":"Carlow",
"D":"Dublin", "DL":"Donegal",
"G":"Galway", "KE":"Kildare",
"KK":"Kilkenny", "KY":"Kerry",
"L":"Limerick", "LD":"Longford",
"LH":"Louth", "LM":"Leitrim",
//Chemical Reagents - Initialises all /datum/reagent into a list indexed by reagent id
/proc/initialize_chemical_reagents()
var/paths = typesof(/datum/reagent) - /datum/reagent
chemical_reagents_list = list()
for(var/path in paths)
var/datum/reagent/D = new path()
if(!D.name)
continue
chemical_reagents_list[D.id] = D
#define DECAY_RATE 0.1
var/list/to_process = list(
datum/rad_handler
var/list/sources = list()
var/list/irradiated = list()
datum/rad_handler/process()
/proc/trange(rad = 0, turf/centre = null) //alternative to range (ONLY processes turfs and thus less intensive)
if(!centre)
return
var/turf/x1y1 = locate(((centre.x-rad)<1 ? 1 : centre.x-rad),((centre.y-rad)<1 ? 1 : centre.y-rad),centre.z)
var/turf/x2y2 = locate(((centre.x+rad)>world.maxx ? world.maxx : centre.x+rad),((centre.y+rad)>world.maxy ? world.maxy : centre.y+rad),centre.z)
return block(x1y1,x2y2)
#define DECAY_RATE 0.1
#define RADDBG
var/repository/radiation/radiation_repository = new()
var/list/to_process = list()
/repository/radiation
var/list/sources = list()
var/list/irradiated = list()
#define DECAY_RATE 0.1
#define RADDBG
var/repository/radiation/radiation_repository = new()
var/list/to_process = list()
/repository/radiation
var/list/sources = list()
var/list/irradiated = list()
#define DECAY_RATE 0.1
#define RADDBG
var/repository/radiation/radiation_repository = new()
var/list/to_process = list()
/repository/radiation
var/list/sources = list()
var/list/irradiated = list()
for(var/turf/spot in to_process)
var/turf/origin = get_turf(epicentre)
var/turf/dest = spot
var/working = power
while(origin != dest)
origin = get_step_towards(origin, dest)
if(!to_process[origin])
to_process[origin] = working
working -= origin.rad_resistance
else
var/radiation_level = rand(15, 35)
for(var/area/A in all_areas)
if(!(A.z in using_map.station_levels))
continue
if(A.flags & RAD_SHIELDED)
continue
for(var/turf/T in A)
radiation_repository.irradiated_turfs[T] = radiation_level