This file contains hidden or 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
""" | |
convert C64List symbols file... | |
chrout = $ffd2 | |
llen = $0ca4 | |
ones_digit = $0ca3 | |
...to Vice label file: | |
# al $addr .label | |
al $ffd2 .chrout | |
al $0c04 .llen |
This file contains hidden or 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 logging | |
from dataclasses import dataclass, field | |
@dataclass | |
class ShopItem: | |
name: str | |
quantity: int | |
price: int |
This file contains hidden or 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 logging | |
from enum import Enum | |
from dataclasses import dataclass, field | |
from typing import Tuple | |
import doctest | |
@dataclass | |
class PlayerFlagTypes(str, Enum): | |
YESNO: str = "yes/no" |
This file contains hidden or 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
# https://gist.github.com/anoryx/c34380a0a3ef4031f41c9ed8035e305b | |
# https://stackoverflow.com/questions/51575931/class-inheritance-in-python-3-7-dataclasses/53085935#53085935 | |
# combat considerations: | |
# https://codereview.stackexchange.com/questions/139121/my-implementation-of-item-objects-in-a-text-adventure | |
# thanks, volca & google gemini (née bard) | |
import doctest |
This file contains hidden or 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 logging | |
from dataclasses import dataclass, field | |
import datetime | |
import doctest | |
from typing import Optional | |
# Totally Awesome Dungeon Adventure modules: | |
from server import Player, Room | |
This file contains hidden or 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
from dataclasses import dataclass | |
import datetime | |
import doctest | |
import logging | |
from random import randrange | |
from typing import Sequence | |
# some of this was--sadly--cribbed from Bing AI. | |
# https://www.reddit.com/r/learnpython/comments/17oblv2/class_method_vs_instance_method/ |
This file contains hidden or 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
# map.py | |
# modified from https://www.roguebasin.com/index.php?title=Python_Curses_Example_of_Dungeon-Building_Algorithm | |
# https://roguebasin.com/index.php/Dungeon_builder_written_in_Python/Examples | |
# FIXME: 2d maze generator output doesn't match examples | |
# TODO: get height/width of map, if > screen height/width, display quadrants or something | |
# TODO: display room names underneath? | |
# https://lvngd.com/blog/generating-and-solving-mazes-with-python/# |
This file contains hidden or 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
# This is based on dot_commands.py | |
# some interesting ideas here: | |
# https://colab.research.google.com/github/interactive-fiction-class/interactive-fiction-class.github.io/blob/master/homeworks/text-adventure-game/Text_Adventure_Game.ipynb#scrollTo=8Cug7Bs3Qpdd | |
from dataclasses import dataclass | |
from typing import Callable, Any, Union | |
import re as regex | |
@dataclass |
This file contains hidden or 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 sys | |
def show_keymap(): | |
for value, key_name in keymap.items(): | |
print(f"{value:3} {key_name}") | |
if value % 20 == 0: | |
_ = input("Pause ('Q' quits): ") | |
if _.lower() == "q": | |
print("Aborted.") |
This file contains hidden or 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
try: | |
import getch | |
except ImportError as e: | |
print(f"Can't import getch: {e}.") | |
def get_character(): | |
""" | |
Wait for a character to be typed | |
return tuple: 'in_char': character, 'asc': ascii value | |
""" |