gitweb on Svarog
projekti pod git sistemom za održavanje verzija -- projects under the git version control system
summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: de1f175)
raw | patch | inline | side by side (parent: de1f175)
author | Doni Pracner <quinnuendo@gmail.com> | |
Mon, 21 Oct 2013 12:47:57 +0000 (14:47 +0200) | ||
committer | Doni Pracner <quinnuendo@gmail.com> | |
Mon, 21 Oct 2013 12:47:57 +0000 (14:47 +0200) |
02. Podslika/MALA.SLI | [deleted file] | patch | blob | history |
02. Podslika/PODSLIKA.MOD | [deleted file] | patch | blob | history |
02. Podslika/TopSpeed/MALA.SLI | [new file with mode: 0644] | patch | blob |
02. Podslika/TopSpeed/PODSLIKA.MOD | [new file with mode: 0644] | patch | blob |
02. Podslika/TopSpeed/VELIKA.SLI | [new file with mode: 0644] | patch | blob |
02. Podslika/VELIKA.SLI | [deleted file] | patch | blob | history |
diff --git a/02. Podslika/MALA.SLI b/02. Podslika/MALA.SLI
--- a/02. Podslika/MALA.SLI
+++ /dev/null
@@ -1,6 +0,0 @@
-5\r
- 0 0 1 0 0\r
- 0 1 1 1 0\r
- 1 1 2 1 1\r
- 0 1 1 1 0\r
- 0 0 1 0 0\r
diff --git a/02. Podslika/PODSLIKA.MOD b/02. Podslika/PODSLIKA.MOD
+++ /dev/null
@@ -1,168 +0,0 @@
-MODULE Podslika;\r
-\r
- FROM FIO IMPORT\r
- File, Open, Close, RdCard, EOF, OK, Exists;\r
- FROM IO IMPORT\r
- WrLn, WrStr, WrCard;\r
-\r
- CONST\r
- MaxDim = 100;\r
- BrojBoja = 16;\r
- Osnova = MaxDim * (BrojBoja - 1) + 1;\r
- ProstBroj = 3001;\r
- ImeVel = 'Velika.Sli';\r
- ImeMal = 'Mala.Sli';\r
-\r
- TYPE\r
- Boja = [0 .. BrojBoja - 1];\r
- Slika = ARRAY [1 .. MaxDim], [1 .. MaxDim] OF Boja;\r
-\r
- VAR\r
- Velika, Mala: Slika;\r
- DimVel, DimMal, Vr, Ko: CARDINAL;\r
- KljucMale, KljucSegmenta, Stepen: LONGCARD;\r
- Ok, Iste: BOOLEAN;\r
-\r
- PROCEDURE Citaj(VAR Slika: Slika;\r
- Ime: ARRAY OF CHAR;\r
- VAR Dim: CARDINAL;\r
- VAR Ok: BOOLEAN);\r
- VAR\r
- F: File;\r
- Vr, Ko: CARDINAL;\r
- Jos: BOOLEAN;\r
- BEGIN\r
- Ok:= Ok AND Exists(Ime);\r
- IF Ok THEN\r
- F:= Open(Ime);\r
- Dim:= RdCard(F);\r
- Vr:= 1;\r
- Jos:= TRUE;\r
- WHILE Jos AND (Vr <= Dim) DO\r
- Ko:= 1;\r
- WHILE Jos AND (Ko <= Dim) DO\r
- Slika[Vr, Ko]:= RdCard(F);\r
- Ok:= Ok AND (Slika[Vr, Ko] < BrojBoja);\r
- Jos:= Ok AND NOT EOF;\r
- INC(Ko);\r
- END;\r
- INC(Vr);\r
- END;\r
- Close(F);\r
- ELSE\r
- Dim:= 0;\r
- END;\r
- END Citaj;\r
-\r
- PROCEDURE Proveri(VAR Velika, Mala: Slika;\r
- DimMal, Vr, Ko: CARDINAL): BOOLEAN;\r
- VAR\r
- i, j: CARDINAL;\r
- Iste: BOOLEAN;\r
- BEGIN\r
- Iste:= TRUE;\r
- i:= 1;\r
- WHILE Iste AND (i <= DimMal) DO\r
- j:= 1;\r
- WHILE Iste AND (j <= DimMal) DO\r
- IF Mala[i, j] # Velika[Vr + i - 1, Ko + j - 1] THEN\r
- Iste:= FALSE;\r
- END;\r
- INC(j);\r
- END;\r
- INC(i);\r
- END;\r
- RETURN Iste;\r
- END Proveri;\r
-\r
- PROCEDURE Hash(S: Slika; DimMal, Vr: CARDINAL): LONGCARD;\r
- VAR\r
- i, j: CARDINAL;\r
- Kljuc, ZbirKolone, Temp: LONGCARD;\r
- BEGIN\r
-\r
- Stepen:= 1;\r
- Kljuc:= 0;\r
-\r
- FOR i:= DimMal TO 1 BY -1 DO\r
-\r
- ZbirKolone:= 0;\r
- FOR j:= Vr TO Vr + DimMal - 1 DO\r
- ZbirKolone:= ZbirKolone + LONGCARD(S[j, i]);\r
- END;\r
-\r
- Temp:= (ZbirKolone * Stepen) MOD ProstBroj;\r
- Kljuc:= (Kljuc + Temp) MOD ProstBroj;\r
- Stepen:= (Stepen * Osnova) MOD ProstBroj;\r
-\r
- END;\r
-\r
- Stepen:= Stepen DIV Osnova;\r
-\r
- RETURN Kljuc;\r
-\r
- END Hash;\r
-\r
- PROCEDURE DoterajHash(S: Slika; DimMal, Vr, Ko: CARDINAL;\r
- VAR Kljuc: LONGCARD);\r
- VAR\r
- i, j: CARDINAL;\r
- ZbirKolone, Temp: LONGCARD;\r
- BEGIN\r
-\r
- ZbirKolone:= 0;\r
- FOR j:= Vr TO Vr + DimMal - 1 DO\r
- ZbirKolone:= ZbirKolone + LONGCARD(S[j, Ko - 1]);\r
- END;\r
-\r
- Temp:= (ZbirKolone * Stepen) MOD ProstBroj;\r
-\r
- IF Kljuc >= Temp THEN\r
- Kljuc:= Kljuc - Temp;\r
- ELSE\r
- Kljuc:= Kljuc + ProstBroj - Temp;\r
- END;\r
-\r
- Kljuc:= (Kljuc * Osnova) MOD ProstBroj;\r
-\r
- ZbirKolone:= 0;\r
- FOR j:= Vr TO Vr + DimMal - 1 DO\r
- ZbirKolone:= ZbirKolone + LONGCARD(S[j, Ko + DimMal - 1]);\r
- END;\r
-\r
- Kljuc:= (Kljuc + ZbirKolone) MOD ProstBroj;\r
-\r
- END DoterajHash;\r
-\r
-BEGIN\r
- Ok:= TRUE;\r
- Citaj(Velika, ImeVel, DimVel, Ok);\r
- Citaj(Mala, ImeMal, DimMal, Ok);\r
- IF Ok THEN\r
- KljucMale:= Hash(Mala, DimMal, 1);\r
- FOR Vr:= 1 TO (DimVel - DimMal + 1) DO\r
- KljucSegmenta:= Hash(Velika, DimMal, Vr);\r
- IF (KljucMale = KljucSegmenta) THEN\r
- Iste:= Proveri(Velika, Mala, DimMal, Vr, 1);\r
- IF Iste THEN\r
- WrLn;\r
- WrStr('Podslika je nadjena. Pocinje na poziciji (');\r
- WrCard(Vr, 1); WrStr(', '); WrCard(1, 1); WrStr(')');\r
- END;\r
- END;\r
- FOR Ko:= 2 TO (DimVel - DimMal + 1) DO\r
- DoterajHash(Velika, DimMal, Vr, Ko, KljucSegmenta);\r
- IF (KljucMale = KljucSegmenta) THEN\r
- Iste:= Proveri(Velika, Mala, DimMal, Vr, Ko);\r
- IF Iste THEN\r
- WrLn;\r
- WrStr('Podslika je nadjena. Pocinje na poziciji (');\r
- WrCard(Vr, 1); WrStr(', '); WrCard(Ko, 1); WrStr(')');\r
- END;\r
- END;\r
- END;\r
- END;\r
- ELSE\r
- WrStr('Greska u citanju fajla.');\r
- END;\r
-END Podslika.\r
diff --git a/02. Podslika/TopSpeed/MALA.SLI b/02. Podslika/TopSpeed/MALA.SLI
--- /dev/null
@@ -0,0 +1,6 @@
+5\r
+ 0 0 1 0 0\r
+ 0 1 1 1 0\r
+ 1 1 2 1 1\r
+ 0 1 1 1 0\r
+ 0 0 1 0 0\r
diff --git a/02. Podslika/TopSpeed/PODSLIKA.MOD b/02. Podslika/TopSpeed/PODSLIKA.MOD
--- /dev/null
@@ -0,0 +1,168 @@
+MODULE Podslika;\r
+\r
+ FROM FIO IMPORT\r
+ File, Open, Close, RdCard, EOF, OK, Exists;\r
+ FROM IO IMPORT\r
+ WrLn, WrStr, WrCard;\r
+\r
+ CONST\r
+ MaxDim = 100;\r
+ BrojBoja = 16;\r
+ Osnova = MaxDim * (BrojBoja - 1) + 1;\r
+ ProstBroj = 3001;\r
+ ImeVel = 'Velika.Sli';\r
+ ImeMal = 'Mala.Sli';\r
+\r
+ TYPE\r
+ Boja = [0 .. BrojBoja - 1];\r
+ Slika = ARRAY [1 .. MaxDim], [1 .. MaxDim] OF Boja;\r
+\r
+ VAR\r
+ Velika, Mala: Slika;\r
+ DimVel, DimMal, Vr, Ko: CARDINAL;\r
+ KljucMale, KljucSegmenta, Stepen: LONGCARD;\r
+ Ok, Iste: BOOLEAN;\r
+\r
+ PROCEDURE Citaj(VAR Slika: Slika;\r
+ Ime: ARRAY OF CHAR;\r
+ VAR Dim: CARDINAL;\r
+ VAR Ok: BOOLEAN);\r
+ VAR\r
+ F: File;\r
+ Vr, Ko: CARDINAL;\r
+ Jos: BOOLEAN;\r
+ BEGIN\r
+ Ok:= Ok AND Exists(Ime);\r
+ IF Ok THEN\r
+ F:= Open(Ime);\r
+ Dim:= RdCard(F);\r
+ Vr:= 1;\r
+ Jos:= TRUE;\r
+ WHILE Jos AND (Vr <= Dim) DO\r
+ Ko:= 1;\r
+ WHILE Jos AND (Ko <= Dim) DO\r
+ Slika[Vr, Ko]:= RdCard(F);\r
+ Ok:= Ok AND (Slika[Vr, Ko] < BrojBoja);\r
+ Jos:= Ok AND NOT EOF;\r
+ INC(Ko);\r
+ END;\r
+ INC(Vr);\r
+ END;\r
+ Close(F);\r
+ ELSE\r
+ Dim:= 0;\r
+ END;\r
+ END Citaj;\r
+\r
+ PROCEDURE Proveri(VAR Velika, Mala: Slika;\r
+ DimMal, Vr, Ko: CARDINAL): BOOLEAN;\r
+ VAR\r
+ i, j: CARDINAL;\r
+ Iste: BOOLEAN;\r
+ BEGIN\r
+ Iste:= TRUE;\r
+ i:= 1;\r
+ WHILE Iste AND (i <= DimMal) DO\r
+ j:= 1;\r
+ WHILE Iste AND (j <= DimMal) DO\r
+ IF Mala[i, j] # Velika[Vr + i - 1, Ko + j - 1] THEN\r
+ Iste:= FALSE;\r
+ END;\r
+ INC(j);\r
+ END;\r
+ INC(i);\r
+ END;\r
+ RETURN Iste;\r
+ END Proveri;\r
+\r
+ PROCEDURE Hash(S: Slika; DimMal, Vr: CARDINAL): LONGCARD;\r
+ VAR\r
+ i, j: CARDINAL;\r
+ Kljuc, ZbirKolone, Temp: LONGCARD;\r
+ BEGIN\r
+\r
+ Stepen:= 1;\r
+ Kljuc:= 0;\r
+\r
+ FOR i:= DimMal TO 1 BY -1 DO\r
+\r
+ ZbirKolone:= 0;\r
+ FOR j:= Vr TO Vr + DimMal - 1 DO\r
+ ZbirKolone:= ZbirKolone + LONGCARD(S[j, i]);\r
+ END;\r
+\r
+ Temp:= (ZbirKolone * Stepen) MOD ProstBroj;\r
+ Kljuc:= (Kljuc + Temp) MOD ProstBroj;\r
+ Stepen:= (Stepen * Osnova) MOD ProstBroj;\r
+\r
+ END;\r
+\r
+ Stepen:= Stepen DIV Osnova;\r
+\r
+ RETURN Kljuc;\r
+\r
+ END Hash;\r
+\r
+ PROCEDURE DoterajHash(S: Slika; DimMal, Vr, Ko: CARDINAL;\r
+ VAR Kljuc: LONGCARD);\r
+ VAR\r
+ i, j: CARDINAL;\r
+ ZbirKolone, Temp: LONGCARD;\r
+ BEGIN\r
+\r
+ ZbirKolone:= 0;\r
+ FOR j:= Vr TO Vr + DimMal - 1 DO\r
+ ZbirKolone:= ZbirKolone + LONGCARD(S[j, Ko - 1]);\r
+ END;\r
+\r
+ Temp:= (ZbirKolone * Stepen) MOD ProstBroj;\r
+\r
+ IF Kljuc >= Temp THEN\r
+ Kljuc:= Kljuc - Temp;\r
+ ELSE\r
+ Kljuc:= Kljuc + ProstBroj - Temp;\r
+ END;\r
+\r
+ Kljuc:= (Kljuc * Osnova) MOD ProstBroj;\r
+\r
+ ZbirKolone:= 0;\r
+ FOR j:= Vr TO Vr + DimMal - 1 DO\r
+ ZbirKolone:= ZbirKolone + LONGCARD(S[j, Ko + DimMal - 1]);\r
+ END;\r
+\r
+ Kljuc:= (Kljuc + ZbirKolone) MOD ProstBroj;\r
+\r
+ END DoterajHash;\r
+\r
+BEGIN\r
+ Ok:= TRUE;\r
+ Citaj(Velika, ImeVel, DimVel, Ok);\r
+ Citaj(Mala, ImeMal, DimMal, Ok);\r
+ IF Ok THEN\r
+ KljucMale:= Hash(Mala, DimMal, 1);\r
+ FOR Vr:= 1 TO (DimVel - DimMal + 1) DO\r
+ KljucSegmenta:= Hash(Velika, DimMal, Vr);\r
+ IF (KljucMale = KljucSegmenta) THEN\r
+ Iste:= Proveri(Velika, Mala, DimMal, Vr, 1);\r
+ IF Iste THEN\r
+ WrLn;\r
+ WrStr('Podslika je nadjena. Pocinje na poziciji (');\r
+ WrCard(Vr, 1); WrStr(', '); WrCard(1, 1); WrStr(')');\r
+ END;\r
+ END;\r
+ FOR Ko:= 2 TO (DimVel - DimMal + 1) DO\r
+ DoterajHash(Velika, DimMal, Vr, Ko, KljucSegmenta);\r
+ IF (KljucMale = KljucSegmenta) THEN\r
+ Iste:= Proveri(Velika, Mala, DimMal, Vr, Ko);\r
+ IF Iste THEN\r
+ WrLn;\r
+ WrStr('Podslika je nadjena. Pocinje na poziciji (');\r
+ WrCard(Vr, 1); WrStr(', '); WrCard(Ko, 1); WrStr(')');\r
+ END;\r
+ END;\r
+ END;\r
+ END;\r
+ ELSE\r
+ WrStr('Greska u citanju fajla.');\r
+ END;\r
+END Podslika.\r
diff --git a/02. Podslika/TopSpeed/VELIKA.SLI b/02. Podslika/TopSpeed/VELIKA.SLI
--- /dev/null
@@ -0,0 +1,13 @@
+12\r
+ 0 0 0 0 0 0 0 0 0 0 0 0\r
+ 0 0 0 0 0 0 0 0 0 0 0 0\r
+ 0 0 0 1 0 0 0 0 0 0 0 0\r
+ 0 0 1 1 1 0 0 0 0 0 0 0\r
+ 0 1 1 2 1 1 0 0 0 0 0 0\r
+ 0 0 1 1 1 0 5 5 5 0 0 0\r
+ 0 0 0 1 0 0 0 0 0 0 0 0\r
+ 0 0 0 0 0 5 0 0 1 0 0 0\r
+ 0 0 0 0 5 0 0 1 2 1 0 0\r
+ 0 0 0 5 0 0 1 2 15 2 1 0\r
+ 0 0 5 0 0 0 0 1 2 1 0 0\r
+ 0 0 0 0 0 0 0 0 1 0 0 0\r
diff --git a/02. Podslika/VELIKA.SLI b/02. Podslika/VELIKA.SLI
--- a/02. Podslika/VELIKA.SLI
+++ /dev/null
@@ -1,13 +0,0 @@
-12\r
- 0 0 0 0 0 0 0 0 0 0 0 0\r
- 0 0 0 0 0 0 0 0 0 0 0 0\r
- 0 0 0 1 0 0 0 0 0 0 0 0\r
- 0 0 1 1 1 0 0 0 0 0 0 0\r
- 0 1 1 2 1 1 0 0 0 0 0 0\r
- 0 0 1 1 1 0 5 5 5 0 0 0\r
- 0 0 0 1 0 0 0 0 0 0 0 0\r
- 0 0 0 0 0 5 0 0 1 0 0 0\r
- 0 0 0 0 5 0 0 1 2 1 0 0\r
- 0 0 0 5 0 0 1 2 15 2 1 0\r
- 0 0 5 0 0 0 0 1 2 1 0 0\r
- 0 0 0 0 0 0 0 0 1 0 0 0\r