From a43a406bf37bc706b1704b9d9803fe1ee518b967 Mon Sep 17 00:00:00 2001 From: deadsmond <01.lewicki@gmail.com> Date: Mon, 25 Nov 2019 21:05:54 +0100 Subject: [PATCH] 'hm' --- TaskB01/run | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/TaskB01/run b/TaskB01/run index 3b88445..1b9110e 100644 --- a/TaskB01/run +++ b/TaskB01/run @@ -12,6 +12,8 @@ class automata: self.accepting_states = [] # list of current states self.state = ['0'] + # word variable + self.word = '' # print for debug purposes def __repr__(self): @@ -32,11 +34,11 @@ class automata: self.accepting_states.append(node[0]) # check if string is accepted by automate - def test_string(self, text): + def test_string(self, word): self.state = ['0'] - text = text.replace('\n', '') - # for all values in text - for i in text: + self.word = word.replace('\n', '') + # for all values in word + for i in self.word: # for all actual states result = [] for q in self.state: @@ -79,6 +81,6 @@ f = open(sys.argv[1], 'r') for line in f: if auto.test_string(line): - print("TRUE %s" % line) + print("TRUE %s" % auto.word) else: - print("FALSE %s" % line) + print("FALSE %s" % auto.word)