diff --git a/dictFunctions.py b/dictFunctions.py deleted file mode 100644 index a80f0bc..0000000 --- a/dictFunctions.py +++ /dev/null @@ -1,47 +0,0 @@ -monty = ["left", "chess", "back", "load"] - - -def getWordsSendDict(myList = []): - - output = {} - output['Movement'] = checkMovement(myList) - output['Direction'] = checkDirection(myList) - output['Action'] = checkAction(myList) - print(output) - return output - -def checkMovement(myList = [], *args): - file = open("movement.txt", 'r') - content = file.readlines() - content = [x.strip('\n') for x in content] - for i in content: - for j in myList: - if j == i: - file.close() - return i - file.close() - -def checkDirection(myList = [], *args): - file = open("directions.txt", 'r') - content = file.readlines() - content = [x.strip('\n') for x in content] - for i in content: - for j in myList: - if j == i: - file.close() - return i - file.close() - -def checkAction(myList = [], *args): - file = open("actions.txt", 'r') - content = file.readlines() - content = [x.strip('\n') for x in content] - for i in content: - for j in myList: - if j == i: - file.close() - return i - file.close() - - -getWordsSendDict(monty) \ No newline at end of file diff --git a/dictionary.rb b/dictionary.rb new file mode 100644 index 0000000..f86a2a8 --- /dev/null +++ b/dictionary.rb @@ -0,0 +1,14 @@ +txt = open("input.txt") + +filenames = ["actions.txt", "directions.txt", "movement.txt"] +dictionary = {} + +txt.each_line do |line| + filenames.each do |name| + if File.read(name).include?line + dictionary[name.chomp('.txt')] = line.chomp("\n") + end + end +end + +puts dictionary diff --git a/keywords.txt b/keywords.txt new file mode 100644 index 0000000..7346d95 --- /dev/null +++ b/keywords.txt @@ -0,0 +1,4 @@ +left +chess +back +load \ No newline at end of file