After Labs1

This commit is contained in:
Bartekfiolek 2023-10-18 22:13:52 +02:00
parent 0891a918c7
commit e090453c6b
13 changed files with 5 additions and 50075 deletions

View File

@ -23,7 +23,7 @@ nie będzie wpływał na ocenę, ale bez zdanego kolowkium nie da się zaliczyć
Proszę stworzyć prywatne repozytorium na https://git.wmi.amu.edu.pl/ o nazwie djfz-2023-sNRINDEKSU oraz dać
prawa do odczytu użytkownikowi bfijalkowski (prowadzący przedmiot). W NRINDEKSU proszę wpisać swój nr indeksu, np. djfz-2023-s123456.
Następnie w swoim repozytorium proszę spullować niniejsze repozytorium: `git pull git@git.wmi.amu.edu.pl:bfijalkowski/DJFZ-2023.git`
Następnie w swoim repozytorium proszę zforkować i później pullować niniejsze repozytorium: `git pull git@git.wmi.amu.edu.pl:bfijalkowski/DJFZ-2023.git`
W ten sposób będziemy aktualizować zadania co zajęcia.
Proszę rozwiązać zadanie TASKX02 lub TASKX03 w zależności od numeru indeksu. W tym celu należy dodać plik `run.py`

View File

@ -40,57 +40,14 @@ class FSA:
fsa = FSA()
# def build_fsa(self): #, dfa_desciption
table = open(sys.argv[1]) # dfa_desciption
table = open(sys.argv[1])
for line in table:
line = line.rstrip('\n')
if len(line.split('\t')) == 3:
a, b, c = line.split('\t')
fsa.add_transition(a, b, c) #self
fsa.alphabet.add(c) #self
fsa.add_transition(a, b, c)
fsa.alphabet.add(c)
elif len(line.split('\t')) == 1:
fsa.add_final_state(line) #self
fsa.add_final_state(line)
else:
assert False
# def run_dfa(self): # , input
for line in sys.stdin: # open(input)
line = line.rstrip()
line_n = list(line)
for i in range(len(line_n)):
if line_n[i] not in fsa.alphabet: #self
line_n[i] = 'x'
if fsa.accepts(line_n): #self
print('YES')
else:
print('NO')
# def run_dfa_and_compare(self, input, expected):
#
# accepts = []
#
# for line in open(input): # sys.stdin
# line = line.rstrip()
#
# line_n = list(line)
#
# for i in range(len(line_n)):
# if line_n[i] not in self.alphabet:
# line_n[i] = 'x'
#
# if self.accepts(line_n):
# accepts.append('YES')
# else:
# accepts.append('NO')
#
# i = 0
# for line in open(expected):
# if line.rstrip() != accepts[i]:
# print('Incorrect in line ' + str(i))
# return
# i = i + 1
# print('Correct')

View File

@ -1,14 +0,0 @@
NO
NO
YES
YES
YES
NO
YES
NO
YES
NO
YES
YES
NO
YES

View File

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +0,0 @@
NO
YES
NO
NO
YES
YES

View File

View File

View File

@ -1 +0,0 @@
15

View File

@ -1 +0,0 @@
4

View File

@ -1 +0,0 @@
3

View File

@ -1,4 +0,0 @@
9 Szeregowy
4 Rico
8 Kowalski
7 Skipper