From ca363a002d70171c0373a2efaf41b19467caa11a Mon Sep 17 00:00:00 2001 From: Mikhalkovich Stanislav Date: Tue, 7 Jul 2020 21:52:34 +0300 Subject: [PATCH] =?UTF-8?q?Turtle=20-=20=D0=BF=D0=B0=D0=B4=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D0=B5=20=D0=B8=D0=BD=D1=81=D1=82=D0=B0=D0=BB=D0=BB=D1=8F?= =?UTF-8?q?=D1=82=D0=BE=D1=80=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Configuration/GlobalAssemblyInfo.cs | 2 +- Configuration/Version.defs | 2 +- .../StandardUnits/Turtle/Turtle1.pas | 53 ++++++++++++++++++ Localization/DefaultLang.resources | Bin 94818 -> 94892 bytes Release/pabcversion.txt | 2 +- ReleaseGenerators/PascalABCNET_version.nsh | 2 +- ReleaseGenerators/RebuildStandartModules.pas | 2 +- ReleaseGenerators/sect_Core.nsh | 4 ++ bin/Lib/Controls.pas | 5 +- bin/Lib/Turtle.pas | 49 ++++++++++++++++ 10 files changed, 114 insertions(+), 7 deletions(-) create mode 100644 InstallerSamples/StandardUnits/Turtle/Turtle1.pas create mode 100644 bin/Lib/Turtle.pas diff --git a/Configuration/GlobalAssemblyInfo.cs b/Configuration/GlobalAssemblyInfo.cs index de2f2a81b..443cbbdce 100644 --- a/Configuration/GlobalAssemblyInfo.cs +++ b/Configuration/GlobalAssemblyInfo.cs @@ -15,7 +15,7 @@ internal static class RevisionClass public const string Major = "3"; public const string Minor = "6"; public const string Build = "3"; - public const string Revision = "2552"; + public const string Revision = "2556"; public const string MainVersion = Major + "." + Minor; public const string FullVersion = Major + "." + Minor + "." + Build + "." + Revision; diff --git a/Configuration/Version.defs b/Configuration/Version.defs index 6ae7b119a..0df7c9511 100644 --- a/Configuration/Version.defs +++ b/Configuration/Version.defs @@ -1,4 +1,4 @@ %COREVERSION%=3 -%REVISION%=2552 +%REVISION%=2556 %MINOR%=6 %MAJOR%=3 diff --git a/InstallerSamples/StandardUnits/Turtle/Turtle1.pas b/InstallerSamples/StandardUnits/Turtle/Turtle1.pas new file mode 100644 index 000000000..2d40e8812 --- /dev/null +++ b/InstallerSamples/StandardUnits/Turtle/Turtle1.pas @@ -0,0 +1,53 @@ +uses Turtle,GraphWPF; + +var + Atom,FStr,XStr,YStr: string; + angle,len,x0,y0: real; + n: integer; + +procedure Init1; // Dragon +begin + (Atom,FStr,XStr,YStr) := ('fx','f','x+yf+','-fx-y'); + (angle,len,n,x0,y0) := (90,3,15,300,450); +end; + +procedure Init2; // Koch curve +begin + (Atom,FStr,XStr,YStr) := ('F', 'F-F++F-F', '', ''); + (angle,len,n,x0,y0) := (60,5,7,10,550); +end; + +procedure Init3; // Quadratic Koch Island +begin + (Atom,FStr,XStr,YStr) := ('F+F+F+F', 'F+F-FF+F+F-F', '', ''); + (angle,len,n,x0,y0) := (90,4,4,250,450); +end; + +procedure Init4; // Gosper hexagonal curve +begin + (Atom,FStr,XStr,YStr) := ('XF', 'F', 'X+YF++YF-FX--FXFX-YF+','-FX+YFYF++YF+FX--FX-Y'); + (angle,len,n,x0,y0) := (60,4,5,580,56); +end; + +procedure RunStr(s: string; n: integer); +begin + foreach var c in s do + case c of + '+': Turn(angle); + '-': Turn(-angle); + 'f','F': if n>0 then RunStr(FStr,n-1) else Forw(len); + 'x','X': if n>0 then RunStr(XStr,n-1); + 'y','Y': if n>0 then RunStr(YStr,n-1); + else Print('error') + end; +end; + +begin + Init4; + ToPoint(x0,y0); + SetWidth(0.5); + //SetColor(Colors.Red); + Down; + RunStr(Atom,n); + Up; +end. \ No newline at end of file diff --git a/Localization/DefaultLang.resources b/Localization/DefaultLang.resources index f50eebaa756fd34713ba21fedf9d111778e5795a..3b61dd5c3bfc193e2d08482b3d6dcc5b11e58da2 100644 GIT binary patch delta 73 zcmV-P0Ji_) fPE%BtUI7#f@9^j#=iubv?da%}%S|1#Sgi`hjOHO1 delta 23 hcmV+y0O nil then ValueChanged; public - event ValueChanged: procedure; + ValueChanged: procedure; constructor Create(min, max, val: real); begin Invoke(CreateP, min, max, val); diff --git a/bin/Lib/Turtle.pas b/bin/Lib/Turtle.pas new file mode 100644 index 000000000..e427420d4 --- /dev/null +++ b/bin/Lib/Turtle.pas @@ -0,0 +1,49 @@ +/// Исполнитель Черепаха +unit Turtle; + +uses GraphWPF; + +var + tp := Window.Center; + a: real := 0; + dr := False; + +/// Поворачивает Черепаху на угол da против часовой стрелки +procedure Turn(da: real); +begin + a += da; +end; + +/// Продвигает Черепаху вперёд на расстояние r +procedure Forw(r: real); +begin + tp += r * Vect(Cos(DegToRad(a)),Sin(DegToRad(a))); + if dr then + LineTo(tp.X,tp.Y) + else MoveTo(tp.X,tp.Y) +end; + +/// Опускает хвост Черепахи +procedure Down := dr := True; + +/// Поднимает хвост Черепахи +procedure Up := dr := False; + +/// Устанавливает ширину линии +procedure SetWidth(w: real) := Pen.Width := w; + +/// Устанавливает цвет линии +procedure SetColor(c: GColor) := Pen.Color := c; + +/// Перемещает Черепаху в точку (x,y) +procedure ToPoint(x,y: real); +begin + tp := Pnt(x,y); + MoveTo(tp.X,tp.Y); +end; + + +begin + pen.RoundCap := True; + MoveTo(tp.X,tp.Y) +end. \ No newline at end of file