Files
logical-signals/utils/constants.py

325 lines
7.9 KiB
Python

import arcade.color
from arcade.types import Color
from arcade.gui.widgets.buttons import UITextureButtonStyle, UIFlatButtonStyle
from arcade.gui.widgets.slider import UISliderStyle
log_dir = 'logs'
save_dir = 'saves'
menu_background_color = (30, 30, 47)
discord_presence_id = 1427213145667276840
SINGLE_INPUT_LOGICAL_GATES = ["NOT", "OUTPUT"]
LOGICAL_GATES = {
"AND": lambda a, b: a and b,
"OR": lambda a, b: a or b,
"NAND": lambda a, b: not (a and b),
"NOR": lambda a, b: not (a or b),
"XOR": lambda a, b: a != b,
"XNOR": lambda a, b: a == b,
"NOT": lambda a: not a,
}
LEVELS = [
# EASY
[
[2, "INPUT"],
[1, "AND"],
[1, "OUTPUT", 1]
],
[
[2, "INPUT"],
[1, "OR"],
[1, "OUTPUT", 1]
],
[
[1, "INPUT"],
[1, "NOT"],
[1, "OUTPUT", 0]
],
[
[2, "INPUT"],
[1, "NAND"],
[1, "OUTPUT", 0]
],
[
[2, "INPUT"],
[1, "XOR"],
[1, "OUTPUT", 1]
],
[
[2, "INPUT"],
[1, "NOT"],
[1, "AND"],
[1, "OUTPUT", 1]
],
[
[3, "INPUT"],
[1, "AND"],
[1, "OR"],
[1, "OUTPUT", 1]
],
[
[2, "INPUT"],
[1, "NOT"],
[1, "NAND"],
[1, "OUTPUT", 1]
],
# INTERMEDIATE
[
[3, "INPUT"],
[1, "NOR"],
[1, "AND"],
[1, "OUTPUT", 1]
],
[
[3, "INPUT"],
[1, "XNOR"],
[1, "OR"],
[1, "OUTPUT", 1]
],
[
[2, "INPUT"],
[1, "NOT"],
[1, "XOR"],
[1, "OUTPUT", 0]
],
[
[4, "INPUT"],
[1, "OR"],
[1, "AND"],
[1, "XOR"],
[1, "OUTPUT", 0]
],
[
[3, "INPUT"],
[1, "NOT"],
[1, "NOR"],
[1, "OR"],
[1, "OUTPUT", 1]
],
[
[4, "INPUT"],
[2, "NAND"],
[1, "OR"],
[1, "OUTPUT", 1]
],
[
[4, "INPUT"],
[2, "NOR"],
[1, "AND"],
[1, "OUTPUT", 1]
],
[
[3, "INPUT"],
[1, "NOT"],
[1, "AND"],
[1, "NAND"],
[1, "OUTPUT", 0]
],
[
[4, "INPUT"],
[2, "XOR"],
[1, "XNOR"],
[1, "OUTPUT", 1]
],
[
[4, "INPUT"],
[1, "AND"],
[1, "NAND"],
[1, "OR"],
[1, "OUTPUT", 1]
],
[
[4, "INPUT"],
[1, "NOR"],
[1, "AND"],
[1, "XOR"],
[1, "OUTPUT", 0]
],
[
[4, "INPUT"],
[1, "NOT"],
[2, "OR"],
[1, "NAND"],
[1, "OUTPUT", 0]
],
[
[4, "INPUT"],
[1, "XNOR"],
[1, "NOR"],
[1, "AND"],
[1, "OUTPUT", 0]
],
# HARD
[
[4, "INPUT"],
[1, "NOT"],
[1, "AND"],
[1, "OR"],
[1, "XOR"],
[1, "OUTPUT", 0]
],
[
[5, "INPUT"],
[1, "AND"],
[1, "OR"],
[1, "NAND"],
[1, "XOR"],
[1, "OUTPUT", 1]
],
[
[4, "INPUT"],
[2, "NOT"],
[1, "NAND"],
[1, "OR"],
[1, "OUTPUT", 1]
],
[
[4, "INPUT"],
[3, "NAND"],
[1, "OR"],
[1, "OUTPUT", 0]
],
[
[4, "INPUT"],
[1, "NOT"],
[2, "NOR"],
[1, "XOR"],
[1, "XNOR"],
[1, "OUTPUT", 1]
],
[
[6, "INPUT"],
[2, "NOR"],
[1, "XOR"],
[1, "XNOR"],
[1, "OUTPUT", 1]
],
[
[6, "INPUT"],
[2, "AND"],
[1, "OR"],
[1, "NAND"],
[1, "XOR"],
[1, "OUTPUT", 0]
],
[
[5, "INPUT"],
[1, "NOT"],
[2, "XOR"],
[1, "NAND"],
[1, "NOR"],
[1, "OUTPUT", 0]
],
[
[6, "INPUT"],
[2, "XOR"],
[1, "NAND"],
[1, "NOR"],
[1, "XNOR"],
[1, "OUTPUT", 1]
],
# EXTRA HARD
[
[4, "INPUT"],
[1, "AND"],
[1, "OR"],
[1, "NAND"],
[1, "XOR"],
[1, "OUTPUT", 0],
[1, "OUTPUT", 1]
],
[
[3, "INPUT"],
[1, "NOT"],
[1, "AND"],
[1, "OR"],
[1, "XOR"],
[1, "OUTPUT", 0],
[1, "OUTPUT", 1]
],
[
[6, "INPUT"],
[2, "XOR"],
[1, "AND"],
[1, "NAND"],
[1, "OR"],
[1, "OUTPUT", 1],
[1, "OUTPUT", 0]
],
[
[4, "INPUT"],
[2, "NOT"],
[1, "NAND"],
[1, "NOR"],
[1, "XOR"],
[1, "OUTPUT", 1],
[1, "OUTPUT", 0]
],
[
[6, "INPUT"],
[2, "NOR"],
[2, "XNOR"],
[1, "AND"],
[1, "OR"],
[2, "OUTPUT", 1]
],
[
[6, "INPUT"],
[2, "NAND"],
[2, "XOR"],
[1, "NOR"],
[1, "AND"],
[1, "OUTPUT", 0],
[1, "OUTPUT", 1]
],
[
[8, "INPUT"],
[2, "AND"],
[2, "OR"],
[1, "XOR"],
[1, "NAND"],
[1, "NOR"],
[1, "XNOR"],
[1, "OUTPUT", 1],
[1, "OUTPUT", 0]
]
]
button_style = {'normal': UITextureButtonStyle(font_name="Roboto", font_color=arcade.color.BLACK), 'hover': UITextureButtonStyle(font_name="Roboto", font_color=arcade.color.BLACK),
'press': UITextureButtonStyle(font_name="Roboto", font_color=arcade.color.BLACK), 'disabled': UITextureButtonStyle(font_name="Roboto", font_color=arcade.color.BLACK)}
big_button_style = {'normal': UITextureButtonStyle(font_name="Roboto", font_color=arcade.color.BLACK, font_size=26), 'hover': UITextureButtonStyle(font_name="Roboto", font_color=arcade.color.BLACK, font_size=26),
'press': UITextureButtonStyle(font_name="Roboto", font_color=arcade.color.BLACK, font_size=26), 'disabled': UITextureButtonStyle(font_name="Roboto", font_color=arcade.color.BLACK, font_size=26)}
dropdown_style = {'normal': UIFlatButtonStyle(font_name="Roboto", font_color=arcade.color.BLACK, bg=Color(128, 128, 128)), 'hover': UIFlatButtonStyle(font_name="Roboto", font_color=arcade.color.BLACK, bg=Color(49, 154, 54)),
'press': UIFlatButtonStyle(font_name="Roboto", font_color=arcade.color.BLACK, bg=Color(128, 128, 128)), 'disabled': UIFlatButtonStyle(font_name="Roboto", font_color=arcade.color.BLACK, bg=Color(128, 128, 128))}
slider_default_style = UISliderStyle(bg=Color(128, 128, 128), unfilled_track=Color(128, 128, 128), filled_track=Color(49, 154, 54))
slider_hover_style = UISliderStyle(bg=Color(49, 154, 54), unfilled_track=Color(128, 128, 128), filled_track=Color(49, 154, 54))
slider_style = {'normal': slider_default_style, 'hover': slider_hover_style, 'press': slider_hover_style, 'disabled': slider_default_style}
settings = {
"Graphics": {
"Window Mode": {"type": "option", "options": ["Windowed", "Fullscreen", "Borderless"], "config_key": "window_mode", "default": "Windowed"},
"Resolution": {"type": "option", "options": ["1366x768", "1440x900", "1600x900", "1920x1080", "2560x1440", "3840x2160"], "config_key": "resolution"},
"Anti-Aliasing": {"type": "option", "options": ["None", "2x MSAA", "4x MSAA", "8x MSAA", "16x MSAA"], "config_key": "anti_aliasing", "default": "4x MSAA"},
"VSync": {"type": "bool", "config_key": "vsync", "default": True},
"FPS Limit": {"type": "slider", "min": 0, "max": 480, "config_key": "fps_limit", "default": 60},
},
"Sound": {
"Music": {"type": "bool", "config_key": "music", "default": True},
"SFX": {"type": "bool", "config_key": "sfx", "default": True},
"Music Volume": {"type": "slider", "min": 0, "max": 100, "config_key": "music_volume", "default": 50},
"SFX Volume": {"type": "slider", "min": 0, "max": 100, "config_key": "sfx_volume", "default": 50},
},
"Miscellaneous": {
"Discord RPC": {"type": "bool", "config_key": "discord_rpc", "default": True},
},
"Credits": {}
}
settings_start_category = "Graphics"