1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80:
| function TEulerQU.Zufall(L, Art: integer): string; var K, WO: integer; tmp, Idx: integer; Mix: array[1..29] of integer; TmpChar: UnicodeChar; begin for K := 1 to L do Mix[k] := k; for k := L downto 2 do begin Idx := Random(k) + 1; tmp := Mix[idx]; Mix[idx] := Mix[k];Mix[k] := tmp; for Wo := 1 to L do begin TmpChar := MatrixG[Wo, tmp]; MatrixG[Wo, tmp] := MatrixG[Wo, K]; MatrixG[Wo, K] := TmpChar;
TmpChar := MatrixL[Wo, tmp]; MatrixL[Wo, tmp] := MatrixL[Wo, K]; MatrixL[Wo, K] := TmpChar; end; end;
for K := 1 to L do Mix[k] := k; for k := L downto 2 do begin Idx := Random(k) + 1; tmp := Mix[idx]; Mix[idx] := Mix[k];Mix[k] := tmp; for Wo := 1 to L do begin TmpChar := MatrixG[tmp, Wo]; MatrixG[tmp, Wo] := MatrixG[K, Wo]; MatrixG[K, Wo] := TmpChar;
TmpChar := MatrixL[tmp, Wo]; MatrixL[tmp, Wo] := MatrixL[K, Wo]; MatrixL[K, Wo] := TmpChar; end; end; end;
procedure TEulerQU.StartClick(Sender: TObject); var N, K, L: integer; TeilG, TeilK: string; begin N := StrToInt(Anzahl.Text); TeilG := copy(Gross, 1, N); TeilK := copy(Klein, 1, N);
for K := 1 to N do begin for L := 1 to N do begin MatrixL[L, K] := TeilG[L]; MatrixG[K, L] := TeilK[L]; end; TeilG := copy(TeilG, 2, N - 1) + TeilG[1]; TeilK := TeilK[N] + copy(TeilK, 1, N - 1); end; LateinGriechisch.Selection := TGridRect(Rect(-1, -1, -1, -1)); if ABCzufaellig.Checked then Zufall(L, 0); for K := 1 to N do for L := 1 to N do begin MatrixE[L, K] := MatrixL[L, K] + MatrixG[L, K]; LateinGriechisch.Cells[L - 1, K - 1] := MatrixE[L, K]; end; Farbig.Repaint; end; |