Skip to content

Commit

Permalink
Add backslash to replacement map, add a catch-all clause for replacin…
Browse files Browse the repository at this point in the history
…g unknown characters.
  • Loading branch information
fijam committed Feb 5, 2023
1 parent 785a424 commit b5d47a0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions logic.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ def find_distance(letter):


def letter_replace(trackname):
change_from = "[{「『]}」』|。・、"
change_to = "(((())))I.-,"
change_from = "[{「『』」}]|。、・~\\"
change_to = "(((())))I.,--/"
return trackname.translate(trackname.maketrans(change_from, change_to))


Expand All @@ -78,6 +78,8 @@ def input_string(trackname):
track_letterlist = list(trackname)
current_set = set_initial
for letter in track_letterlist:
if letter not in set_complete:
letter = '?'
wanted_set, times_to_press = find_distance(letter)
enter_correct_set(wanted_set, current_set)
# use the sign on the modulo result to see if we are going left or right
Expand Down

0 comments on commit b5d47a0

Please sign in to comment.