This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os.path | |
import re | |
''' | |
INSTRUCTIONS | |
1. Create a file with the following code | |
2. Put the file you want to convert into the same folder as it, and rename it to "py_file.py" | |
3. Add a "#F" comment to any lines in the code which have a function call that doesn't assign anything (so no =), | |
as the program cannot handle these convincingly | |
4. Run the converter file |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
python_file = '../PyROV/game.py' | |
workfile = None | |
basic_conversion_rules = {"=": "TO", "if": "IF", "==": "EQUALS", "while": "WHILE", "until": "UNTIL", "import": "IMPORT", "class": "DEFINE CLASS", "def": "DEFINE FUNCTION", "else": "ELSE", "elif": "ELSEIF", "except": "EXCEPT", "try": "TRY", "pass": "PASS"} | |
prefix_conversion_rules = {"=": "SET ", "#F": "CALL "} | |
advanced_conversion_rules = {"print": "OUTPUT", "return": "RETURN", "input": "INPUT"} | |
def f2list(to_list): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Trust Fund Buddy - Bad | |
# Demonstrates a logical error | |
print( \ | |
""" | |
Trust Fund Buddy | |
Totals your monthly spending so that your trust fund doesn't run out | |
(and you're forced to get a real job). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Stack type objects! | |
* Contains: | |
* Stacks | |
* Recipe datum | |
* Recipe list datum | |
*/ | |
/* | |
* Stacks | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//#define RADDBG | |
var/repository/radiation/radiation_repository = new() | |
var/list/to_process = list() | |
/repository/radiation | |
var/list/sources = list() //All the radiation sources we know about | |
var/list/irradiated_turfs = list() | |
var/list/irradiated_mobs = list() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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() |
NewerOlder