fractal2.PAS 955 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. Uses Lsystems,Graph;
  2. var
  3. Inp : TEXT;
  4. Ax,Comm,Fname : string;
  5. Frac : PLSYS;
  6. Rule : string;
  7. Turn,r : integer;
  8. Label P1,P2;
  9. begin
  10. If ParamCount <> 1 then Assign(Inp,'input.fra')
  11. else Assign(inp,ParamStr(1));
  12. {$I-}
  13. Reset(Inp);
  14. {$I+}
  15. If IOResult <> 0 then
  16. begin
  17. WriteLn('File open Error');
  18. HAlt(220);
  19. end;
  20. ReadLn(inp,comm);
  21. repeat
  22. readln(inp,ax);
  23. until comm[1] = ';';
  24. Val(Ax,Turn,R);
  25. ReadLn(Inp,Ax);
  26. Frac := CreateLsys(Ax,copy(Comm,2,Length(Comm)-1),Turn);
  27. while not EOF(inp) do begin
  28. ReadLn(inp,rule);
  29. if Length(Rule) > 2 then AddRule(Frac,rule[1],copy(rule,3,Length(rule)-2));
  30. end;
  31. turn:=0;
  32. r:=0;
  33. InitGraph(r,turn,'');
  34. fname := calculate(Frac,0);
  35. P1:
  36. asm
  37. mov ah, 01
  38. int 16h
  39. jnz P2
  40. end;
  41. ClearDevice;
  42. DrawLsys(Fname,frac);
  43. fname := Advance(Frac,Fname);
  44. goto p1;
  45. P2:
  46. ReadLn;
  47. CloseGraph;
  48. DestroyLsys(Frac);
  49. end.