Merge pull request 'Labs -> master' (#1) from Labs into master

Reviewed-on: bfijalkowski/DJFZ-2023#1
This commit is contained in:
Bartosz Fijałkowski 2023-11-11 19:20:11 +01:00
commit 944c5d0b39
76 changed files with 99160 additions and 50071 deletions

3
.idea/.gitignore vendored
View File

@ -1,3 +0,0 @@
# Default ignored files
/shelf/
/workspace.xml

View File

@ -1,9 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="JpaBuddyIdeaProjectConfig">
<option name="renamerInitialized" value="true" />
</component>
</project>

View File

@ -1,9 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" languageLevel="JDK_18" project-jdk-name="Python 3.11 (PythonTest)" project-jdk-type="Python SDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
<component name="ProjectType">
<option name="id" value="jpab" />
</component>
</project>

View File

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/DJFZ-2023.iml" filepath="$PROJECT_DIR$/.idea/DJFZ-2023.iml" />
</modules>
</component>
</project>

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ć 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`
@ -48,3 +48,7 @@ B00 - zadanie wykonywane wspólnie na zajęciach
B01-B04, B06-B09 - po jedno dla każdego
B05 - jedno dla wszystkich
## Zajęcia 2 30.10.2023 Automaty niedeterministyczne skończone
C00 - zadanie wykonywane wspólnie na zajęciach
C01-C03, C04-C06 - po jedno dla każdego

65
TaskB00/run.py Normal file
View File

@ -0,0 +1,65 @@
# B00 (2021)
import sys
class FSA:
def __init__(self):
self.initial_state = '0' # zakładamy dla uproszczenia, że initial state = 0
self.final_states = set()
self.transitions = dict()
self.alphabet = set()
def add_transition(self, state_from, state_to, symbol):
if state_from in self.transitions.keys():
self.transitions[state_from][symbol] = state_to
else:
self.transitions[state_from] = dict()
self.transitions[state_from][symbol] = state_to
def add_final_state(self, state):
self.final_states.add(state)
def get_final_state(self, string):
current_state = self.initial_state
for symbol in string:
current_state = self.transitions[current_state][symbol]
return current_state
def accepts(self, string):
if self.get_final_state(string) in self.final_states:
return True
else:
return False
fsa = FSA()
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)
fsa.alphabet.add(c)
elif len(line.split('\t')) == 1:
fsa.add_final_state(line)
else:
assert False
for line in sys.stdin:
line = line.rstrip()
for symbol in line:
if symbol not in fsa.alphabet:
assert False
if fsa.accepts(line):
print('YES')
else:
print('NO')

View File

@ -9,5 +9,5 @@ If a string is accepted by the
automaton, write YES, otherwise- write NO.
POINTS: 2
DEADLINE: 2020-11-07 23:59:00
DEADLINE: 2023-10-29 23:59:59
REMAINDER: 1/4

View File

@ -9,5 +9,5 @@ If a string is accepted by the
automaton, write YES, otherwise- write NO.
POINTS: 2
DEADLINE: 2020-11-07 23:59:00
DEADLINE: 2023-10-29 23:59:59
REMAINDER: 2/4

View File

@ -10,5 +10,5 @@ If a string is accepted by the
automaton, write YES, otherwise- write NO.
POINTS: 2
DEADLINE: 2020-11-07 23:59:00
DEADLINE: 2023-10-29 23:59:59
REMAINDER: 3/4

View File

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

View File

@ -10,5 +10,5 @@ If a string is accepted by the
automaton, write YES, otherwise- write NO.
POINTS: 2
DEADLINE: 2020-11-07 23:59:00
DEADLINE: 2023-10-29 23:59:59
REMAINDER: 0/4

View File

@ -9,4 +9,4 @@ If a string is accepted by the
automaton, write YES, otherwise- write NO.
POINTS: 2
DEADLINE: 2020-11-07 23:59:00
DEADLINE: 2023-10-29 23:59:59

File diff suppressed because it is too large Load Diff

View File

@ -9,5 +9,5 @@ If a string is accepted by the
automaton, write YES, otherwise- write NO.
POINTS: 3
DEADLINE: 2020-11-07 23:59:00
DEADLINE: 2023-10-29 23:59:59
REMAINDER: 0/4

View File

@ -9,5 +9,5 @@ If a string is accepted by the
automaton, write YES, otherwise- write NO.
POINTS: 3
DEADLINE: 2020-11-07 23:59:00
DEADLINE: 2023-10-29 23:59:59
REMAINDER: 1/4

View File

@ -9,5 +9,5 @@ If a string is accepted by the
automaton, write YES, otherwise- write NO.
POINTS: 3
DEADLINE: 2020-11-07 23:59:00
DEADLINE: 2023-10-29 23:59:59
REMAINDER: 2/4

View File

@ -9,5 +9,5 @@ If a string is accepted by the
automaton, write YES, otherwise- write NO.
POINTS: 3
DEADLINE: 2020-11-07 23:59:00
DEADLINE: 2023-10-29 23:59:59
REMAINDER: 3/4

14
TaskC00/description.txt Normal file
View File

@ -0,0 +1,14 @@
Read a description of a non-deterministic finite-state automaton in the AT&T format
(without weights) from the file in the first argument.
Read strings from the standard input.
If a string is accepted by the
automaton, write YES, otherwise- write NO.
The program is invoked like this: python run.py test1.arg < test1.in > test1.out
Note that not all transitions must be included in description.
If no transition is given for the given state and letter, write NO.
POINTS: 3
DEADLINE: 2023-11-12 23:59:59

48
TaskC00/run.py Normal file
View File

@ -0,0 +1,48 @@
import sys
class FSA:
def __init__(self,):
self.initial_state = '0'
self.final_states = set()
self.transitions = dict()
self.alphabet = set()
def add_transition(self, state_from, state_to, symbol):
if state_from in self.transitions.keys():
if symbol not in self.transitions[state_from].keys():
self.transitions[state_from][symbol] = {state_to}
else:
self.transitions[state_from][symbol] |= {state_to}
else:
self.transitions[state_from] = dict()
self.transitions[state_from][symbol] = {state_to}
def add_final_state(self, state):
self.final_states.add(state)
fsa = FSA()
table = open(sys.argv[1])
for line in table:
line = line.rstrip()
if len(line.split('\t')) == 3:
a, b, c = line.split('\t')
fsa.add_transition(a, b, c)
fsa.alphabet.add(c)
else:
fsa.add_final_state(line)
for line in sys.stdin:
line = line.rstrip()
if fsa.accepts(line):
print('YES')
else:
print('NO')

7
TaskC00/testnfa.arg Normal file
View File

@ -0,0 +1,7 @@
0 1 a
1 0 a
1 2 b
2 4 c
1 3 b
3
4

View File

@ -1,9 +1,8 @@
NO
YES
YES
NO
NO
NO
YES
NO
NO
NO
NO
YES

8
TaskC00/testnfa.in Normal file
View File

@ -0,0 +1,8 @@
abc
ab
abcd
aaaabc
aaaaaaaabc
aaaaaaabc
zzz
aaaaaaabc

14
TaskC01/description.txt Normal file
View File

@ -0,0 +1,14 @@
Use a non deterministic finite-state automaton (FSA) engine from the TaskC00.
Create your own non deterministic FSA description to check whether the string second letter
from right is 'b'.
Don't use external files like in TaskF00 (description should be included in run file).
The alphabet is "a", "b", "C"
Read strings from the standard input.
If a string is accepted by the
automaton, write YES, otherwise- write NO.
POINTS: 3
DEADLINE: 2023-11-12 23:59:59
REMAINDER: 0/3

View File

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

6
TaskC01/test.in Normal file
View File

@ -0,0 +1,6 @@
abc
abbc
bca
b
abaa
aaacbb

14
TaskC02/description.txt Normal file
View File

@ -0,0 +1,14 @@
Use a non deterministic finite-state automaton (FSA) engine from the TaskC00.
Create your own non deterministic FSA description to check whether the string
ends with "ab"
Don't use external files like in TaskF00 (description should be included in run file).
The alphabet is "a", "b", "C"
Read strings from the standard input.
If a string is accepted by the
automaton, write YES, otherwise- write NO.
POINTS: 3
DEADLINE: 2023-11-12 23:59:59
REMAINDER: 1/3

6
TaskC02/test.exp Normal file
View File

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

6
TaskC02/test.in Normal file
View File

@ -0,0 +1,6 @@
ab
a
abbab
bbbbb
ababaab
b

14
TaskC03/description.txt Normal file
View File

@ -0,0 +1,14 @@
Use a non deterministic finite-state automaton (FSA) engine from the TaskC00.
Create your own non deterministic FSA description to check whether the string
contains "abc"
Don't use external files like in TaskF00 (description should be included in run file).
The alphabet is "a", "b", "c"
Read strings from the standard input.
If a string is accepted by the
automaton, write YES, otherwise- write NO.
POINTS: 3
DEADLINE: 2023-11-12 23:59:59
REMAINDER: 2/3

7
TaskC03/test.exp Normal file
View File

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

7
TaskC03/test.in Normal file
View File

@ -0,0 +1,7 @@
abc
acabc
acabccb
abbab
bbbbb
ababaab
bc

0
TaskC03/test.out Normal file
View File

25
TaskC04/description.txt Normal file
View File

@ -0,0 +1,25 @@
Deterministic automaton III
===========================
Read a description of a finite-state automaton in the AT&T format
(without weights) from the file in the first argument. Then, read strings from the
standard input. If a string is
accepted by the automated, write YES, a space and the string on the
standard output, otherwise — write NO, a space and the string.
If there is a non-determinism in the automaton, the first transition should be chosen.
The automaton can contain epsilon transitions ("<eps>" instead of a
character). They should be interpreted as follows: an epsilon
transition can be used (without "eating" a character from the input),
if there is no other transition applicable. You can assume that there
is at most one epsilon transition from a given state and that there
are no cycles with epsilon transition.
Your program does not have to check whether the description is correct
and whether the automaton is deterministic. You can assume that the
automaton does not contain epsilon transitions.
POINTS: 3
DEADLINE: 2023-11-12 23:59:59
REMAINDER: 0/3

8
TaskC04/eps.arg Normal file
View File

@ -0,0 +1,8 @@
0 1 a
1 0 a
1 2 b
2 4 c
1 3 <eps>
3 4 d
3
4

10
TaskC04/eps.exp Normal file
View File

@ -0,0 +1,10 @@
TRUE a
FALSE aa
TRUE aaa
TRUE abc
TRUE aaabc
FALSE aaabcd
FALSE aabc
FALSE abd
TRUE ad
FALSE aad

10
TaskC04/eps.in Normal file
View File

@ -0,0 +1,10 @@
a
aa
aaa
abc
aaabc
aaabcd
aabc
abd
ad
aad

4041
TaskC04/long.arg Normal file

File diff suppressed because it is too large Load Diff

7
TaskC04/long.exp Normal file
View File

@ -0,0 +1,7 @@
FALSE aaa
FALSE aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
TRUE aaaa
TRUE aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa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aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
xyz
aba
a

5
TaskC04/simple1.arg Normal file
View File

@ -0,0 +1,5 @@
# prosty automat akceptujący tylko napis "abc"
0 1 a
1 2 b
2 3 c
3

8
TaskC04/simple1.exp Normal file
View File

@ -0,0 +1,8 @@
FALSE a
FALSE ab
TRUE abc
FALSE abcd
FALSE aaaaab
TRUE abc
FALSE xyz
FALSE 0

8
TaskC04/simple1.in Normal file
View File

@ -0,0 +1,8 @@
a
ab
abc
abcd
aaaaab
abc
xyz
0

9
TaskC04/simple2.arg Normal file
View File

@ -0,0 +1,9 @@
# automat akceptujący napis "ab*c" (b powielony dowolną liczbę razy) i "kot"
0 1 a
1 1 b
1 2 c
0 3 k
3 4 o
4 5 t
2
5

9
TaskC04/simple2.exp Normal file
View File

@ -0,0 +1,9 @@
TRUE kot
TRUE ac
TRUE abc
TRUE abbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbc
FALSE abcd
FALSE abbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbcccccc
FALSE kotek
FALSE kotabc
TRUE kot

9
TaskC04/simple2.in Normal file
View File

@ -0,0 +1,9 @@
kot
ac
abc
abbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbc
abcd
abbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbcccccc
kotek
kotabc
kot

52
TaskC05/description.txt Normal file
View File

@ -0,0 +1,52 @@
Dictionary
==========
Your program should read a finite-state automaton from file in the first argument.
The automaton is deterministic, you can assume it does not contain
cycles.
Each automaton path is labeled with a symbol sequence of the following form:
<input word>;<description>
e.g.:
biały;ADJ
dom;N
piła;N
piła;V
stali;N
stali;V
stali;ADJ
Next you should read words from the standard input.
For each word, you should all automaton
paths that begin a given word, the following symbol is ';'
(semicolon), e.g. for the word 'dom' we are looking for paths
beginning with 'dom;'. If there is no such path, the following message
should be printed:
<input word>;OOV
For instance, for the automaton given above and the input:
budynek
dom
piła
we should get:
budynek;OOV
dom;N
piła;N
piła;V
If there is more than one path for a given word, they should be given in alphabetical order.
The program does not have to check whether the automaton is correct
and whether it is deterministic and does not contain cycles.
POINTS: 3
DEADLINE: 2023-11-12 23:59:59
REMAINDER: 1/3

31
TaskC05/elem.arg Normal file
View File

@ -0,0 +1,31 @@
0 1 b
0 2 d
0 3 p
0 4 s
1 5 i
2 6 o
3 7 i
4 8 t
5 9 a
6 10 m
7 11 ł
8 12 a
9 13 ł
10 14 ;
11 15 a
12 16 l
13 17 y
14 24 N
15 18 ;
16 19 i
17 20 ;
18 24 N
18 24 V
19 21 ;
20 22 A
21 22 A
21 24 N
21 24 V
22 23 D
23 24 J
24

1
TaskC05/elem.exp Normal file
View File

@ -0,0 +1 @@
dom;N

1
TaskC05/elem.in Normal file
View File

@ -0,0 +1 @@
dom

15125
TaskC05/medium.arg Normal file

File diff suppressed because it is too large Load Diff

7
TaskC05/medium.exp Normal file
View File

@ -0,0 +1,7 @@
arbuz;N
arbuza;N
arbuzowi;ADJ
arbuzowi;N
azylant;N
azylanci;N
azylantowie;OOV

6
TaskC05/medium.in Normal file
View File

@ -0,0 +1,6 @@
arbuz
arbuza
arbuzowi
azylant
azylanci
azylantowie

31
TaskC05/multi.arg Normal file
View File

@ -0,0 +1,31 @@
0 1 b
0 2 d
0 3 p
0 4 s
1 5 i
2 6 o
3 7 i
4 8 t
5 9 a
6 10 m
7 11 ł
8 12 a
9 13 ł
10 14 ;
11 15 a
12 16 l
13 17 y
14 24 N
15 18 ;
16 19 i
17 20 ;
18 24 N
18 24 V
19 21 ;
20 22 A
21 22 A
21 24 N
21 24 V
22 23 D
23 24 J
24

2
TaskC05/multi.exp Normal file
View File

@ -0,0 +1,2 @@
piła;N
piła;V

1
TaskC05/multi.in Normal file
View File

@ -0,0 +1 @@
piła

31
TaskC05/oov.arg Normal file
View File

@ -0,0 +1,31 @@
0 1 b
0 2 d
0 3 p
0 4 s
1 5 i
2 6 o
3 7 i
4 8 t
5 9 a
6 10 m
7 11 ł
8 12 a
9 13 ł
10 14 ;
11 15 a
12 16 l
13 17 y
14 24 N
15 18 ;
16 19 i
17 20 ;
18 24 N
18 24 V
19 21 ;
20 22 A
21 22 A
21 24 N
21 24 V
22 23 D
23 24 J
24

1
TaskC05/oov.exp Normal file
View File

@ -0,0 +1 @@
budynek;OOV

1
TaskC05/oov.in Normal file
View File

@ -0,0 +1 @@
budynek

24
TaskC06/description.txt Normal file
View File

@ -0,0 +1,24 @@
Paths
======
Your program should read a finite-state automaton from
the standard input.
The automaton is deterministic, you can assume it does not contain
cycles. The automaton alphabet is the set of Polish lower-case letters
(English letters plus: ą, ć, ę, ł, ń, ó, ś, ź and ż).
Your program should print, on standard output, all the paths of the
automaton in alphabetical order (to be precise: order induced by byte
codes of strings, not according to the standard Polish order). "Print
a path" means print a text line containing all subsequent characters.
The program does not have to check whether the automaton is correct
and whether it is deterministic and does not contain cycles.
Weights (if any) should be disregarded.
NOTE 1. You can add `LANG=C sort` to your Bash wrapper for the write sort.
POINTS: 3
DEADLINE: 2023-11-12 23:59:59
REMAINDER: 2/3

50648
TaskC06/medium.exp Normal file

File diff suppressed because it is too large Load Diff

14774
TaskC06/medium.in Normal file

File diff suppressed because it is too large Load Diff

0
TaskC06/medium.out Normal file
View File

1
TaskC06/medium2.exp Normal file
View File

@ -0,0 +1 @@
a

13989
TaskC06/medium2.in Normal file

File diff suppressed because it is too large Load Diff

0
TaskC06/medium2.out Normal file
View File

4
TaskC06/small.exp Normal file
View File

@ -0,0 +1,4 @@
biały
dom
piła
stali

18
TaskC06/small.in Normal file
View File

@ -0,0 +1,18 @@
0 1 b
0 2 d
0 3 p
0 4 s
1 5 i
2 6 o
3 7 i
4 8 t
5 9 a
6 14 m
7 10 ł
8 11 a
9 12 ł
10 14 a
11 13 l
12 14 y
13 14 i
14

0
TaskC06/small.out Normal file
View File

3
TaskC06/small2.exp Normal file
View File

@ -0,0 +1,3 @@
biały
piła
stali

18
TaskC06/small2.in Normal file
View File

@ -0,0 +1,18 @@
0 1 b
0 2 d
0 3 p
0 4 s
1 5 i
2 6 o
3 7 i
4 8 t
5 9 a
6 15 m
7 10 ł
8 11 a
9 12 ł
10 14 a
11 13 l
12 14 y
13 14 i
14

0
TaskC06/small2.out Normal file
View File

View File

@ -1 +0,0 @@
15

View File

@ -1 +0,0 @@
4

View File

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