-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e99d0f4
commit 2156035
Showing
11 changed files
with
889 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
|
||
def clicker_start_game(): | ||
pass |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import time, os, random | ||
from mrmine.main_script import mrmine_start_game, m_ms_initialize | ||
from mrmine.keypress_detector import m_kd_initialize | ||
from mrmine.gui import m_g_initialize | ||
from clicker.main_script import clicker_start_game | ||
from mrmine_integrity import m_ic_initialize | ||
from colorama import Fore as color | ||
os.system('clear') | ||
m_version='v1.5-alpha' | ||
print(f''' | ||
You are on version {m_version}. | ||
To see all versions go to: | ||
https://github.com/XtheGxmerz0/coolmathgames''') | ||
time.sleep(0.75) | ||
print(''' | ||
Enter the ID for the game you would like to play. | ||
1. Mr. Mine | [v1.5-alpha, Work-In-Progress] | ||
2: Clicker Game | [v1.0, Work-In-Progress]''') | ||
game=input(" > ") | ||
try: | ||
game=int(game) | ||
except Exception: | ||
print("Invalid ID.") | ||
exit() | ||
if game==1: | ||
print("Starting Mr. Mine...") | ||
time.sleep(0.5) | ||
print("Loading Game...") | ||
time.sleep(random.uniform(0.5, 1.5)) | ||
os.system('clear') | ||
print('Initializing main script...') | ||
m_ms_initialize() | ||
print('Initializing GUI...') | ||
m_g_initialize() | ||
print('Initializing keypress detector...') | ||
m_kd_initialize() | ||
print('Performing integrity check...') | ||
m_ic_initialize() | ||
print("Loading Complete!") | ||
time.sleep(1) | ||
print("Welcome to Mr. Mine!") | ||
time.sleep(0.5) | ||
os.system('clear') | ||
mrmine_start_game() |
Large diffs are not rendered by default.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import sys | ||
import termios | ||
import tty | ||
import select | ||
import time | ||
from contextlib import contextmanager | ||
log_loc= '/workspaces/coolmathgames/v1.5-alpha/mrmine/log.txt' | ||
def write_log(message): | ||
with open(log_loc, "a") as log_file: | ||
message1=('Timestamp '+ str(time.time())+': '+ str(message) + "\n") | ||
log_file.write(message1) | ||
def m_kd_initialize(): | ||
write_log('From function \'initialize\': Initializing script...') | ||
@contextmanager | ||
def raw_mode(file): | ||
old_attrs = termios.tcgetattr(file.fileno()) | ||
try: | ||
tty.setraw(file.fileno()) | ||
yield | ||
finally: | ||
termios.tcsetattr(file.fileno(), termios.TCSADRAIN, old_attrs) | ||
|
||
SPECIAL_KEYS = { | ||
'\x1b[A': 'UP', | ||
'\x1b[B': 'DOWN', | ||
'\x1b[C': 'RIGHT', | ||
'\x1b[D': 'LEFT' | ||
} | ||
|
||
def detect_keypress_nonblocking(): | ||
with raw_mode(sys.stdin): | ||
rlist, _, _ = select.select([sys.stdin], [], [], 0.1) | ||
if rlist: | ||
chars = [] | ||
char = sys.stdin.read(1) | ||
if char == '\x1b': # Escape character | ||
chars.append(char) | ||
char = sys.stdin.read(1) | ||
if char: | ||
chars.append(char) | ||
if char == '[': | ||
char = sys.stdin.read(1) | ||
if char: | ||
chars.append(char) | ||
result = ''.join(chars) | ||
return SPECIAL_KEYS.get(result, result) | ||
return None |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
Timestamp 1730849331.3955708: From function 'clear_log': clearing log file | ||
Timestamp 1730849331.3975396: From function 'read_save': grabbed set ('SAVE_NUMBER', '1') from save | ||
Timestamp 1730849331.3976622: From function 'read_save': writing save data key SAVE_NUMBER to data dictionary | ||
Timestamp 1730849331.3977282: From function 'read_save': grabbed set ('END_TIME', '0') from save | ||
Timestamp 1730849331.3978245: From function 'read_save': writing save data key END_TIME to data dictionary | ||
Timestamp 1730849331.3978858: From function 'read_save': grabbed set ('STORAGE', '0') from save | ||
Timestamp 1730849331.3979747: From function 'read_save': writing save data key STORAGE to data dictionary | ||
Timestamp 1730849331.3980362: From function 'read_save': grabbed set ('UPGRADES', '[]') from save | ||
Timestamp 1730849331.3981228: From function 'read_save': writing save data key UPGRADES to data dictionary | ||
Timestamp 1730849331.3981748: From function 'read_save': grabbed set ('MINERALS', '[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]') from save | ||
Timestamp 1730849331.3982909: From function 'read_save': writing save data key MINERALS to data dictionary | ||
Timestamp 1730849331.398376: From function 'read_save': grabbed set ('FLUIDS', '[0, 0, 0]') from save | ||
Timestamp 1730849331.3984754: From function 'read_save': writing save data key FLUIDS to data dictionary | ||
Timestamp 1730849331.398539: From function 'read_save': grabbed set ('SCIENTIST_DATA', '[]') from save | ||
Timestamp 1730849331.398622: From function 'read_save': writing save data key SCIENTIST_DATA to data dictionary | ||
Timestamp 1730849331.398686: From function 'read_save': grabbed set ('CAVE_DATA', '[]') from save | ||
Timestamp 1730849331.3987825: From function 'read_save': writing save data key CAVE_DATA to data dictionary | ||
Timestamp 1730849331.3988464: From function 'read_save': grabbed set ('CHEST_DATA', '[]') from save | ||
Timestamp 1730849331.3989246: From function 'read_save': writing save data key CHEST_DATA to data dictionary | ||
Timestamp 1730849331.398983: From function 'read_save': grabbed set ('MONEY', '0') from save | ||
Timestamp 1730849331.3990586: From function 'read_save': writing save data key MONEY to data dictionary | ||
Timestamp 1730849331.3991265: From function 'read_save': grabbed set ('TP_DATA', '[]') from save | ||
Timestamp 1730849331.3992045: From function 'read_save': writing save data key TP_DATA to data dictionary | ||
Timestamp 1730849331.3992665: From function 'read_save': grabbed set ('MANAGER', '(0.0, 0)') from save | ||
Timestamp 1730849331.3993556: From function 'read_save': writing save data key MANAGER to data dictionary | ||
Timestamp 1730849331.3994205: From function 'read_save': grabbed set ('ATTACK', '(0, 0)') from save | ||
Timestamp 1730849331.3995059: From function 'read_save': writing save data key ATTACK to data dictionary | ||
Timestamp 1730849331.3995707: From function 'read_save': grabbed set ('MINER_SPEED', '1') from save | ||
Timestamp 1730849331.3996477: From function 'read_save': writing save data key MINER_SPEED to data dictionary | ||
Timestamp 1730849331.3997114: From function 'read_save': grabbed set ('MINER_EFFICIENCY', '1') from save | ||
Timestamp 1730849331.399787: From function 'read_save': writing save data key MINER_EFFICIENCY to data dictionary | ||
Timestamp 1730849331.3998487: From function 'read_save': grabbed set ('DEPTH', '4') from save | ||
Timestamp 1730849331.399925: From function 'read_save': writing save data key DEPTH to data dictionary | ||
Timestamp 1730849331.3999872: From function 'read_save': grabbed set ('DRILL_DATA', '[1, 1]') from save | ||
Timestamp 1730849331.400072: From function 'read_save': writing save data key DRILL_DATA to data dictionary | ||
Timestamp 1730849331.4001377: From function 'read_save': grabbed set ('RIG_DATA', '[]') from save | ||
Timestamp 1730849331.4002178: From function 'read_save': writing save data key RIG_DATA to data dictionary | ||
Timestamp 1730849331.4002802: From function 'read_save': grabbed set ('LAYER_HARDNESS', '1') from save | ||
Timestamp 1730849331.4003592: From function 'read_save': writing save data key LAYER_HARDNESS to data dictionary | ||
Timestamp 1730849331.4004254: From function 'read_save': grabbed set ('FORGE_STATUS', '[]') from save | ||
Timestamp 1730849331.4005237: From function 'read_save': writing save data key FORGE_STATUS to data dictionary | ||
Timestamp 1730849331.4005914: From function 'read_save': grabbed set ('BROADCAST', 'nothing') from save | ||
Timestamp 1730849331.400685: From function 'read_save': eval failed; writing directly to data dictionary | ||
Timestamp 1730849331.4007468: From function 'read_save': eval failed with traceback name 'nothing' is not defined. | ||
Timestamp 1730849331.400811: From function 'read_save': grabbed set ('BROADCAST_TYPE', 'nothing') from save | ||
Timestamp 1730849331.4008965: From function 'read_save': eval failed; writing directly to data dictionary | ||
Timestamp 1730849331.4009573: From function 'read_save': eval failed with traceback name 'nothing' is not defined. | ||
Timestamp 1730849331.4010184: From function 'read_save': grabbed set ('DATAID', '16E0A5A5') from save | ||
Timestamp 1730849331.4010808: From function 'read_save': eval failed; writing directly to data dictionary | ||
Timestamp 1730849331.4011362: From function 'read_save': eval failed with traceback invalid decimal literal (<string>, line 1). | ||
Timestamp 1730849331.4011903: From function 'read_save': grabbed set ('PLANET', '1') from save | ||
Timestamp 1730849331.4012647: From function 'read_save': writing save data key PLANET to data dictionary | ||
Timestamp 1730849331.401336: From function 'read_save': grabbed set ('VERSION', 'v1.4-beta') from save | ||
Timestamp 1730849331.4014227: From function 'read_save': eval failed; writing directly to data dictionary | ||
Timestamp 1730849331.401484: From function 'read_save': eval failed with traceback invalid syntax (<string>, line 1). | ||
Timestamp 1730849331.4015744: From function 'write_save': attempting to write to save file (attempt 1) | ||
Timestamp 1730849331.401691: From function 'write_save': opened save file | ||
Timestamp 1730849331.4017477: From function 'write_save': writing item SAVE_NUMBER | ||
Timestamp 1730849331.4018078: From function 'write_save': writing item END_TIME | ||
Timestamp 1730849331.4018662: From function 'write_save': writing item STORAGE | ||
Timestamp 1730849331.40192: From function 'write_save': writing item UPGRADES | ||
Timestamp 1730849331.4019709: From function 'write_save': writing item MINERALS | ||
Timestamp 1730849331.4020276: From function 'write_save': writing item FLUIDS | ||
Timestamp 1730849331.4020817: From function 'write_save': writing item SCIENTIST_DATA | ||
Timestamp 1730849331.4021368: From function 'write_save': writing item CAVE_DATA | ||
Timestamp 1730849331.402556: From function 'write_save': writing item CHEST_DATA | ||
Timestamp 1730849331.4026253: From function 'write_save': writing item MONEY | ||
Timestamp 1730849331.402688: From function 'write_save': writing item TP_DATA | ||
Timestamp 1730849331.402742: From function 'write_save': writing item MANAGER | ||
Timestamp 1730849331.402795: From function 'write_save': writing item ATTACK | ||
Timestamp 1730849331.4028485: From function 'write_save': writing item MINER_SPEED | ||
Timestamp 1730849331.4029095: From function 'write_save': writing item MINER_EFFICIENCY | ||
Timestamp 1730849331.4029703: From function 'write_save': writing item DEPTH | ||
Timestamp 1730849331.403021: From function 'write_save': writing item DRILL_DATA | ||
Timestamp 1730849331.4030712: From function 'write_save': writing item RIG_DATA | ||
Timestamp 1730849331.4031203: From function 'write_save': writing item LAYER_HARDNESS | ||
Timestamp 1730849331.4031699: From function 'write_save': writing item FORGE_STATUS | ||
Timestamp 1730849331.4032185: From function 'write_save': writing item BROADCAST | ||
Timestamp 1730849331.403267: From function 'write_save': writing item BROADCAST_TYPE | ||
Timestamp 1730849331.4033134: From function 'write_save': writing item DATAID | ||
Timestamp 1730849331.403366: From function 'write_save': writing item PLANET | ||
Timestamp 1730849331.4034176: From function 'write_save': writing item VERSION | ||
Timestamp 1730849331.4035184: From function 'write_save': success | ||
Timestamp 1730849331.4036458: From function 'mrmine_start_game': Verifying save file integrity... | ||
Timestamp 1730849331.4037008: From function 'mrmine_save_game': Save file integrity verified. | ||
Timestamp 1730849332.405283: From function 'drill_percent': new layer; new hardness is 25.072440394624508. |
Oops, something went wrong.