Compare commits
No commits in common. "07d9b659e3a9d529d71d9ecea7f9e732236d9071" and "2801a3f4cd6561265280d11368edc0ab51d8f44f" have entirely different histories.
07d9b659e3
...
2801a3f4cd
11
shell.nix
11
shell.nix
@ -1,11 +0,0 @@
|
|||||||
{ pkgs ? import <nixpkgs> {} }:
|
|
||||||
let
|
|
||||||
my-python-packages = ps: with ps; [
|
|
||||||
prompt-toolkit
|
|
||||||
pyautogui
|
|
||||||
opencv4
|
|
||||||
numpy
|
|
||||||
# other python packages
|
|
||||||
];
|
|
||||||
my-python = pkgs.python3.withPackages my-python-packages;
|
|
||||||
in my-python.env
|
|
@ -1,6 +1,5 @@
|
|||||||
from modules.wires import WiresModule
|
from modules.wires import WiresModule
|
||||||
from modules.button import ButtonModule
|
from modules.button import ButtonModule
|
||||||
from modules.simon import SimonModule
|
|
||||||
from modules.comp_wires import ComplicatedWiresModule
|
from modules.comp_wires import ComplicatedWiresModule
|
||||||
from modules.password import PasswordModule
|
from modules.password import PasswordModule
|
||||||
|
|
||||||
@ -8,7 +7,7 @@ modules = {
|
|||||||
'wires': WiresModule,
|
'wires': WiresModule,
|
||||||
'button': ButtonModule,
|
'button': ButtonModule,
|
||||||
'keypad': None,
|
'keypad': None,
|
||||||
'simon': SimonModule,
|
'simon': None,
|
||||||
'first': None,
|
'first': None,
|
||||||
'memory': None,
|
'memory': None,
|
||||||
'morse': None,
|
'morse': None,
|
||||||
|
@ -1,74 +0,0 @@
|
|||||||
from prompt_toolkit import prompt
|
|
||||||
from prompt_toolkit.completion import WordCompleter
|
|
||||||
|
|
||||||
class SimonModule:
|
|
||||||
buttonmapping = {
|
|
||||||
"vowel": {
|
|
||||||
0: {
|
|
||||||
"red": "blue",
|
|
||||||
"blue": "red",
|
|
||||||
"green": "yellow",
|
|
||||||
"yellow": "green",
|
|
||||||
},
|
|
||||||
1: {
|
|
||||||
"red": "yellow",
|
|
||||||
"blue": "green",
|
|
||||||
"green": "blue",
|
|
||||||
"yellow": "red",
|
|
||||||
},
|
|
||||||
2: {
|
|
||||||
"red": "green",
|
|
||||||
"blue": "red",
|
|
||||||
"green": "yellow",
|
|
||||||
"yellow": "blue",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
"novowel": {
|
|
||||||
0: {
|
|
||||||
"red": "blue",
|
|
||||||
"blue": "yellow",
|
|
||||||
"green": "green",
|
|
||||||
"yellow": "red",
|
|
||||||
},
|
|
||||||
1: {
|
|
||||||
"red": "red",
|
|
||||||
"blue": "blue",
|
|
||||||
"green": "yellow",
|
|
||||||
"yellow": "green",
|
|
||||||
},
|
|
||||||
2: {
|
|
||||||
"red": "yellow",
|
|
||||||
"blue": "green",
|
|
||||||
"green": "blue",
|
|
||||||
"yellow": "red",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
def __init__(self, strikes, isvowel):
|
|
||||||
self.strikes = strikes
|
|
||||||
self.isvowel = isvowel
|
|
||||||
self.isvowel = "vowel" if isvowel else "novowel"
|
|
||||||
|
|
||||||
def convert(self, color):
|
|
||||||
return self.buttonmapping[self.isvowel][self.strikes][color]
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def interactive(cls, state, cmdline):
|
|
||||||
try:
|
|
||||||
obj = cls(state.strikes, state.serial.vowel)
|
|
||||||
except AttributeError:
|
|
||||||
print("you need to specify a serial number before running this.")
|
|
||||||
return
|
|
||||||
|
|
||||||
while True:
|
|
||||||
print("enter information")
|
|
||||||
user_in = prompt("simon> ")
|
|
||||||
if user_in == "strike":
|
|
||||||
state.strikes += 1
|
|
||||||
obj.strikes += 1
|
|
||||||
elif user_in == "quit":
|
|
||||||
break
|
|
||||||
else:
|
|
||||||
for i in user_in.split(" "):
|
|
||||||
print(obj.convert(i))
|
|
Loading…
Reference in New Issue
Block a user