From f5fb2eefc4d01ea878b8b5259c9f2e886837715f Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Mon, 8 Apr 2019 14:16:13 -0400 Subject: [PATCH 001/149] Create finalproject.py --- finalproject.py | 1 + 1 file changed, 1 insertion(+) create mode 100644 finalproject.py diff --git a/finalproject.py b/finalproject.py new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/finalproject.py @@ -0,0 +1 @@ + From 7745ad7f2636f6109dbb599aaa9fa568a36e502e Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Tue, 9 Apr 2019 14:25:28 -0400 Subject: [PATCH 002/149] Updated from Brython Server: 4/9/2019 2:25:23 PM --- finalproject.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/finalproject.py b/finalproject.py index 8b137891..d240426f 100644 --- a/finalproject.py +++ b/finalproject.py @@ -1 +1,5 @@ +''' +miViriaz15 Final Project - turtle graphics in ggame +https://docs.python.org/3.3/library/turtle.html?highlight=turtle +''' From 50183466eea93aad3588bf260c07d14291068f7c Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Tue, 9 Apr 2019 14:51:47 -0400 Subject: [PATCH 003/149] Updated from Brython Server: 4/9/2019 2:51:45 PM --- finalproject.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/finalproject.py b/finalproject.py index d240426f..a863d07e 100644 --- a/finalproject.py +++ b/finalproject.py @@ -3,3 +3,11 @@ https://docs.python.org/3.3/library/turtle.html?highlight=turtle ''' +from ggame import App, RectangleAsset, ImageAsset, Sprite, LineStyle, Color, Frame, PolygonAsset + +class Turtle(Sprite): + + def __init__(self): + super.__init__(centerposition, PolygonAsset()) + + #position, direction, penstate, color \ No newline at end of file From 9fb5466d036383c8d38bfd6bc687fd733df9a2b6 Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Tue, 9 Apr 2019 15:04:57 -0400 Subject: [PATCH 004/149] Updated from Brython Server: 4/9/2019 3:04:52 PM --- finalproject.py | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/finalproject.py b/finalproject.py index a863d07e..0d0aee91 100644 --- a/finalproject.py +++ b/finalproject.py @@ -3,11 +3,24 @@ https://docs.python.org/3.3/library/turtle.html?highlight=turtle ''' -from ggame import App, RectangleAsset, ImageAsset, Sprite, LineStyle, Color, Frame, PolygonAsset +from ggame import App, RectangleAsset, ImageAsset, Sprite, LineStyle, Color, Frame, PolygonAsset, EllipseAsset, CircleAsset + +#defining colors +black = Color(0x000000, 1.0) +white = Color(0xFFFFFF, 1.0) + + +#defining line +thinlinewhite = LineStyle(1, white) +thinlineblack = LineStyle(1, black) + + + class Turtle(Sprite): - + #screencenter + startturtle=PolygonAsset([(5,5),(25,10),(5,15),(10,10),(5,5)],thinlineblack, white) def __init__(self): - super.__init__(centerposition, PolygonAsset()) + super().__init__(screencenter, startturtle) #position, direction, penstate, color \ No newline at end of file From cb72f3fd46c6936c701fbabe092313d2bb251517 Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Tue, 9 Apr 2019 15:08:00 -0400 Subject: [PATCH 005/149] Updated from Brython Server: 4/9/2019 3:07:58 PM --- finalproject.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/finalproject.py b/finalproject.py index 0d0aee91..90bc912a 100644 --- a/finalproject.py +++ b/finalproject.py @@ -4,7 +4,7 @@ ''' from ggame import App, RectangleAsset, ImageAsset, Sprite, LineStyle, Color, Frame, PolygonAsset, EllipseAsset, CircleAsset - +myapp = App() #defining colors black = Color(0x000000, 1.0) white = Color(0xFFFFFF, 1.0) @@ -14,13 +14,16 @@ thinlinewhite = LineStyle(1, white) thinlineblack = LineStyle(1, black) +Sprite(PolygonAsset([(5,5),(20,12),(5,19),(10,12),(5,5)],thinlineblack, white)) - - +''' class Turtle(Sprite): #screencenter startturtle=PolygonAsset([(5,5),(25,10),(5,15),(10,10),(5,5)],thinlineblack, white) def __init__(self): super().__init__(screencenter, startturtle) - #position, direction, penstate, color \ No newline at end of file + #position, direction, penstate, color +''' + +myapp.run() \ No newline at end of file From 545ff99df39a82b7d8b867d8aee5d228ea0cf82c Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Tue, 9 Apr 2019 15:11:19 -0400 Subject: [PATCH 006/149] Updated from Brython Server: 4/9/2019 3:11:17 PM --- finalproject.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/finalproject.py b/finalproject.py index 90bc912a..405f44dd 100644 --- a/finalproject.py +++ b/finalproject.py @@ -26,4 +26,5 @@ def __init__(self): #position, direction, penstate, color ''' -myapp.run() \ No newline at end of file +myapp.run() + From 732b85fdff22e5a0cbc499a4d1f6bb10a22c45b6 Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Tue, 9 Apr 2019 17:51:00 -0400 Subject: [PATCH 007/149] Updated from Brython Server: 4/9/2019 5:51:00 PM --- finalproject.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/finalproject.py b/finalproject.py index 405f44dd..bfa4f8a8 100644 --- a/finalproject.py +++ b/finalproject.py @@ -14,7 +14,7 @@ thinlinewhite = LineStyle(1, white) thinlineblack = LineStyle(1, black) -Sprite(PolygonAsset([(5,5),(20,12),(5,19),(10,12),(5,5)],thinlineblack, white)) +Sprite(PolygonAsset([(5,5),(19,13),(5,21),(10,13),(5,5)],thinlineblack, white)) ''' class Turtle(Sprite): @@ -28,3 +28,5 @@ def __init__(self): myapp.run() + +__main__ From 887c04a336fa48aedd9aba5a8cf04dc386d862ee Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Wed, 10 Apr 2019 14:09:56 -0400 Subject: [PATCH 008/149] Updated from Brython Server: 4/10/2019 2:09:56 PM --- finalproject.py | 38 ++++++++++++++++++++++++++------------ 1 file changed, 26 insertions(+), 12 deletions(-) diff --git a/finalproject.py b/finalproject.py index bfa4f8a8..07973102 100644 --- a/finalproject.py +++ b/finalproject.py @@ -4,29 +4,43 @@ ''' from ggame import App, RectangleAsset, ImageAsset, Sprite, LineStyle, Color, Frame, PolygonAsset, EllipseAsset, CircleAsset -myapp = App() + +#myapp = App() #defining colors -black = Color(0x000000, 1.0) -white = Color(0xFFFFFF, 1.0) +#black = Color(0x000000, 1.0) +#white = Color(0xFFFFFF, 1.0) #defining line -thinlinewhite = LineStyle(1, white) -thinlineblack = LineStyle(1, black) +#thinlinewhite = LineStyle(1, white) +#thinlineblack = LineStyle(1, black) -Sprite(PolygonAsset([(5,5),(19,13),(5,21),(10,13),(5,5)],thinlineblack, white)) +#Sprite(PolygonAsset([(5,5),(19,13),(5,21),(10,13),(5,5)],thinlineblack, black)) + +class Screen: + app=None + def __init__(self): + Screen.app=App() + Screen.app.run() -''' class Turtle(Sprite): - #screencenter - startturtle=PolygonAsset([(5,5),(25,10),(5,15),(10,10),(5,5)],thinlineblack, white) + #defining colors + black = Color(0x000000, 1.0) + white = Color(0xFFFFFF, 1.0) + thinlinewhite = LineStyle(1, white) + thinlineblack = LineStyle(1, black) def __init__(self): + width=Screen.app.width + height=Screen.app.height + screencenter=(width/2,height/2) + startturtle=PolygonAsset([(5,5),(25,10),(5,15),(10,10),(5,5)],self.thinlineblack, self.white) super().__init__(screencenter, startturtle) #position, direction, penstate, color -''' +Screen() +Turtle() -myapp.run() +'''myapp.run() -__main__ +__main__''' \ No newline at end of file From 691ed7a6e36d27656e0c41fdccbf18ad7c066f2b Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Fri, 12 Apr 2019 14:38:21 -0400 Subject: [PATCH 009/149] Updated from Brython Server: 4/12/2019 2:38:20 PM --- finalproject.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/finalproject.py b/finalproject.py index 07973102..aa617b19 100644 --- a/finalproject.py +++ b/finalproject.py @@ -33,8 +33,8 @@ def __init__(self): width=Screen.app.width height=Screen.app.height screencenter=(width/2,height/2) - startturtle=PolygonAsset([(5,5),(25,10),(5,15),(10,10),(5,5)],self.thinlineblack, self.white) - super().__init__(screencenter, startturtle) + startturtle=PolygonAsset([(5,5),(19,13),(5,21),(10,13),(5,5)],self.thinlineblack, self.white) + super().__init__(startturtle, screencenter) #position, direction, penstate, color Screen() From 52c4588ce8bd8908a85eed50f312d18c7d77d198 Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Fri, 12 Apr 2019 14:38:58 -0400 Subject: [PATCH 010/149] Updated from Brython Server: 4/12/2019 2:38:57 PM --- finalproject.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/finalproject.py b/finalproject.py index aa617b19..48c50f70 100644 --- a/finalproject.py +++ b/finalproject.py @@ -15,7 +15,7 @@ #thinlinewhite = LineStyle(1, white) #thinlineblack = LineStyle(1, black) -#Sprite(PolygonAsset([(5,5),(19,13),(5,21),(10,13),(5,5)],thinlineblack, black)) +#Sprite(PolygonAsset([(5,5),(20,13),(5,21),(10,13),(5,5)],thinlineblack, black)) class Screen: app=None @@ -33,7 +33,7 @@ def __init__(self): width=Screen.app.width height=Screen.app.height screencenter=(width/2,height/2) - startturtle=PolygonAsset([(5,5),(19,13),(5,21),(10,13),(5,5)],self.thinlineblack, self.white) + startturtle=PolygonAsset([(5,5),(20,13),(5,21),(10,13),(5,5)],self.thinlineblack, self.black) super().__init__(startturtle, screencenter) #position, direction, penstate, color From 97d68106c8c3c4bfbf3081fd93c32e1ca8bbe6a3 Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Fri, 12 Apr 2019 14:59:41 -0400 Subject: [PATCH 011/149] Updated from Brython Server: 4/12/2019 2:59:40 PM --- finalproject.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/finalproject.py b/finalproject.py index 48c50f70..6748c43c 100644 --- a/finalproject.py +++ b/finalproject.py @@ -4,6 +4,7 @@ ''' from ggame import App, RectangleAsset, ImageAsset, Sprite, LineStyle, Color, Frame, PolygonAsset, EllipseAsset, CircleAsset +from math import pi #myapp = App() #defining colors @@ -35,10 +36,14 @@ def __init__(self): screencenter=(width/2,height/2) startturtle=PolygonAsset([(5,5),(20,13),(5,21),(10,13),(5,5)],self.thinlineblack, self.black) super().__init__(startturtle, screencenter) + def right(x): + startturtle.rotation(x*pi/180) + #position, direction, penstate, color Screen() -Turtle() +alex=Turtle() +alex.right(90) '''myapp.run() From a7801759c32287621d38a3262c1e385f3d7caeaa Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Fri, 12 Apr 2019 17:02:55 -0400 Subject: [PATCH 012/149] Updated from Brython Server: 4/12/2019 5:02:54 PM --- finalproject.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/finalproject.py b/finalproject.py index 6748c43c..56c396fb 100644 --- a/finalproject.py +++ b/finalproject.py @@ -37,8 +37,9 @@ def __init__(self): startturtle=PolygonAsset([(5,5),(20,13),(5,21),(10,13),(5,5)],self.thinlineblack, self.black) super().__init__(startturtle, screencenter) def right(x): - startturtle.rotation(x*pi/180) - + startturtle.rotation=(x*pi/180) + def rt(x): + return right(x) #position, direction, penstate, color Screen() From e0dce3c32279441a280ca748943050e3af567e7a Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Mon, 22 Apr 2019 14:44:12 -0400 Subject: [PATCH 013/149] Updated from Brython Server: 4/22/2019 2:44:12 PM --- finalproject.py | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/finalproject.py b/finalproject.py index 56c396fb..74bfe66d 100644 --- a/finalproject.py +++ b/finalproject.py @@ -36,15 +36,25 @@ def __init__(self): screencenter=(width/2,height/2) startturtle=PolygonAsset([(5,5),(20,13),(5,21),(10,13),(5,5)],self.thinlineblack, self.black) super().__init__(startturtle, screencenter) - def right(x): - startturtle.rotation=(x*pi/180) - def rt(x): - return right(x) + + def right(self,x): + '''rotates turtle x degrees right''' + self.rotation = self.rotation - x*pi/180 + def rt(self,x): + '''rotates turtle x degrees right''' + return self.right(x) + + def left(self,x): + '''rotates turtle x degrees left''' + self.rotation = self.rotation + x*pi/180 + def lt(self, x) + '''rotates turtle x degrees left''' + return self.left(x) #position, direction, penstate, color Screen() alex=Turtle() -alex.right(90) +alex.rt(90) '''myapp.run() From 2490e899637f8c0dcdbe2efc910c14debd37ec0d Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Mon, 22 Apr 2019 14:45:40 -0400 Subject: [PATCH 014/149] Updated from Brython Server: 4/22/2019 2:45:40 PM --- finalproject.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/finalproject.py b/finalproject.py index 74bfe66d..f6950146 100644 --- a/finalproject.py +++ b/finalproject.py @@ -47,7 +47,7 @@ def rt(self,x): def left(self,x): '''rotates turtle x degrees left''' self.rotation = self.rotation + x*pi/180 - def lt(self, x) + def lt(self,x): '''rotates turtle x degrees left''' return self.left(x) From faff3cf39529e0e902e97eb90605cbd3e8dfb73e Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Mon, 22 Apr 2019 14:46:24 -0400 Subject: [PATCH 015/149] Updated from Brython Server: 4/22/2019 2:46:24 PM --- finalproject.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/finalproject.py b/finalproject.py index f6950146..f827064a 100644 --- a/finalproject.py +++ b/finalproject.py @@ -33,7 +33,7 @@ class Turtle(Sprite): def __init__(self): width=Screen.app.width height=Screen.app.height - screencenter=(width/2,height/2) + screencenter=(width/2,height/2) #finds a tuple for the center of the screen startturtle=PolygonAsset([(5,5),(20,13),(5,21),(10,13),(5,5)],self.thinlineblack, self.black) super().__init__(startturtle, screencenter) From 536d32b81b00c2d8fae99d377ec7ad3f52e30776 Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Mon, 22 Apr 2019 14:58:48 -0400 Subject: [PATCH 016/149] Updated from Brython Server: 4/22/2019 2:58:48 PM --- finalproject.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/finalproject.py b/finalproject.py index f827064a..b13bed10 100644 --- a/finalproject.py +++ b/finalproject.py @@ -19,6 +19,9 @@ #Sprite(PolygonAsset([(5,5),(20,13),(5,21),(10,13),(5,5)],thinlineblack, black)) class Screen: + '''Return the singleton screen object. + If none exists at the moment, create a new one and return it, + else return the existing one''' app=None def __init__(self): Screen.app=App() @@ -54,7 +57,7 @@ def lt(self,x): #position, direction, penstate, color Screen() alex=Turtle() -alex.rt(90) +alex.lt(90) '''myapp.run() From 606be01dfe8aa8c100494c84656093e24ba8a1ab Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Mon, 22 Apr 2019 15:03:30 -0400 Subject: [PATCH 017/149] Updated from Brython Server: 4/22/2019 3:03:30 PM --- finalproject.py | 36 ++++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/finalproject.py b/finalproject.py index b13bed10..c0413a9f 100644 --- a/finalproject.py +++ b/finalproject.py @@ -41,10 +41,42 @@ def __init__(self): super().__init__(startturtle, screencenter) def right(self,x): - '''rotates turtle x degrees right''' + ''' Turn turtle right by angle units. + + Aliases: right | rt + + Argument: + angle -- a number (integer or float) + + Turn turtle right by angle units. (Units are by default degrees, + but can be set via the degrees() and radians() functions.) + Angle orientation depends on mode. (See this.) + + Example (for a Turtle instance named turtle): + >>> turtle.heading() + 22.0 + >>> turtle.right(45) + >>> turtle.heading() + 337.0''' self.rotation = self.rotation - x*pi/180 def rt(self,x): - '''rotates turtle x degrees right''' + ''' Turn turtle right by angle units. + + Aliases: right | rt + + Argument: + angle -- a number (integer or float) + + Turn turtle right by angle units. (Units are by default degrees, + but can be set via the degrees() and radians() functions.) + Angle orientation depends on mode. (See this.) + + Example (for a Turtle instance named turtle): + >>> turtle.heading() + 22.0 + >>> turtle.right(45) + >>> turtle.heading() + 337.0''' return self.right(x) def left(self,x): From d30d717d042be6f09ce34492ad0c653763f69cbf Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Mon, 22 Apr 2019 18:54:50 -0400 Subject: [PATCH 018/149] Updated from Brython Server: 4/22/2019 6:54:50 PM --- finalproject.py | 39 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/finalproject.py b/finalproject.py index c0413a9f..4d6d07c4 100644 --- a/finalproject.py +++ b/finalproject.py @@ -80,12 +80,47 @@ def rt(self,x): return self.right(x) def left(self,x): - '''rotates turtle x degrees left''' + '''Turn turtle left by angle units. + + Aliases: left | lt + + Argument: + angle -- a number (integer or float) + + Turn turtle left by angle units. (Units are by default degrees, + but can be set via the degrees() and radians() functions.) + Angle orientation depends on mode. (See this.) + + Example (for a Turtle instance named turtle): + >>> turtle.heading() + 22.0 + >>> turtle.left(45) + >>> turtle.heading() + 67.0''' self.rotation = self.rotation + x*pi/180 def lt(self,x): - '''rotates turtle x degrees left''' + '''Turn turtle left by angle units. + + Aliases: left | lt + + Argument: + angle -- a number (integer or float) + + Turn turtle left by angle units. (Units are by default degrees, + but can be set via the degrees() and radians() functions.) + Angle orientation depends on mode. (See this.) + + Example (for a Turtle instance named turtle): + >>> turtle.heading() + 22.0 + >>> turtle.left(45) + >>> turtle.heading() + 67.0''' return self.left(x) + def heading(self): + self.heading = self.rotation + #position, direction, penstate, color Screen() alex=Turtle() From 13b7dcb76a6d2344a671af626a7ac5dd5d053527 Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Tue, 23 Apr 2019 13:39:25 -0400 Subject: [PATCH 019/149] Updated from Brython Server: 4/23/2019 1:39:26 PM --- finalproject.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/finalproject.py b/finalproject.py index 4d6d07c4..6991986e 100644 --- a/finalproject.py +++ b/finalproject.py @@ -119,12 +119,13 @@ def lt(self,x): return self.left(x) def heading(self): - self.heading = self.rotation + return self.rotation * (180/pi) #position, direction, penstate, color Screen() alex=Turtle() alex.lt(90) +print(alex.heading()) '''myapp.run() From 58881c99a88e866d1692b5706694dfd7410321c4 Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Tue, 23 Apr 2019 13:46:39 -0400 Subject: [PATCH 020/149] Updated from Brython Server: 4/23/2019 1:46:40 PM --- finalproject.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/finalproject.py b/finalproject.py index 6991986e..1b2b3de9 100644 --- a/finalproject.py +++ b/finalproject.py @@ -121,6 +121,11 @@ def lt(self,x): def heading(self): return self.rotation * (180/pi) + def forward(self, x): + self.vx=1 + self.vy=1 #will depend on angle? + self.vr=0 + #position, direction, penstate, color Screen() alex=Turtle() From 114be12fc46a8bbac02535f7b889a29d382260f3 Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Tue, 23 Apr 2019 14:12:33 -0400 Subject: [PATCH 021/149] Updated from Brython Server: 4/23/2019 2:12:33 PM --- finalproject.py | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/finalproject.py b/finalproject.py index 1b2b3de9..370066a3 100644 --- a/finalproject.py +++ b/finalproject.py @@ -18,15 +18,21 @@ #Sprite(PolygonAsset([(5,5),(20,13),(5,21),(10,13),(5,5)],thinlineblack, black)) -class Screen: +class Screen(App): '''Return the singleton screen object. If none exists at the moment, create a new one and return it, else return the existing one''' app=None def __init__(self): - Screen.app=App() - Screen.app.run() - + super().__init__() + self.run() + #Screen.app=App() + #Screen.app.run() + + def step(self): + for s in self.getSpritesbyClass(Turtle): + s.step() + class Turtle(Sprite): #defining colors black = Color(0x000000, 1.0) @@ -34,12 +40,17 @@ class Turtle(Sprite): thinlinewhite = LineStyle(1, white) thinlineblack = LineStyle(1, black) def __init__(self): - width=Screen.app.width - height=Screen.app.height + width=Screen.width + height=Screen.height screencenter=(width/2,height/2) #finds a tuple for the center of the screen startturtle=PolygonAsset([(5,5),(20,13),(5,21),(10,13),(5,5)],self.thinlineblack, self.black) super().__init__(startturtle, screencenter) - + self.vr = 0.01 + + def step(self): + + self.rotation += self.vr + def right(self,x): ''' Turn turtle right by angle units. @@ -121,15 +132,18 @@ def lt(self,x): def heading(self): return self.rotation * (180/pi) - def forward(self, x): + '''def forward(self, x): self.vx=1 self.vy=1 #will depend on angle? - self.vr=0 + self.vr=0''' + + #position, direction, penstate, color Screen() alex=Turtle() alex.lt(90) +alex.lt(90) print(alex.heading()) '''myapp.run() From 4b6b2cbbcdddce8a5db5613a1f10f8ad4b4cb88e Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Tue, 23 Apr 2019 14:33:29 -0400 Subject: [PATCH 022/149] Updated from Brython Server: 4/23/2019 2:33:30 PM --- finalproject.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/finalproject.py b/finalproject.py index 370066a3..a2888ab9 100644 --- a/finalproject.py +++ b/finalproject.py @@ -45,11 +45,16 @@ def __init__(self): screencenter=(width/2,height/2) #finds a tuple for the center of the screen startturtle=PolygonAsset([(5,5),(20,13),(5,21),(10,13),(5,5)],self.thinlineblack, self.black) super().__init__(startturtle, screencenter) - self.vr = 0.01 + + self.vr = 0 + self.fxcenter = 1/3 + self.fycenter = 1/2 def step(self): - + self.rotation += self.vr + if self.rotation == self.rotationgoal: + self.vr=0 def right(self,x): ''' Turn turtle right by angle units. @@ -69,7 +74,9 @@ def right(self,x): >>> turtle.right(45) >>> turtle.heading() 337.0''' - self.rotation = self.rotation - x*pi/180 + self.rotationgoal = self.rotation - x*pi/180 + self.vr = 0.08 + def rt(self,x): ''' Turn turtle right by angle units. From f4f4088a9c27e712957f0197acd938882f9d7466 Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Tue, 23 Apr 2019 14:43:04 -0400 Subject: [PATCH 023/149] Updated from Brython Server: 4/23/2019 2:43:04 PM --- finalproject.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/finalproject.py b/finalproject.py index a2888ab9..a965d673 100644 --- a/finalproject.py +++ b/finalproject.py @@ -45,16 +45,20 @@ def __init__(self): screencenter=(width/2,height/2) #finds a tuple for the center of the screen startturtle=PolygonAsset([(5,5),(20,13),(5,21),(10,13),(5,5)],self.thinlineblack, self.black) super().__init__(startturtle, screencenter) + self.rotationgoal=None self.vr = 0 self.fxcenter = 1/3 self.fycenter = 1/2 def step(self): - - self.rotation += self.vr - if self.rotation == self.rotationgoal: - self.vr=0 + print(not self.rotationgoal is None) + if not self.rotationgoal is None: + print("hi") + self.rotation += self.vr + if self.rotation == self.rotationgoal: + self.vr=0 + self.rotationgoal=None def right(self,x): ''' Turn turtle right by angle units. @@ -149,8 +153,8 @@ def heading(self): #position, direction, penstate, color Screen() alex=Turtle() -alex.lt(90) -alex.lt(90) +alex.right(90) + print(alex.heading()) '''myapp.run() From cc9b68cef0afcea0f9ff2c3ae36a992f4296c8a4 Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Tue, 23 Apr 2019 14:53:12 -0400 Subject: [PATCH 024/149] Updated from Brython Server: 4/23/2019 2:53:13 PM --- finalproject.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/finalproject.py b/finalproject.py index a965d673..b223afa5 100644 --- a/finalproject.py +++ b/finalproject.py @@ -52,10 +52,15 @@ def __init__(self): self.fycenter = 1/2 def step(self): - print(not self.rotationgoal is None) if not self.rotationgoal is None: - print("hi") - self.rotation += self.vr + + if self.rotationgoal-self.rotation < 0: + self.rotation += self.vr + if self.rotation <= self.rotationgoal: + self.vr=0 + self.rotation=self.rotationgoal + self.rotationgoal=None + if self.rotation == self.rotationgoal: self.vr=0 self.rotationgoal=None @@ -79,7 +84,7 @@ def right(self,x): >>> turtle.heading() 337.0''' self.rotationgoal = self.rotation - x*pi/180 - self.vr = 0.08 + self.vr = -0.08 def rt(self,x): ''' Turn turtle right by angle units. From 8dad4d6824f21d16560f1ab2756d600456426fb7 Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Tue, 23 Apr 2019 14:53:31 -0400 Subject: [PATCH 025/149] Updated from Brython Server: 4/23/2019 2:53:31 PM --- finalproject.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/finalproject.py b/finalproject.py index b223afa5..77fd9d21 100644 --- a/finalproject.py +++ b/finalproject.py @@ -84,7 +84,7 @@ def right(self,x): >>> turtle.heading() 337.0''' self.rotationgoal = self.rotation - x*pi/180 - self.vr = -0.08 + self.vr = -0.05 def rt(self,x): ''' Turn turtle right by angle units. From 8f97f6247c414db533fdf1c30c6703fd48043862 Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Tue, 23 Apr 2019 14:55:47 -0400 Subject: [PATCH 026/149] Updated from Brython Server: 4/23/2019 2:55:48 PM --- finalproject.py | 1 + 1 file changed, 1 insertion(+) diff --git a/finalproject.py b/finalproject.py index 77fd9d21..bfe1a7dd 100644 --- a/finalproject.py +++ b/finalproject.py @@ -159,6 +159,7 @@ def heading(self): Screen() alex=Turtle() alex.right(90) +alex.right(300) print(alex.heading()) From a4433665d76a7c59b81733fa90d8f3bc63512f40 Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Tue, 23 Apr 2019 14:59:35 -0400 Subject: [PATCH 027/149] Updated from Brython Server: 4/23/2019 2:59:35 PM --- finalproject.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/finalproject.py b/finalproject.py index bfe1a7dd..412fc9ec 100644 --- a/finalproject.py +++ b/finalproject.py @@ -50,6 +50,8 @@ def __init__(self): self.vr = 0 self.fxcenter = 1/3 self.fycenter = 1/2 + + self.commandlist=[] def step(self): if not self.rotationgoal is None: @@ -85,7 +87,7 @@ def right(self,x): 337.0''' self.rotationgoal = self.rotation - x*pi/180 self.vr = -0.05 - + self.commandlist.append((right,x)) def rt(self,x): ''' Turn turtle right by angle units. From 50b6ebf8834376cf0aafe7367d4f1ab2b0ea18d9 Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Tue, 23 Apr 2019 15:02:27 -0400 Subject: [PATCH 028/149] Updated from Brython Server: 4/23/2019 3:02:27 PM --- finalproject.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/finalproject.py b/finalproject.py index 412fc9ec..3b085623 100644 --- a/finalproject.py +++ b/finalproject.py @@ -87,7 +87,8 @@ def right(self,x): 337.0''' self.rotationgoal = self.rotation - x*pi/180 self.vr = -0.05 - self.commandlist.append((right,x)) + self.commandlist.append(("right",x)) + def rt(self,x): ''' Turn turtle right by angle units. @@ -160,8 +161,7 @@ def heading(self): #position, direction, penstate, color Screen() alex=Turtle() -alex.right(90) -alex.right(300) +alex.rt(90) print(alex.heading()) From 6d5c3907ea44737790d6cc30d0ad7cfa4cba202b Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Tue, 23 Apr 2019 15:07:52 -0400 Subject: [PATCH 029/149] Updated from Brython Server: 4/23/2019 3:07:52 PM --- finalproject.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/finalproject.py b/finalproject.py index 3b085623..60077a29 100644 --- a/finalproject.py +++ b/finalproject.py @@ -53,6 +53,8 @@ def __init__(self): self.commandlist=[] + self.combinedhead=0 + def step(self): if not self.rotationgoal is None: @@ -89,6 +91,8 @@ def right(self,x): self.vr = -0.05 self.commandlist.append(("right",x)) + self.combinedhead += x + def rt(self,x): ''' Turn turtle right by angle units. @@ -149,7 +153,7 @@ def lt(self,x): return self.left(x) def heading(self): - return self.rotation * (180/pi) + return self.combinedhead '''def forward(self, x): self.vx=1 From 8d303234ff56f82641b9334cd237d96f06cb0564 Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Tue, 23 Apr 2019 15:10:16 -0400 Subject: [PATCH 030/149] Updated from Brython Server: 4/23/2019 3:10:16 PM --- finalproject.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/finalproject.py b/finalproject.py index 60077a29..0bf6000e 100644 --- a/finalproject.py +++ b/finalproject.py @@ -91,7 +91,7 @@ def right(self,x): self.vr = -0.05 self.commandlist.append(("right",x)) - self.combinedhead += x + self.combinedhead -= x def rt(self,x): ''' Turn turtle right by angle units. From db22f45c8d1fffb3a87119d3d53e23c20fa557a1 Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Mon, 29 Apr 2019 14:16:47 -0400 Subject: [PATCH 031/149] Updated from Brython Server: 4/29/2019 2:16:48 PM --- finalproject.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/finalproject.py b/finalproject.py index 0bf6000e..6d41e040 100644 --- a/finalproject.py +++ b/finalproject.py @@ -92,6 +92,8 @@ def right(self,x): self.commandlist.append(("right",x)) self.combinedhead -= x + if self.combinedhead <0: + self.combinedhead=self.combinedhead%360+360 def rt(self,x): ''' Turn turtle right by angle units. From 2fd69eb4fb314424b10242fa12ddaa33769530fd Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Mon, 29 Apr 2019 14:19:29 -0400 Subject: [PATCH 032/149] Updated from Brython Server: 4/29/2019 2:19:29 PM --- finalproject.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/finalproject.py b/finalproject.py index 6d41e040..a22baeb7 100644 --- a/finalproject.py +++ b/finalproject.py @@ -92,8 +92,10 @@ def right(self,x): self.commandlist.append(("right",x)) self.combinedhead -= x - if self.combinedhead <0: - self.combinedhead=self.combinedhead%360+360 + if self.combinedhead < 0: + self.combinedhead=-(-self.combinedhead%360)+360 + if self.combinedhead > 0: + self.combinedhead=self.combinedhead%360 def rt(self,x): ''' Turn turtle right by angle units. @@ -167,7 +169,7 @@ def heading(self): #position, direction, penstate, color Screen() alex=Turtle() -alex.rt(90) +alex.rt(720) print(alex.heading()) From 4cc82a620debd9242da281444c2d3ba150a36e6e Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Mon, 29 Apr 2019 14:21:41 -0400 Subject: [PATCH 033/149] Updated from Brython Server: 4/29/2019 2:21:42 PM --- finalproject.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/finalproject.py b/finalproject.py index a22baeb7..56ba3908 100644 --- a/finalproject.py +++ b/finalproject.py @@ -135,7 +135,10 @@ def left(self,x): >>> turtle.left(45) >>> turtle.heading() 67.0''' - self.rotation = self.rotation + x*pi/180 + self.rotationgoal = self.rotation + x*pi/180 + self.vr = 0.05 + self.commandlist.append(("left",x)) + def lt(self,x): '''Turn turtle left by angle units. @@ -155,6 +158,7 @@ def lt(self,x): >>> turtle.heading() 67.0''' return self.left(x) + def heading(self): return self.combinedhead From fcdf8a9e136d54d3015c0b448ca9277a0d85125b Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Mon, 29 Apr 2019 14:28:47 -0400 Subject: [PATCH 034/149] Updated from Brython Server: 4/29/2019 2:28:48 PM --- finalproject.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/finalproject.py b/finalproject.py index 56ba3908..46c085f9 100644 --- a/finalproject.py +++ b/finalproject.py @@ -64,7 +64,14 @@ def step(self): self.vr=0 self.rotation=self.rotationgoal self.rotationgoal=None - + + if self.rotationgoal-self.rotation > 0: + self.rotation += self.vr + if self.rotation >= self.rotationgoal: + self.vr=0 + self.rotation=self.rotationgoal + self.rotationgoal=None + if self.rotation == self.rotationgoal: self.vr=0 self.rotationgoal=None @@ -173,7 +180,7 @@ def heading(self): #position, direction, penstate, color Screen() alex=Turtle() -alex.rt(720) +alex.lt(720) print(alex.heading()) From 127d939f3a475cae9c2b0150e3c3705a43fbb25a Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Mon, 29 Apr 2019 14:31:11 -0400 Subject: [PATCH 035/149] Updated from Brython Server: 4/29/2019 2:31:12 PM --- finalproject.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/finalproject.py b/finalproject.py index 46c085f9..c2db0ddb 100644 --- a/finalproject.py +++ b/finalproject.py @@ -146,6 +146,12 @@ def left(self,x): self.vr = 0.05 self.commandlist.append(("left",x)) + self.combinedhead += x + if self.combinedhead < 0: + self.combinedhead=-(-self.combinedhead%360)+360 + if self.combinedhead > 0: + self.combinedhead=self.combinedhead%360 + def lt(self,x): '''Turn turtle left by angle units. From 9842ff1f1c6b1427b6b99593e340316317dd46a6 Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Mon, 29 Apr 2019 14:31:59 -0400 Subject: [PATCH 036/149] Updated from Brython Server: 4/29/2019 2:32:00 PM --- finalproject.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/finalproject.py b/finalproject.py index c2db0ddb..5c9bba0f 100644 --- a/finalproject.py +++ b/finalproject.py @@ -186,7 +186,7 @@ def heading(self): #position, direction, penstate, color Screen() alex=Turtle() -alex.lt(720) +alex.lt(650) print(alex.heading()) From 3e4b689525927b9ba23b7b6fae73a3549185bb60 Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Mon, 29 Apr 2019 14:44:12 -0400 Subject: [PATCH 037/149] Updated from Brython Server: 4/29/2019 2:44:10 PM --- finalproject.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/finalproject.py b/finalproject.py index 5c9bba0f..053ffdda 100644 --- a/finalproject.py +++ b/finalproject.py @@ -56,16 +56,17 @@ def __init__(self): self.combinedhead=0 def step(self): + if not self.rotationgoal is None: - if self.rotationgoal-self.rotation < 0: + if self.rotationgoal-self.rotation < 0: #right turn self.rotation += self.vr if self.rotation <= self.rotationgoal: self.vr=0 self.rotation=self.rotationgoal self.rotationgoal=None - if self.rotationgoal-self.rotation > 0: + if self.rotationgoal-self.rotation > 0: #left turn self.rotation += self.vr if self.rotation >= self.rotationgoal: self.vr=0 @@ -187,7 +188,7 @@ def heading(self): Screen() alex=Turtle() alex.lt(650) - +print(alex.commandlist) print(alex.heading()) '''myapp.run() From 5fbc6a42465874b281bf8c1f700d782d89be167b Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Mon, 29 Apr 2019 14:47:10 -0400 Subject: [PATCH 038/149] Updated from Brython Server: 4/29/2019 2:47:11 PM --- finalproject.py | 1 + 1 file changed, 1 insertion(+) diff --git a/finalproject.py b/finalproject.py index 053ffdda..a5e38e9a 100644 --- a/finalproject.py +++ b/finalproject.py @@ -57,6 +57,7 @@ def __init__(self): def step(self): + if not self.rotationgoal is None: if self.rotationgoal-self.rotation < 0: #right turn From 58bb0c68715a1d05c8ae7e2399da869979fafd83 Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Mon, 29 Apr 2019 14:49:07 -0400 Subject: [PATCH 039/149] Updated from Brython Server: 4/29/2019 2:49:08 PM --- finalproject.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/finalproject.py b/finalproject.py index a5e38e9a..f1eac22b 100644 --- a/finalproject.py +++ b/finalproject.py @@ -56,7 +56,8 @@ def __init__(self): self.combinedhead=0 def step(self): - + self.commandlist.reverse() + command = self.commandlist.pop() if not self.rotationgoal is None: From 878cd4b4216864c5696b7a3a70af13d849ba8aa0 Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Wed, 1 May 2019 13:43:13 -0400 Subject: [PATCH 040/149] Updated from Brython Server: 5/1/2019 1:43:10 PM --- finalproject.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/finalproject.py b/finalproject.py index f1eac22b..ba77e684 100644 --- a/finalproject.py +++ b/finalproject.py @@ -51,13 +51,19 @@ def __init__(self): self.fxcenter = 1/3 self.fycenter = 1/2 - self.commandlist=[] + self.commandlist = [] + self.currentcmd = None self.combinedhead=0 def step(self): - self.commandlist.reverse() - command = self.commandlist.pop() + + if self.currentcmd: + #continue doing that thing + elif self.commandlist: + self.currentcmd = self.commandlist.pop(0) + + if not self.rotationgoal is None: @@ -192,7 +198,7 @@ def heading(self): alex.lt(650) print(alex.commandlist) print(alex.heading()) - +print(command) '''myapp.run() From 5f588d18f1c9fb9244845b30c2e0fbea4b67c9d8 Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Fri, 3 May 2019 14:17:05 -0400 Subject: [PATCH 041/149] Updated from Brython Server: 5/3/2019 2:17:01 PM --- finalproject.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/finalproject.py b/finalproject.py index ba77e684..8dc5c076 100644 --- a/finalproject.py +++ b/finalproject.py @@ -59,9 +59,10 @@ def __init__(self): def step(self): if self.currentcmd: - #continue doing that thing + if self.currentcmd = ("right", elif self.commandlist: self.currentcmd = self.commandlist.pop(0) + print(self.currentcmd) From 9c27a897390fdad63b48b697121145e9b1ff6f32 Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Fri, 3 May 2019 14:32:43 -0400 Subject: [PATCH 042/149] Updated from Brython Server: 5/3/2019 2:32:41 PM --- finalproject.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/finalproject.py b/finalproject.py index 8dc5c076..cc441719 100644 --- a/finalproject.py +++ b/finalproject.py @@ -59,7 +59,7 @@ def __init__(self): def step(self): if self.currentcmd: - if self.currentcmd = ("right", + pass#keep doing elif self.commandlist: self.currentcmd = self.commandlist.pop(0) print(self.currentcmd) @@ -199,7 +199,7 @@ def heading(self): alex.lt(650) print(alex.commandlist) print(alex.heading()) -print(command) + '''myapp.run() From e615663e3177a99c123902665589b4cbb49a5efa Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Fri, 3 May 2019 14:39:19 -0400 Subject: [PATCH 043/149] Updated from Brython Server: 5/3/2019 2:39:17 PM --- finalproject.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/finalproject.py b/finalproject.py index cc441719..fa636bd8 100644 --- a/finalproject.py +++ b/finalproject.py @@ -59,7 +59,14 @@ def __init__(self): def step(self): if self.currentcmd: - pass#keep doing + for (i,j) in self.currentcmd: + if i=="right": + self.rotationgoal = self.rotation - j*pi/180 + self.vr = -0.05 + if i=="left": + self.rotationgoal = self.rotation + j*pi/180 + self.vr = 0.05 + elif self.commandlist: self.currentcmd = self.commandlist.pop(0) print(self.currentcmd) @@ -104,8 +111,7 @@ def right(self,x): >>> turtle.right(45) >>> turtle.heading() 337.0''' - self.rotationgoal = self.rotation - x*pi/180 - self.vr = -0.05 + self.commandlist.append(("right",x)) self.combinedhead -= x @@ -152,8 +158,7 @@ def left(self,x): >>> turtle.left(45) >>> turtle.heading() 67.0''' - self.rotationgoal = self.rotation + x*pi/180 - self.vr = 0.05 + self.commandlist.append(("left",x)) self.combinedhead += x From f7123d1446622215d679965b19974c8756ab3654 Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Fri, 3 May 2019 14:39:54 -0400 Subject: [PATCH 044/149] Updated from Brython Server: 5/3/2019 2:39:52 PM --- finalproject.py | 1 + 1 file changed, 1 insertion(+) diff --git a/finalproject.py b/finalproject.py index fa636bd8..cadf90ae 100644 --- a/finalproject.py +++ b/finalproject.py @@ -202,6 +202,7 @@ def heading(self): Screen() alex=Turtle() alex.lt(650) +alex.right(90) print(alex.commandlist) print(alex.heading()) From 957d30790a7a0fa00dadb8f83eb3f1d2afa90718 Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Fri, 3 May 2019 14:43:10 -0400 Subject: [PATCH 045/149] Updated from Brython Server: 5/3/2019 2:43:08 PM --- finalproject.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/finalproject.py b/finalproject.py index cadf90ae..48574e60 100644 --- a/finalproject.py +++ b/finalproject.py @@ -59,7 +59,8 @@ def __init__(self): def step(self): if self.currentcmd: - for (i,j) in self.currentcmd: + print(self.currentcmd) + for i,j in self.currentcmd: if i=="right": self.rotationgoal = self.rotation - j*pi/180 self.vr = -0.05 @@ -69,7 +70,7 @@ def step(self): elif self.commandlist: self.currentcmd = self.commandlist.pop(0) - print(self.currentcmd) + From dfcdf20d7898315426eaa09d7b8452779ebc08e8 Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Fri, 3 May 2019 14:49:20 -0400 Subject: [PATCH 046/149] Updated from Brython Server: 5/3/2019 2:49:19 PM --- finalproject.py | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/finalproject.py b/finalproject.py index 48574e60..f2ab9e62 100644 --- a/finalproject.py +++ b/finalproject.py @@ -60,23 +60,19 @@ def step(self): if self.currentcmd: print(self.currentcmd) - for i,j in self.currentcmd: - if i=="right": - self.rotationgoal = self.rotation - j*pi/180 - self.vr = -0.05 - if i=="left": - self.rotationgoal = self.rotation + j*pi/180 - self.vr = 0.05 + cmd,val = self.currentcmd + if cmd=="right": + self.rotationgoal = self.rotation - val*pi/180 + self.vr = -0.05 + if cmd=="left": + self.rotationgoal = self.rotation + val*pi/180 + self.vr = 0.05 + if not self.rotationgoal is None: elif self.commandlist: self.currentcmd = self.commandlist.pop(0) - - - - - if not self.rotationgoal is None: - if self.rotationgoal-self.rotation < 0: #right turn + if self.rotationgoal-self.rotation < 0: #right turn self.rotation += self.vr if self.rotation <= self.rotationgoal: self.vr=0 @@ -93,6 +89,10 @@ def step(self): if self.rotation == self.rotationgoal: self.vr=0 self.rotationgoal=None + + + + def right(self,x): ''' Turn turtle right by angle units. From 8f3e071fe6c4cbda6930ea1ba36a2c283bd5f1a1 Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Fri, 3 May 2019 14:51:48 -0400 Subject: [PATCH 047/149] Updated from Brython Server: 5/3/2019 2:51:46 PM --- finalproject.py | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/finalproject.py b/finalproject.py index f2ab9e62..92d10ee5 100644 --- a/finalproject.py +++ b/finalproject.py @@ -67,28 +67,29 @@ def step(self): if cmd=="left": self.rotationgoal = self.rotation + val*pi/180 self.vr = 0.05 - if not self.rotationgoal is None: + elif self.commandlist: self.currentcmd = self.commandlist.pop(0) - if self.rotationgoal-self.rotation < 0: #right turn - self.rotation += self.vr - if self.rotation <= self.rotationgoal: + if not self.rotationgoal is None: + if self.rotationgoal-self.rotation < 0: #right turn + self.rotation += self.vr + if self.rotation <= self.rotationgoal: + self.vr=0 + self.rotation=self.rotationgoal + self.rotationgoal=None + + if self.rotationgoal-self.rotation > 0: #left turn + self.rotation += self.vr + if self.rotation >= self.rotationgoal: + self.vr=0 + self.rotation=self.rotationgoal + self.rotationgoal=None + + if self.rotation == self.rotationgoal: self.vr=0 - self.rotation=self.rotationgoal self.rotationgoal=None - - if self.rotationgoal-self.rotation > 0: #left turn - self.rotation += self.vr - if self.rotation >= self.rotationgoal: - self.vr=0 - self.rotation=self.rotationgoal - self.rotationgoal=None - - if self.rotation == self.rotationgoal: - self.vr=0 - self.rotationgoal=None From b28e8750a1dd3f43f88585f386f87166b1a7a6b3 Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Fri, 3 May 2019 14:53:24 -0400 Subject: [PATCH 048/149] Updated from Brython Server: 5/3/2019 2:53:22 PM --- finalproject.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/finalproject.py b/finalproject.py index 92d10ee5..2ccacaec 100644 --- a/finalproject.py +++ b/finalproject.py @@ -80,16 +80,16 @@ def step(self): self.rotation=self.rotationgoal self.rotationgoal=None - if self.rotationgoal-self.rotation > 0: #left turn - self.rotation += self.vr - if self.rotation >= self.rotationgoal: - self.vr=0 - self.rotation=self.rotationgoal - self.rotationgoal=None - - if self.rotation == self.rotationgoal: + if self.rotationgoal-self.rotation > 0: #left turn + self.rotation += self.vr + if self.rotation >= self.rotationgoal: self.vr=0 + self.rotation=self.rotationgoal self.rotationgoal=None + + if self.rotation == self.rotationgoal: + self.vr=0 + self.rotationgoal=None From 8b1a3bfe60477b000159b0dc0e99d1feb0e4f0d0 Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Fri, 3 May 2019 14:59:52 -0400 Subject: [PATCH 049/149] Updated from Brython Server: 5/3/2019 2:59:50 PM --- finalproject.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/finalproject.py b/finalproject.py index 2ccacaec..7bca3a5f 100644 --- a/finalproject.py +++ b/finalproject.py @@ -62,15 +62,18 @@ def step(self): print(self.currentcmd) cmd,val = self.currentcmd if cmd=="right": - self.rotationgoal = self.rotation - val*pi/180 self.vr = -0.05 if cmd=="left": - self.rotationgoal = self.rotation + val*pi/180 self.vr = 0.05 elif self.commandlist: self.currentcmd = self.commandlist.pop(0) + cmd,val = self.currentcmd + if cmd=="right": + self.rotationgoal = self.rotation - val*pi/180 + if cmd=="left": + self.rotationgoal = self.rotation + val*pi/180 if not self.rotationgoal is None: if self.rotationgoal-self.rotation < 0: #right turn From 7e58aefb888d64f33f6ceee9dcdaba98bec931f3 Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Fri, 3 May 2019 15:01:51 -0400 Subject: [PATCH 050/149] Updated from Brython Server: 5/3/2019 3:01:49 PM --- finalproject.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/finalproject.py b/finalproject.py index 7bca3a5f..9a92f201 100644 --- a/finalproject.py +++ b/finalproject.py @@ -62,10 +62,13 @@ def step(self): print(self.currentcmd) cmd,val = self.currentcmd if cmd=="right": - self.vr = -0.05 + self.vr = -0.05 + if self.rotationgoal=None + self.currentcmd=None if cmd=="left": self.vr = 0.05 - + if self.rotationgoal=None + self.currentcmd=None elif self.commandlist: self.currentcmd = self.commandlist.pop(0) From e569a7435222e8094f98e310ba1e8eb46f4830ec Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Fri, 3 May 2019 15:02:20 -0400 Subject: [PATCH 051/149] Updated from Brython Server: 5/3/2019 3:02:19 PM --- finalproject.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/finalproject.py b/finalproject.py index 9a92f201..7730e731 100644 --- a/finalproject.py +++ b/finalproject.py @@ -63,12 +63,12 @@ def step(self): cmd,val = self.currentcmd if cmd=="right": self.vr = -0.05 - if self.rotationgoal=None - self.currentcmd=None + if self.rotationgoal==None: + self.currentcmd=None if cmd=="left": self.vr = 0.05 - if self.rotationgoal=None - self.currentcmd=None + if self.rotationgoal==None: + self.currentcmd=None elif self.commandlist: self.currentcmd = self.commandlist.pop(0) From 2b7295667db1d535818bbdce6b6fb34d5f818931 Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Fri, 3 May 2019 15:02:39 -0400 Subject: [PATCH 052/149] Updated from Brython Server: 5/3/2019 3:02:37 PM From e6b409c4aa2686cdb2b0e32287c3526521005a45 Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Fri, 3 May 2019 15:02:59 -0400 Subject: [PATCH 053/149] Updated from Brython Server: 5/3/2019 3:02:58 PM --- finalproject.py | 1 - 1 file changed, 1 deletion(-) diff --git a/finalproject.py b/finalproject.py index 7730e731..3b25b98f 100644 --- a/finalproject.py +++ b/finalproject.py @@ -59,7 +59,6 @@ def __init__(self): def step(self): if self.currentcmd: - print(self.currentcmd) cmd,val = self.currentcmd if cmd=="right": self.vr = -0.05 From 4808a9dbc44132938b6fdf80f4a08c845939a594 Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Fri, 3 May 2019 15:04:01 -0400 Subject: [PATCH 054/149] Updated from Brython Server: 5/3/2019 3:03:59 PM From de03c16b3de4aa5dc8aca31ced6cf797466d9aed Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Fri, 3 May 2019 16:50:09 -0400 Subject: [PATCH 055/149] Updated from Brython Server: 5/3/2019 4:50:08 PM --- finalproject.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/finalproject.py b/finalproject.py index 3b25b98f..32e8b1f0 100644 --- a/finalproject.py +++ b/finalproject.py @@ -208,8 +208,9 @@ def heading(self): #position, direction, penstate, color Screen() alex=Turtle() -alex.lt(650) -alex.right(90) +alex.lt(350) +alex.rt(30) +alex.left(100) print(alex.commandlist) print(alex.heading()) From 2ab7ea3b8b7a83d000c102bc66653ceb2997e252 Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Fri, 3 May 2019 16:56:14 -0400 Subject: [PATCH 056/149] Updated from Brython Server: 5/3/2019 4:56:14 PM --- finalproject.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/finalproject.py b/finalproject.py index 32e8b1f0..de63650b 100644 --- a/finalproject.py +++ b/finalproject.py @@ -72,6 +72,7 @@ def step(self): elif self.commandlist: self.currentcmd = self.commandlist.pop(0) cmd,val = self.currentcmd + print(self.currentcmd) if cmd=="right": self.rotationgoal = self.rotation - val*pi/180 if cmd=="left": @@ -208,9 +209,7 @@ def heading(self): #position, direction, penstate, color Screen() alex=Turtle() -alex.lt(350) -alex.rt(30) -alex.left(100) +alex.rt(100) print(alex.commandlist) print(alex.heading()) From 827d9744f3df91db28968767c462c58ecef85fd4 Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Mon, 6 May 2019 14:06:46 -0400 Subject: [PATCH 057/149] Updated from Brython Server: 5/6/2019 2:06:46 PM --- finalproject.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/finalproject.py b/finalproject.py index de63650b..b7d32800 100644 --- a/finalproject.py +++ b/finalproject.py @@ -80,11 +80,11 @@ def step(self): if not self.rotationgoal is None: if self.rotationgoal-self.rotation < 0: #right turn - self.rotation += self.vr - if self.rotation <= self.rotationgoal: - self.vr=0 - self.rotation=self.rotationgoal - self.rotationgoal=None + self.rotation += self.vr + if self.rotation <= self.rotationgoal: + self.vr=0 + self.rotation=self.rotationgoal + self.rotationgoal=None if self.rotationgoal-self.rotation > 0: #left turn self.rotation += self.vr @@ -209,7 +209,9 @@ def heading(self): #position, direction, penstate, color Screen() alex=Turtle() -alex.rt(100) +alex.lt(100) +alex.lt(100) +alex.lt(10) print(alex.commandlist) print(alex.heading()) From 9b83436f9e762ffd9d7c3bf01d4eb696039b4879 Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Mon, 6 May 2019 14:14:07 -0400 Subject: [PATCH 058/149] Updated from Brython Server: 5/6/2019 2:14:07 PM --- finalproject.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/finalproject.py b/finalproject.py index b7d32800..b3e8c58f 100644 --- a/finalproject.py +++ b/finalproject.py @@ -75,10 +75,12 @@ def step(self): print(self.currentcmd) if cmd=="right": self.rotationgoal = self.rotation - val*pi/180 + if cmd=="left": self.rotationgoal = self.rotation + val*pi/180 if not self.rotationgoal is None: + if self.rotationgoal-self.rotation < 0: #right turn self.rotation += self.vr if self.rotation <= self.rotationgoal: @@ -86,7 +88,7 @@ def step(self): self.rotation=self.rotationgoal self.rotationgoal=None - if self.rotationgoal-self.rotation > 0: #left turn + elif self.rotationgoal-self.rotation > 0: #left turn self.rotation += self.vr if self.rotation >= self.rotationgoal: self.vr=0 @@ -211,7 +213,8 @@ def heading(self): alex=Turtle() alex.lt(100) alex.lt(100) -alex.lt(10) +alex.rt(10) +alex.rt(100) print(alex.commandlist) print(alex.heading()) From 550e7f5a8775590649f6ca2d396e7ed7c1533881 Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Mon, 6 May 2019 14:14:48 -0400 Subject: [PATCH 059/149] Updated from Brython Server: 5/6/2019 2:14:48 PM From 4bc944198d367ccbc4f985363f2599f37ceff0b9 Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Mon, 6 May 2019 14:24:29 -0400 Subject: [PATCH 060/149] Updated from Brython Server: 5/6/2019 2:24:28 PM --- finalproject.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/finalproject.py b/finalproject.py index b3e8c58f..47bfb89d 100644 --- a/finalproject.py +++ b/finalproject.py @@ -72,7 +72,7 @@ def step(self): elif self.commandlist: self.currentcmd = self.commandlist.pop(0) cmd,val = self.currentcmd - print(self.currentcmd) + if cmd=="right": self.rotationgoal = self.rotation - val*pi/180 @@ -201,10 +201,10 @@ def lt(self,x): def heading(self): return self.combinedhead - '''def forward(self, x): - self.vx=1 - self.vy=1 #will depend on angle? - self.vr=0''' + def forward(self): + pass + + @@ -215,8 +215,7 @@ def heading(self): alex.lt(100) alex.rt(10) alex.rt(100) -print(alex.commandlist) -print(alex.heading()) + '''myapp.run() From eee7fc10be0a4d3d714303f1f1e38200309ff44b Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Mon, 6 May 2019 14:26:24 -0400 Subject: [PATCH 061/149] Updated from Brython Server: 5/6/2019 2:26:24 PM --- finalproject.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/finalproject.py b/finalproject.py index 47bfb89d..88e559db 100644 --- a/finalproject.py +++ b/finalproject.py @@ -201,10 +201,20 @@ def lt(self,x): def heading(self): return self.combinedhead - def forward(self): + def forward(self,x): pass + + def fd(self,x): + return self.forward(x) + + def backward(self,x): + pass + + def bk(self,x): + return self.backward(x) - + def back(self,x): + return self.backward(x) From df9400b77adcdd926edd556a1dcb0bcbb47edabf Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Mon, 6 May 2019 14:30:11 -0400 Subject: [PATCH 062/149] Updated from Brython Server: 5/6/2019 2:30:11 PM --- finalproject.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/finalproject.py b/finalproject.py index 88e559db..8bab0e3d 100644 --- a/finalproject.py +++ b/finalproject.py @@ -202,13 +202,13 @@ def heading(self): return self.combinedhead def forward(self,x): - pass + self.commandlist.append(("forward",x)) def fd(self,x): return self.forward(x) def backward(self,x): - pass + self.commandlist.append(("backward",x)) def bk(self,x): return self.backward(x) @@ -226,7 +226,7 @@ def back(self,x): alex.rt(10) alex.rt(100) - +print(self.commandlist) '''myapp.run() From 842ee1f252757be9f32f3852a9360f2c5a583203 Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Mon, 6 May 2019 14:30:41 -0400 Subject: [PATCH 063/149] Updated from Brython Server: 5/6/2019 2:30:41 PM --- finalproject.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/finalproject.py b/finalproject.py index 8bab0e3d..8df93c89 100644 --- a/finalproject.py +++ b/finalproject.py @@ -225,8 +225,8 @@ def back(self,x): alex.lt(100) alex.rt(10) alex.rt(100) - -print(self.commandlist) +alex.fd(2) +print(alex.commandlist) '''myapp.run() From ae60bba050ed7f7c857cdb621296556b378abb50 Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Mon, 6 May 2019 17:29:27 -0400 Subject: [PATCH 064/149] Updated from Brython Server: 5/6/2019 5:29:25 PM From f8240af40781db45a1d737325c88095f614251b4 Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Mon, 13 May 2019 14:32:27 -0400 Subject: [PATCH 065/149] Updated from Brython Server: 5/13/2019 2:32:27 PM --- finalproject.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/finalproject.py b/finalproject.py index 8df93c89..addf70f9 100644 --- a/finalproject.py +++ b/finalproject.py @@ -48,7 +48,7 @@ def __init__(self): self.rotationgoal=None self.vr = 0 - self.fxcenter = 1/3 + self.fxcenter = 1 self.fycenter = 1/2 self.commandlist = [] @@ -221,10 +221,10 @@ def back(self,x): #position, direction, penstate, color Screen() alex=Turtle() -alex.lt(100) -alex.lt(100) +alex.lt(300) +#alex.lt(100) alex.rt(10) -alex.rt(100) +#alex.rt(100) alex.fd(2) print(alex.commandlist) '''myapp.run() From 222d4a638683cea4304c620ce765a817eda99441 Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Mon, 13 May 2019 14:38:34 -0400 Subject: [PATCH 066/149] Updated from Brython Server: 5/13/2019 2:38:34 PM --- finalproject.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/finalproject.py b/finalproject.py index addf70f9..aef0f081 100644 --- a/finalproject.py +++ b/finalproject.py @@ -61,11 +61,11 @@ def step(self): if self.currentcmd: cmd,val = self.currentcmd if cmd=="right": - self.vr = -0.05 + self.vr = -0.06 if self.rotationgoal==None: self.currentcmd=None if cmd=="left": - self.vr = 0.05 + self.vr = 0.06 if self.rotationgoal==None: self.currentcmd=None From f7cb7d9b329bfb4c591d03f74e0ab1eaf44e5a1b Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Mon, 13 May 2019 14:40:35 -0400 Subject: [PATCH 067/149] Updated from Brython Server: 5/13/2019 2:40:35 PM --- finalproject.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/finalproject.py b/finalproject.py index aef0f081..ab9ae988 100644 --- a/finalproject.py +++ b/finalproject.py @@ -46,6 +46,7 @@ def __init__(self): startturtle=PolygonAsset([(5,5),(20,13),(5,21),(10,13),(5,5)],self.thinlineblack, self.black) super().__init__(startturtle, screencenter) self.rotationgoal=None + self.forwardgoal=None self.vr = 0 self.fxcenter = 1 @@ -78,6 +79,9 @@ def step(self): if cmd=="left": self.rotationgoal = self.rotation + val*pi/180 + + if cmd=="forward": + self.forwardgoal = val if not self.rotationgoal is None: From 0d9bdeffee6a2a7b36e415709d597d876fa9a07b Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Mon, 13 May 2019 14:43:45 -0400 Subject: [PATCH 068/149] Updated from Brython Server: 5/13/2019 2:43:45 PM --- finalproject.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/finalproject.py b/finalproject.py index ab9ae988..a5ba7ae3 100644 --- a/finalproject.py +++ b/finalproject.py @@ -51,6 +51,9 @@ def __init__(self): self.vr = 0 self.fxcenter = 1 self.fycenter = 1/2 + + self.vx = 0 + self.vy = 0 self.commandlist = [] self.currentcmd = None @@ -65,10 +68,15 @@ def step(self): self.vr = -0.06 if self.rotationgoal==None: self.currentcmd=None + if cmd=="left": self.vr = 0.06 if self.rotationgoal==None: self.currentcmd=None + + if cmd=="forward": + self + elif self.commandlist: self.currentcmd = self.commandlist.pop(0) From 8c92907af76a0009d22f1de19374016295d4478d Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Tue, 14 May 2019 13:36:50 -0400 Subject: [PATCH 069/149] Updated from Brython Server: 5/14/2019 1:36:49 PM From dad1583aa3172ce1fab7ea05a6afd558d134ecc2 Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Tue, 14 May 2019 13:47:31 -0400 Subject: [PATCH 070/149] Updated from Brython Server: 5/14/2019 1:47:31 PM --- finalproject.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/finalproject.py b/finalproject.py index a5ba7ae3..4d22cbf5 100644 --- a/finalproject.py +++ b/finalproject.py @@ -75,7 +75,7 @@ def step(self): self.currentcmd=None if cmd=="forward": - self + self.forwardgoal = val elif self.commandlist: @@ -94,18 +94,22 @@ def step(self): if not self.rotationgoal is None: if self.rotationgoal-self.rotation < 0: #right turn - self.rotation += self.vr - if self.rotation <= self.rotationgoal: + if self.rotation + self.vr <= self.rotationgoal: self.vr=0 self.rotation=self.rotationgoal self.rotationgoal=None + else: + self.rotation += self.vr + + elif self.rotationgoal-self.rotation > 0: #left turn - self.rotation += self.vr - if self.rotation >= self.rotationgoal: + if self.rotation + self.vr >= self.rotationgoal: self.vr=0 self.rotation=self.rotationgoal self.rotationgoal=None + else: + self.rotation += self.vr if self.rotation == self.rotationgoal: self.vr=0 @@ -233,9 +237,9 @@ def back(self,x): #position, direction, penstate, color Screen() alex=Turtle() -alex.lt(300) +alex.lt(90) #alex.lt(100) -alex.rt(10) +#alex.rt(10) #alex.rt(100) alex.fd(2) print(alex.commandlist) From f0465dfac7cfb0cb3a48ec557631621a405ecdd6 Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Tue, 14 May 2019 13:47:55 -0400 Subject: [PATCH 071/149] Updated from Brython Server: 5/14/2019 1:47:54 PM From 42b403110f8dfc83f20dd8db6fddd491fc0cac84 Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Tue, 14 May 2019 13:52:31 -0400 Subject: [PATCH 072/149] Updated from Brython Server: 5/14/2019 1:52:30 PM --- finalproject.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/finalproject.py b/finalproject.py index 4d22cbf5..aa2daedd 100644 --- a/finalproject.py +++ b/finalproject.py @@ -4,7 +4,7 @@ ''' from ggame import App, RectangleAsset, ImageAsset, Sprite, LineStyle, Color, Frame, PolygonAsset, EllipseAsset, CircleAsset -from math import pi +import math #myapp = App() #defining colors @@ -76,6 +76,8 @@ def step(self): if cmd=="forward": self.forwardgoal = val + self.vx=cos(self.rotation) + self.vy=sin(self.rotation) elif self.commandlist: @@ -101,7 +103,6 @@ def step(self): else: self.rotation += self.vr - elif self.rotationgoal-self.rotation > 0: #left turn if self.rotation + self.vr >= self.rotationgoal: From 83d410517402cd19655a381f4c5cf4b8d48565b1 Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Tue, 14 May 2019 13:57:22 -0400 Subject: [PATCH 073/149] Updated from Brython Server: 5/14/2019 1:57:22 PM --- finalproject.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/finalproject.py b/finalproject.py index aa2daedd..17378caf 100644 --- a/finalproject.py +++ b/finalproject.py @@ -4,7 +4,7 @@ ''' from ggame import App, RectangleAsset, ImageAsset, Sprite, LineStyle, Color, Frame, PolygonAsset, EllipseAsset, CircleAsset -import math +from math import pi, cos, sin #myapp = App() #defining colors @@ -93,7 +93,7 @@ def step(self): if cmd=="forward": self.forwardgoal = val - if not self.rotationgoal is None: + if not self.rotationgoal is None: #TURNS if self.rotationgoal-self.rotation < 0: #right turn if self.rotation + self.vr <= self.rotationgoal: @@ -115,7 +115,11 @@ def step(self): if self.rotation == self.rotationgoal: self.vr=0 self.rotationgoal=None + + if not self.forwardgoal is None: + self.x += self.vx + self.y += self.vy From 8041beda371681ab29ca1b39f9b53c8fe7d5aba3 Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Tue, 14 May 2019 14:22:41 -0400 Subject: [PATCH 074/149] Updated from Brython Server: 5/14/2019 2:22:40 PM --- finalproject.py | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/finalproject.py b/finalproject.py index 17378caf..51615706 100644 --- a/finalproject.py +++ b/finalproject.py @@ -4,7 +4,7 @@ ''' from ggame import App, RectangleAsset, ImageAsset, Sprite, LineStyle, Color, Frame, PolygonAsset, EllipseAsset, CircleAsset -from math import pi, cos, sin +from math import pi, cos, sin, #myapp = App() #defining colors @@ -58,6 +58,8 @@ def __init__(self): self.commandlist = [] self.currentcmd = None + self.distance = 0 + self.combinedhead=0 def step(self): @@ -95,16 +97,16 @@ def step(self): if not self.rotationgoal is None: #TURNS - if self.rotationgoal-self.rotation < 0: #right turn + if self.rotationgoal - self.rotation < 0: #right turn if self.rotation + self.vr <= self.rotationgoal: - self.vr=0 + self.vr = 0 self.rotation=self.rotationgoal self.rotationgoal=None else: self.rotation += self.vr - elif self.rotationgoal-self.rotation > 0: #left turn + elif self.rotationgoal - self.rotation > 0: #left turn if self.rotation + self.vr >= self.rotationgoal: self.vr=0 self.rotation=self.rotationgoal @@ -113,14 +115,23 @@ def step(self): self.rotation += self.vr if self.rotation == self.rotationgoal: - self.vr=0 + self.vr = 0 self.rotationgoal=None if not self.forwardgoal is None: - self.x += self.vx - self.y += self.vy - + if self.forwardgoal - self.distance > 0: + if self.distance + (self.vx**2+self.vy**2)**1/2 >= self.forwardgoal: + self.vx = 0 + self.vy = 0 + self.x = + self.y = + else: + self.x -= self.vx + self.y -= self.vy + self.distance = (self.x**2+self.y**2)**1/2 + + @@ -246,7 +257,7 @@ def back(self,x): #alex.lt(100) #alex.rt(10) #alex.rt(100) -alex.fd(2) +alex.fd(100) print(alex.commandlist) '''myapp.run() From 49a6b63a8a2192ba9f38ce7a441f4018d6786ee9 Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Tue, 14 May 2019 14:24:26 -0400 Subject: [PATCH 075/149] Updated from Brython Server: 5/14/2019 2:24:26 PM --- finalproject.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/finalproject.py b/finalproject.py index 51615706..a6578411 100644 --- a/finalproject.py +++ b/finalproject.py @@ -124,8 +124,8 @@ def step(self): if self.distance + (self.vx**2+self.vy**2)**1/2 >= self.forwardgoal: self.vx = 0 self.vy = 0 - self.x = - self.y = + self.x = (self.forwardgoal - self.distance)*cos(self.rotation) + self.y = (self.forwardgoal - self.distance)*sin(self.rotation) else: self.x -= self.vx self.y -= self.vy From 45c183bca7d01d58a03f96680aa858e4e2790896 Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Tue, 14 May 2019 14:26:43 -0400 Subject: [PATCH 076/149] Updated from Brython Server: 5/14/2019 2:26:42 PM --- finalproject.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/finalproject.py b/finalproject.py index a6578411..9423a631 100644 --- a/finalproject.py +++ b/finalproject.py @@ -4,7 +4,7 @@ ''' from ggame import App, RectangleAsset, ImageAsset, Sprite, LineStyle, Color, Frame, PolygonAsset, EllipseAsset, CircleAsset -from math import pi, cos, sin, +from math import pi, cos, sin #myapp = App() #defining colors @@ -80,6 +80,7 @@ def step(self): self.forwardgoal = val self.vx=cos(self.rotation) self.vy=sin(self.rotation) + elif self.commandlist: @@ -118,7 +119,7 @@ def step(self): self.vr = 0 self.rotationgoal=None - if not self.forwardgoal is None: + if not self.forwardgoal is None: #forward if self.forwardgoal - self.distance > 0: if self.distance + (self.vx**2+self.vy**2)**1/2 >= self.forwardgoal: @@ -126,11 +127,16 @@ def step(self): self.vy = 0 self.x = (self.forwardgoal - self.distance)*cos(self.rotation) self.y = (self.forwardgoal - self.distance)*sin(self.rotation) + self.distance = (self.x**2+self.y**2)**1/2 else: self.x -= self.vx self.y -= self.vy self.distance = (self.x**2+self.y**2)**1/2 + if self.distance==self.forwardgoal: + self.vx = 0 + self.vy = 0 + self.forwardgoal=None From 389bbcd26381b5435a1478de3a9d3af932dcf7fe Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Tue, 14 May 2019 14:32:25 -0400 Subject: [PATCH 077/149] Updated from Brython Server: 5/14/2019 2:32:24 PM --- finalproject.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/finalproject.py b/finalproject.py index 9423a631..91e06e6d 100644 --- a/finalproject.py +++ b/finalproject.py @@ -79,7 +79,10 @@ def step(self): if cmd=="forward": self.forwardgoal = val self.vx=cos(self.rotation) + print(self.vx) self.vy=sin(self.rotation) + if self.forwardgoal==None: + self.currentcmd=None @@ -120,7 +123,7 @@ def step(self): self.rotationgoal=None if not self.forwardgoal is None: #forward - + if self.forwardgoal - self.distance > 0: if self.distance + (self.vx**2+self.vy**2)**1/2 >= self.forwardgoal: self.vx = 0 From 29ca3cd6d09c0f9e60730aebd2db24a847aaf520 Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Tue, 14 May 2019 14:33:47 -0400 Subject: [PATCH 078/149] Updated from Brython Server: 5/14/2019 2:33:47 PM --- finalproject.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/finalproject.py b/finalproject.py index 91e06e6d..d8692ff3 100644 --- a/finalproject.py +++ b/finalproject.py @@ -79,7 +79,6 @@ def step(self): if cmd=="forward": self.forwardgoal = val self.vx=cos(self.rotation) - print(self.vx) self.vy=sin(self.rotation) if self.forwardgoal==None: self.currentcmd=None @@ -126,12 +125,14 @@ def step(self): if self.forwardgoal - self.distance > 0: if self.distance + (self.vx**2+self.vy**2)**1/2 >= self.forwardgoal: + print("whoops") self.vx = 0 self.vy = 0 self.x = (self.forwardgoal - self.distance)*cos(self.rotation) self.y = (self.forwardgoal - self.distance)*sin(self.rotation) self.distance = (self.x**2+self.y**2)**1/2 else: + print("hellllooo") self.x -= self.vx self.y -= self.vy self.distance = (self.x**2+self.y**2)**1/2 From 56d8b7e76e9ba61bb6f34add337041ff3182237f Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Tue, 14 May 2019 14:37:45 -0400 Subject: [PATCH 079/149] Updated from Brython Server: 5/14/2019 2:37:44 PM --- finalproject.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/finalproject.py b/finalproject.py index d8692ff3..2270fa0b 100644 --- a/finalproject.py +++ b/finalproject.py @@ -122,8 +122,9 @@ def step(self): self.rotationgoal=None if not self.forwardgoal is None: #forward - + if self.forwardgoal - self.distance > 0: + print("hi") if self.distance + (self.vx**2+self.vy**2)**1/2 >= self.forwardgoal: print("whoops") self.vx = 0 @@ -135,7 +136,8 @@ def step(self): print("hellllooo") self.x -= self.vx self.y -= self.vy - self.distance = (self.x**2+self.y**2)**1/2 + self.distance = ((self.x)**2+(self.y)**2)**(1/2) + print(self.distance) if self.distance==self.forwardgoal: self.vx = 0 @@ -267,7 +269,7 @@ def back(self,x): #alex.lt(100) #alex.rt(10) #alex.rt(100) -alex.fd(100) +alex.fd(1000) print(alex.commandlist) '''myapp.run() From e351eb79b85ec519c01ce931f3c720e9bc4779fe Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Tue, 14 May 2019 14:38:32 -0400 Subject: [PATCH 080/149] Updated from Brython Server: 5/14/2019 2:38:32 PM --- finalproject.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/finalproject.py b/finalproject.py index 2270fa0b..b31ca7b1 100644 --- a/finalproject.py +++ b/finalproject.py @@ -136,7 +136,7 @@ def step(self): print("hellllooo") self.x -= self.vx self.y -= self.vy - self.distance = ((self.x)**2+(self.y)**2)**(1/2) + self.distance = ((self.x-(width/2))**2+(self.y-(height/2))**2)**(1/2) print(self.distance) if self.distance==self.forwardgoal: From a547f01530bb82143fd226bbc72d7894881286c8 Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Tue, 14 May 2019 14:39:28 -0400 Subject: [PATCH 081/149] Updated from Brython Server: 5/14/2019 2:39:28 PM --- finalproject.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/finalproject.py b/finalproject.py index b31ca7b1..3cd794c3 100644 --- a/finalproject.py +++ b/finalproject.py @@ -124,19 +124,17 @@ def step(self): if not self.forwardgoal is None: #forward if self.forwardgoal - self.distance > 0: - print("hi") + if self.distance + (self.vx**2+self.vy**2)**1/2 >= self.forwardgoal: - print("whoops") self.vx = 0 self.vy = 0 self.x = (self.forwardgoal - self.distance)*cos(self.rotation) self.y = (self.forwardgoal - self.distance)*sin(self.rotation) self.distance = (self.x**2+self.y**2)**1/2 else: - print("hellllooo") self.x -= self.vx self.y -= self.vy - self.distance = ((self.x-(width/2))**2+(self.y-(height/2))**2)**(1/2) + self.distance = ((self.x-(self.width/2))**2+(self.y-(self.height/2))**2)**(1/2) print(self.distance) if self.distance==self.forwardgoal: From 18a59c64cc02d785458a5b8449b855ac21301355 Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Tue, 14 May 2019 14:44:35 -0400 Subject: [PATCH 082/149] Updated from Brython Server: 5/14/2019 2:44:35 PM --- finalproject.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/finalproject.py b/finalproject.py index 3cd794c3..4abf2ff4 100644 --- a/finalproject.py +++ b/finalproject.py @@ -134,7 +134,7 @@ def step(self): else: self.x -= self.vx self.y -= self.vy - self.distance = ((self.x-(self.width/2))**2+(self.y-(self.height/2))**2)**(1/2) + self.distance = ((self.x-(Screen.width/2))**2+(self.y-(Screen.height/2))**2)**(1/2) print(self.distance) if self.distance==self.forwardgoal: @@ -267,7 +267,7 @@ def back(self,x): #alex.lt(100) #alex.rt(10) #alex.rt(100) -alex.fd(1000) +alex.fd(100) print(alex.commandlist) '''myapp.run() From 7f8618f54f49c21d21b93ea66cf6f0a520beba1f Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Tue, 14 May 2019 14:47:01 -0400 Subject: [PATCH 083/149] Updated from Brython Server: 5/14/2019 2:47:00 PM --- finalproject.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/finalproject.py b/finalproject.py index 4abf2ff4..0effc414 100644 --- a/finalproject.py +++ b/finalproject.py @@ -78,7 +78,7 @@ def step(self): if cmd=="forward": self.forwardgoal = val - self.vx=cos(self.rotation) + self.vx=-1*cos(self.rotation) self.vy=sin(self.rotation) if self.forwardgoal==None: self.currentcmd=None @@ -135,7 +135,7 @@ def step(self): self.x -= self.vx self.y -= self.vy self.distance = ((self.x-(Screen.width/2))**2+(self.y-(Screen.height/2))**2)**(1/2) - print(self.distance) + if self.distance==self.forwardgoal: self.vx = 0 @@ -263,7 +263,7 @@ def back(self,x): #position, direction, penstate, color Screen() alex=Turtle() -alex.lt(90) +alex.lt(120) #alex.lt(100) #alex.rt(10) #alex.rt(100) From eca776f738e9fbb0d07c55b87597311ed140a0f4 Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Tue, 14 May 2019 14:52:26 -0400 Subject: [PATCH 084/149] Updated from Brython Server: 5/14/2019 2:52:26 PM --- finalproject.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/finalproject.py b/finalproject.py index 0effc414..efeeef23 100644 --- a/finalproject.py +++ b/finalproject.py @@ -3,7 +3,7 @@ https://docs.python.org/3.3/library/turtle.html?highlight=turtle ''' -from ggame import App, RectangleAsset, ImageAsset, Sprite, LineStyle, Color, Frame, PolygonAsset, EllipseAsset, CircleAsset +from ggame import App, RectangleAsset, ImageAsset, Sprite, LineStyle, Color, Frame, PolygonAsset, EllipseAsset, CircleAsset, LineSegment from math import pi, cos, sin #myapp = App() @@ -134,6 +134,7 @@ def step(self): else: self.x -= self.vx self.y -= self.vy + line = LineSegment((self.x,self.y), (self.x - self.vx, self.y - self.vy), positioning = "physical") self.distance = ((self.x-(Screen.width/2))**2+(self.y-(Screen.height/2))**2)**(1/2) From cb4bc984ec2217b2237c0dac8ddb10d85a4bf73b Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Tue, 14 May 2019 14:53:09 -0400 Subject: [PATCH 085/149] Updated from Brython Server: 5/14/2019 2:53:09 PM --- finalproject.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/finalproject.py b/finalproject.py index efeeef23..df959012 100644 --- a/finalproject.py +++ b/finalproject.py @@ -3,7 +3,8 @@ https://docs.python.org/3.3/library/turtle.html?highlight=turtle ''' -from ggame import App, RectangleAsset, ImageAsset, Sprite, LineStyle, Color, Frame, PolygonAsset, EllipseAsset, CircleAsset, LineSegment +from ggame import App, RectangleAsset, ImageAsset, Sprite, LineStyle, Color, Frame, PolygonAsset, EllipseAsset, CircleAsset +from ggame.line import LineSegment from math import pi, cos, sin #myapp = App() From 59b2ba189b964a095303cea60669ce21c9e4fe5e Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Tue, 14 May 2019 14:55:42 -0400 Subject: [PATCH 086/149] Updated from Brython Server: 5/14/2019 2:55:36 PM From edbc731fe5c1f0566ed62a6aca4abaee94ba2b76 Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Tue, 14 May 2019 14:56:56 -0400 Subject: [PATCH 087/149] Updated from Brython Server: 5/14/2019 2:56:55 PM From dfe8b35997928310d5204b2abdde375eb4b90e2a Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Tue, 14 May 2019 14:58:40 -0400 Subject: [PATCH 088/149] Updated from Brython Server: 5/14/2019 2:58:39 PM --- finalproject.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/finalproject.py b/finalproject.py index df959012..3ade68d0 100644 --- a/finalproject.py +++ b/finalproject.py @@ -266,10 +266,12 @@ def back(self,x): Screen() alex=Turtle() alex.lt(120) -#alex.lt(100) +alex.lt(100) + +alex.fd(100) #alex.rt(10) #alex.rt(100) -alex.fd(100) +#alex.fd(40) print(alex.commandlist) '''myapp.run() From d98994f213c99f9bb454b9153c9cf6075c540829 Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Tue, 14 May 2019 14:58:50 -0400 Subject: [PATCH 089/149] Updated from Brython Server: 5/14/2019 2:58:49 PM From b6c63db97e684eca5916e49c0e67847173b2ed0f Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Tue, 14 May 2019 15:04:13 -0400 Subject: [PATCH 090/149] Updated from Brython Server: 5/14/2019 3:04:12 PM --- finalproject.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/finalproject.py b/finalproject.py index 3ade68d0..fe310bd7 100644 --- a/finalproject.py +++ b/finalproject.py @@ -265,8 +265,7 @@ def back(self,x): #position, direction, penstate, color Screen() alex=Turtle() -alex.lt(120) -alex.lt(100) +alex.lt(130) alex.fd(100) #alex.rt(10) From 91c6e7c49574591d3f28627acd3a2c529e2adb0b Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Tue, 14 May 2019 15:04:17 -0400 Subject: [PATCH 091/149] Updated from Brython Server: 5/14/2019 3:04:16 PM From c2cfcfe9c7e4a79d0ec699ea31a99b5a836405f4 Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Mon, 20 May 2019 14:10:13 -0400 Subject: [PATCH 092/149] Updated from Brython Server: 5/20/2019 2:10:13 PM --- finalproject.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/finalproject.py b/finalproject.py index fe310bd7..64bcbb0f 100644 --- a/finalproject.py +++ b/finalproject.py @@ -129,8 +129,10 @@ def step(self): if self.distance + (self.vx**2+self.vy**2)**1/2 >= self.forwardgoal: self.vx = 0 self.vy = 0 - self.x = (self.forwardgoal - self.distance)*cos(self.rotation) - self.y = (self.forwardgoal - self.distance)*sin(self.rotation) + + self.x = (self.forwardgoal - self.distance)*cos(self.rotation)+self.x + self.y = (self.forwardgoal - self.distance)*sin(self.rotation)+self.y + self.distance = (self.x**2+self.y**2)**1/2 else: self.x -= self.vx @@ -265,7 +267,7 @@ def back(self,x): #position, direction, penstate, color Screen() alex=Turtle() -alex.lt(130) +alex.rt(220) alex.fd(100) #alex.rt(10) From be0a39f9c4046461c32e4a77004679ca2a6853a4 Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Mon, 20 May 2019 14:12:11 -0400 Subject: [PATCH 093/149] Updated from Brython Server: 5/20/2019 2:12:10 PM --- finalproject.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/finalproject.py b/finalproject.py index 64bcbb0f..55d9cfde 100644 --- a/finalproject.py +++ b/finalproject.py @@ -270,6 +270,8 @@ def back(self,x): alex.rt(220) alex.fd(100) +alex.lt(200) +alex.fd(70) #alex.rt(10) #alex.rt(100) #alex.fd(40) From ce3e67c7a7f7db888ff6aae3322234b4a3bdb4f5 Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Mon, 20 May 2019 14:21:21 -0400 Subject: [PATCH 094/149] Updated from Brython Server: 5/20/2019 2:21:21 PM --- finalproject.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/finalproject.py b/finalproject.py index 55d9cfde..b84a45ea 100644 --- a/finalproject.py +++ b/finalproject.py @@ -66,6 +66,7 @@ def __init__(self): def step(self): if self.currentcmd: + print(self.currentcmd) cmd,val = self.currentcmd if cmd=="right": self.vr = -0.06 @@ -82,14 +83,16 @@ def step(self): self.vx=-1*cos(self.rotation) self.vy=sin(self.rotation) if self.forwardgoal==None: + self.currentcmd=None - + print(self.currentcmd) elif self.commandlist: self.currentcmd = self.commandlist.pop(0) cmd,val = self.currentcmd - + print(self.commandlist) + print(self.currentcmd) if cmd=="right": self.rotationgoal = self.rotation - val*pi/180 @@ -134,6 +137,8 @@ def step(self): self.y = (self.forwardgoal - self.distance)*sin(self.rotation)+self.y self.distance = (self.x**2+self.y**2)**1/2 + self.forwardgoal=None + print(self.forwardgoal) else: self.x -= self.vx self.y -= self.vy @@ -145,7 +150,7 @@ def step(self): self.vx = 0 self.vy = 0 self.forwardgoal=None - + From cb60243700669fd973d408fc23281c33120285a2 Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Mon, 20 May 2019 14:28:22 -0400 Subject: [PATCH 095/149] Updated from Brython Server: 5/20/2019 2:28:22 PM --- finalproject.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/finalproject.py b/finalproject.py index b84a45ea..5d794c91 100644 --- a/finalproject.py +++ b/finalproject.py @@ -66,7 +66,7 @@ def __init__(self): def step(self): if self.currentcmd: - print(self.currentcmd) + cmd,val = self.currentcmd if cmd=="right": self.vr = -0.06 @@ -79,6 +79,7 @@ def step(self): self.currentcmd=None if cmd=="forward": + print(self.forwardgoal) self.forwardgoal = val self.vx=-1*cos(self.rotation) self.vy=sin(self.rotation) @@ -91,8 +92,7 @@ def step(self): elif self.commandlist: self.currentcmd = self.commandlist.pop(0) cmd,val = self.currentcmd - print(self.commandlist) - print(self.currentcmd) + if cmd=="right": self.rotationgoal = self.rotation - val*pi/180 @@ -138,7 +138,7 @@ def step(self): self.distance = (self.x**2+self.y**2)**1/2 self.forwardgoal=None - print(self.forwardgoal) + else: self.x -= self.vx self.y -= self.vy From d3658d13982ff0be62a880ce6e558520c29be899 Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Mon, 20 May 2019 14:37:29 -0400 Subject: [PATCH 096/149] Updated from Brython Server: 5/20/2019 2:37:29 PM --- finalproject.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/finalproject.py b/finalproject.py index 5d794c91..f8d5ecd5 100644 --- a/finalproject.py +++ b/finalproject.py @@ -79,14 +79,12 @@ def step(self): self.currentcmd=None if cmd=="forward": - print(self.forwardgoal) self.forwardgoal = val self.vx=-1*cos(self.rotation) self.vy=sin(self.rotation) if self.forwardgoal==None: - self.currentcmd=None - print(self.currentcmd) + elif self.commandlist: @@ -109,6 +107,7 @@ def step(self): self.vr = 0 self.rotation=self.rotationgoal self.rotationgoal=None + self.currentcmd=None else: self.rotation += self.vr @@ -118,12 +117,14 @@ def step(self): self.vr=0 self.rotation=self.rotationgoal self.rotationgoal=None + self.currentcmd=None else: self.rotation += self.vr if self.rotation == self.rotationgoal: self.vr = 0 self.rotationgoal=None + self.currentcmd=None if not self.forwardgoal is None: #forward @@ -137,8 +138,9 @@ def step(self): self.y = (self.forwardgoal - self.distance)*sin(self.rotation)+self.y self.distance = (self.x**2+self.y**2)**1/2 + self.forwardgoal=None - + self.currentcmd=None else: self.x -= self.vx self.y -= self.vy @@ -150,7 +152,7 @@ def step(self): self.vx = 0 self.vy = 0 self.forwardgoal=None - + self.currentcmd=None From 6c45b005b719ab83b7ecf8d2f248ed3da9b2608c Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Wed, 22 May 2019 13:39:10 -0400 Subject: [PATCH 097/149] Updated from Brython Server: 5/22/2019 1:39:10 PM --- finalproject.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/finalproject.py b/finalproject.py index f8d5ecd5..97936e3b 100644 --- a/finalproject.py +++ b/finalproject.py @@ -274,14 +274,13 @@ def back(self,x): #position, direction, penstate, color Screen() alex=Turtle() -alex.rt(220) +alex.fd(45) + +alex.fd(45) + + + -alex.fd(100) -alex.lt(200) -alex.fd(70) -#alex.rt(10) -#alex.rt(100) -#alex.fd(40) print(alex.commandlist) '''myapp.run() From 6da9ef410d2f506905cc854369931ea3bbb5a856 Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Wed, 22 May 2019 14:05:49 -0400 Subject: [PATCH 098/149] Updated from Brython Server: 5/22/2019 2:05:49 PM --- finalproject.py | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/finalproject.py b/finalproject.py index 97936e3b..55870e25 100644 --- a/finalproject.py +++ b/finalproject.py @@ -79,7 +79,7 @@ def step(self): self.currentcmd=None if cmd=="forward": - self.forwardgoal = val + #self.forwardgoal = val self.vx=-1*cos(self.rotation) self.vy=sin(self.rotation) if self.forwardgoal==None: @@ -98,7 +98,7 @@ def step(self): self.rotationgoal = self.rotation + val*pi/180 if cmd=="forward": - self.forwardgoal = val + self.forwardgoal = val + ((self.x-(Screen.width/2))**2+(self.y-(Screen.height/2))**2)**(1/2) if not self.rotationgoal is None: #TURNS @@ -134,11 +134,11 @@ def step(self): self.vx = 0 self.vy = 0 - self.x = (self.forwardgoal - self.distance)*cos(self.rotation)+self.x - self.y = (self.forwardgoal - self.distance)*sin(self.rotation)+self.y - - self.distance = (self.x**2+self.y**2)**1/2 - + self.x = (self.forwardgoal - self.distance)*cos(self.rotation) + self.x + self.y = (self.forwardgoal - self.distance)*sin(self.rotation) + self.y + + self.distance = 0 + #(self.x**2+self.y**2)**1/2 self.forwardgoal=None self.currentcmd=None else: @@ -153,6 +153,8 @@ def step(self): self.vy = 0 self.forwardgoal=None self.currentcmd=None + print(self.x, self.y) + print(((self.x-(Screen.width/2))**2+(self.y-(Screen.height/2))**2)**(1/2)) @@ -274,10 +276,11 @@ def back(self,x): #position, direction, penstate, color Screen() alex=Turtle() -alex.fd(45) - -alex.fd(45) - +alex.fd(100) +alex.lt(60) +alex.fd(100) +alex.lt(60) +alex.fd(100) From ee59a5a37789977ae68ffa906e42f210fe8c1f7e Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Wed, 22 May 2019 14:07:06 -0400 Subject: [PATCH 099/149] Updated from Brython Server: 5/22/2019 2:07:06 PM --- finalproject.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/finalproject.py b/finalproject.py index 55870e25..76a7ec89 100644 --- a/finalproject.py +++ b/finalproject.py @@ -281,6 +281,12 @@ def back(self,x): alex.fd(100) alex.lt(60) alex.fd(100) +alex.lt(60) +alex.fd(100) +alex.lt(60) +alex.fd(100) +alex.lt(60) +alex.fd(100) From 3994ae2bfcd70f27dbe7c783a32ba6679d900ff5 Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Tue, 28 May 2019 14:56:31 -0400 Subject: [PATCH 100/149] Updated from Brython Server: 5/28/2019 2:56:31 PM --- finalproject.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/finalproject.py b/finalproject.py index 76a7ec89..50b94a36 100644 --- a/finalproject.py +++ b/finalproject.py @@ -5,7 +5,7 @@ from ggame import App, RectangleAsset, ImageAsset, Sprite, LineStyle, Color, Frame, PolygonAsset, EllipseAsset, CircleAsset from ggame.line import LineSegment -from math import pi, cos, sin +from math import pi, cos, sin, sqrt #myapp = App() #defining colors @@ -61,7 +61,8 @@ def __init__(self): self.distance = 0 - self.combinedhead=0 + self.combinedhead = 0 + def step(self): @@ -98,8 +99,11 @@ def step(self): self.rotationgoal = self.rotation + val*pi/180 if cmd=="forward": - self.forwardgoal = val + ((self.x-(Screen.width/2))**2+(self.y-(Screen.height/2))**2)**(1/2) - + + num = ((self.x-(Screen.width/2))**2+(self.y-(Screen.height/2))**2)**(1/2) + self.forwardgoal = sqrt(num**2+val**2-2*num*val*cos(pi-self.rotation)) + + print(self.forwardgoal) if not self.rotationgoal is None: #TURNS if self.rotationgoal - self.rotation < 0: #right turn @@ -276,7 +280,7 @@ def back(self,x): #position, direction, penstate, color Screen() alex=Turtle() -alex.fd(100) +alex.fd(90) alex.lt(60) alex.fd(100) alex.lt(60) From 955d65f11d9f9e58f58a945ba468bdd0db3f8005 Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Wed, 29 May 2019 13:30:22 -0400 Subject: [PATCH 101/149] Updated from Brython Server: 5/29/2019 1:30:20 PM --- finalproject.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/finalproject.py b/finalproject.py index 50b94a36..0390b83a 100644 --- a/finalproject.py +++ b/finalproject.py @@ -63,6 +63,9 @@ def __init__(self): self.combinedhead = 0 + self.fdx = width/2 + self.fdy = height/2 + def step(self): @@ -100,10 +103,11 @@ def step(self): if cmd=="forward": - num = ((self.x-(Screen.width/2))**2+(self.y-(Screen.height/2))**2)**(1/2) - self.forwardgoal = sqrt(num**2+val**2-2*num*val*cos(pi-self.rotation)) + self.forwardgoal = val + #sqrt(num**2+val**2-2*num*val*cos(pi-self.rotation)) print(self.forwardgoal) + if not self.rotationgoal is None: #TURNS if self.rotationgoal - self.rotation < 0: #right turn @@ -149,7 +153,7 @@ def step(self): self.x -= self.vx self.y -= self.vy line = LineSegment((self.x,self.y), (self.x - self.vx, self.y - self.vy), positioning = "physical") - self.distance = ((self.x-(Screen.width/2))**2+(self.y-(Screen.height/2))**2)**(1/2) + self.distance = ((self.x-self.fdx)**2+(self.y-self.fdy)**2)**(1/2) if self.distance==self.forwardgoal: @@ -157,6 +161,8 @@ def step(self): self.vy = 0 self.forwardgoal=None self.currentcmd=None + self.fdx = self.x + self.fdy = self.y print(self.x, self.y) print(((self.x-(Screen.width/2))**2+(self.y-(Screen.height/2))**2)**(1/2)) From 524e9dd636f9e7b4b9fa84e4800c04564e7c5491 Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Wed, 29 May 2019 13:39:22 -0400 Subject: [PATCH 102/149] Updated from Brython Server: 5/29/2019 1:39:21 PM --- finalproject.py | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/finalproject.py b/finalproject.py index 0390b83a..07517b1e 100644 --- a/finalproject.py +++ b/finalproject.py @@ -104,7 +104,6 @@ def step(self): if cmd=="forward": self.forwardgoal = val - #sqrt(num**2+val**2-2*num*val*cos(pi-self.rotation)) print(self.forwardgoal) @@ -156,7 +155,7 @@ def step(self): self.distance = ((self.x-self.fdx)**2+(self.y-self.fdy)**2)**(1/2) - if self.distance==self.forwardgoal: + else: self.vx = 0 self.vy = 0 self.forwardgoal=None @@ -286,17 +285,17 @@ def back(self,x): #position, direction, penstate, color Screen() alex=Turtle() -alex.fd(90) -alex.lt(60) -alex.fd(100) -alex.lt(60) -alex.fd(100) -alex.lt(60) -alex.fd(100) -alex.lt(60) alex.fd(100) -alex.lt(60) +#alex.lt(60) +alex.fd(0) +#alex.lt(60) alex.fd(100) +#alex.lt(60) +#alex.fd(100) +#alex.lt(60) +#alex.fd(100) +#alex.lt(60) +#alex.fd(100) From 18239fcb5b4feef2bff593a1e2f9d395cadca24b Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Wed, 29 May 2019 13:41:11 -0400 Subject: [PATCH 103/149] Updated from Brython Server: 5/29/2019 1:41:10 PM --- finalproject.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/finalproject.py b/finalproject.py index 07517b1e..5d78bf07 100644 --- a/finalproject.py +++ b/finalproject.py @@ -104,7 +104,7 @@ def step(self): if cmd=="forward": self.forwardgoal = val - #sqrt(num**2+val**2-2*num*val*cos(pi-self.rotation)) + print(self.forwardgoal) if not self.rotationgoal is None: #TURNS @@ -145,7 +145,7 @@ def step(self): self.y = (self.forwardgoal - self.distance)*sin(self.rotation) + self.y self.distance = 0 - #(self.x**2+self.y**2)**1/2 + self.forwardgoal=None self.currentcmd=None else: @@ -162,9 +162,8 @@ def step(self): self.currentcmd=None self.fdx = self.x self.fdy = self.y - print(self.x, self.y) - print(((self.x-(Screen.width/2))**2+(self.y-(Screen.height/2))**2)**(1/2)) - + print(self.fdx) + print(self.fdy) def right(self,x): From f1fee378760e5de36eab7994a0e743eaecd8dfb7 Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Wed, 29 May 2019 13:46:19 -0400 Subject: [PATCH 104/149] Updated from Brython Server: 5/29/2019 1:46:18 PM --- finalproject.py | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/finalproject.py b/finalproject.py index 5d78bf07..3c870218 100644 --- a/finalproject.py +++ b/finalproject.py @@ -105,7 +105,7 @@ def step(self): self.forwardgoal = val - print(self.forwardgoal) + if not self.rotationgoal is None: #TURNS @@ -158,12 +158,14 @@ def step(self): else: self.vx = 0 self.vy = 0 - self.forwardgoal=None - self.currentcmd=None + self.forwardgoal = None + self.currentcmd = None self.fdx = self.x self.fdy = self.y - print(self.fdx) - print(self.fdy) + self.distance = 0 + + #print(self.fdx) + #print(self.fdy) def right(self,x): @@ -285,16 +287,16 @@ def back(self,x): Screen() alex=Turtle() alex.fd(100) -#alex.lt(60) -alex.fd(0) -#alex.lt(60) +alex.lt(60) +alex.fd(100) +alex.lt(60) +alex.fd(100) +alex.lt(60) +alex.fd(100) +alex.lt(60) +alex.fd(100) +alex.lt(60) alex.fd(100) -#alex.lt(60) -#alex.fd(100) -#alex.lt(60) -#alex.fd(100) -#alex.lt(60) -#alex.fd(100) From 3ed94be2f4342edd1c9322c3682db101045f0075 Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Wed, 29 May 2019 14:03:12 -0400 Subject: [PATCH 105/149] Updated from Brython Server: 5/29/2019 2:03:10 PM --- finalproject.py | 64 ++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 53 insertions(+), 11 deletions(-) diff --git a/finalproject.py b/finalproject.py index 3c870218..e396a769 100644 --- a/finalproject.py +++ b/finalproject.py @@ -46,8 +46,9 @@ def __init__(self): screencenter=(width/2,height/2) #finds a tuple for the center of the screen startturtle=PolygonAsset([(5,5),(20,13),(5,21),(10,13),(5,5)],self.thinlineblack, self.black) super().__init__(startturtle, screencenter) - self.rotationgoal=None - self.forwardgoal=None + self.rotationgoal = None + self.forwardgoal = None + self.bkgoal = None self.vr = 0 self.fxcenter = 1 @@ -83,13 +84,16 @@ def step(self): self.currentcmd=None if cmd=="forward": - #self.forwardgoal = val self.vx=-1*cos(self.rotation) self.vy=sin(self.rotation) if self.forwardgoal==None: self.currentcmd=None - + if cmd=="backward": + self.vx=-cos(self.rotation) + self.vy=sin(self.rotation) + if self.bkgoal==None: + self.currentcmd=None elif self.commandlist: self.currentcmd = self.commandlist.pop(0) @@ -102,10 +106,10 @@ def step(self): self.rotationgoal = self.rotation + val*pi/180 if cmd=="forward": - self.forwardgoal = val - + if cmd=="backward": + self.bkgoal = val if not self.rotationgoal is None: #TURNS @@ -164,8 +168,36 @@ def step(self): self.fdy = self.y self.distance = 0 - #print(self.fdx) - #print(self.fdy) + if not self.bkgoal is None: #backward + + if self.bkgoal - self.distance > 0: + + if self.distance + (self.vx**2+self.vy**2)**1/2 >= self.bkgoal: + self.vx = 0 + self.vy = 0 + + self.x = (self.bkgoal - self.distance)*cos(self.rotation) + self.x + self.y = (self.bkgoal - self.distance)*sin(self.rotation) + self.y + + self.distance = 0 + + self.bkgoal=None + self.currentcmd=None + else: + self.x += self.vx + self.y += self.vy + line = LineSegment((self.x,self.y), (self.x - self.vx, self.y - self.vy), positioning = "physical") + self.distance = ((self.x-self.fdx)**2+(self.y-self.fdy)**2)**(1/2) + + + else: + self.vx = 0 + self.vy = 0 + self.bkgoal = None + self.currentcmd = None + self.fdx = self.x + self.fdy = self.y + self.distance = 0 def right(self,x): @@ -286,6 +318,18 @@ def back(self,x): #position, direction, penstate, color Screen() alex=Turtle() +alex.bk(100) +alex.rt(60) +alex.bk(100) +alex.rt(60) +alex.bk(100) +alex.rt(60) +alex.bk(100) +alex.rt(60) +alex.bk(100) +alex.rt(60) +alex.bk(100) +'''alex.lt(60) alex.fd(100) alex.lt(60) alex.fd(100) @@ -294,9 +338,7 @@ def back(self,x): alex.lt(60) alex.fd(100) alex.lt(60) -alex.fd(100) -alex.lt(60) -alex.fd(100) +alex.fd(100)''' From 96d4d3168fdfbbe78f87af1897435fccca9caa88 Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Wed, 29 May 2019 14:05:45 -0400 Subject: [PATCH 106/149] Updated from Brython Server: 5/29/2019 2:05:45 PM --- finalproject.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/finalproject.py b/finalproject.py index e396a769..1667e3b5 100644 --- a/finalproject.py +++ b/finalproject.py @@ -342,7 +342,7 @@ def back(self,x): -print(alex.commandlist) + '''myapp.run() From 9f2e74cc70ddd97f6e8ea442761b38798da09af7 Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Wed, 29 May 2019 14:11:21 -0400 Subject: [PATCH 107/149] Updated from Brython Server: 5/29/2019 2:11:21 PM --- finalproject.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/finalproject.py b/finalproject.py index 1667e3b5..b7060038 100644 --- a/finalproject.py +++ b/finalproject.py @@ -318,7 +318,7 @@ def back(self,x): #position, direction, penstate, color Screen() alex=Turtle() -alex.bk(100) +'''alex.bk(100) alex.rt(60) alex.bk(100) alex.rt(60) @@ -329,7 +329,7 @@ def back(self,x): alex.bk(100) alex.rt(60) alex.bk(100) -'''alex.lt(60) +alex.lt(60) alex.fd(100) alex.lt(60) alex.fd(100) @@ -338,8 +338,8 @@ def back(self,x): alex.lt(60) alex.fd(100) alex.lt(60) -alex.fd(100)''' - +alex.fd(100) +''' From a427e4d47cc2ede5ac507dbdaba1faf91da32591 Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Thu, 30 May 2019 13:40:19 -0400 Subject: [PATCH 108/149] Updated from Brython Server: 5/30/2019 1:40:18 PM --- finalproject.py | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/finalproject.py b/finalproject.py index b7060038..d805431a 100644 --- a/finalproject.py +++ b/finalproject.py @@ -316,9 +316,23 @@ def back(self,x): #position, direction, penstate, color -Screen() -alex=Turtle() -'''alex.bk(100) +Screen() # Creates a playground for turtles +#alex=Turtle() + + + +bob = Turtle() #Bob is our turtle + +distance=20 + +for i in range(17): + bob.forward(distance) + bob.left(90) + distance=distance+30 + + +''' +alex.bk(100) alex.rt(60) alex.bk(100) alex.rt(60) @@ -338,8 +352,8 @@ def back(self,x): alex.lt(60) alex.fd(100) alex.lt(60) -alex.fd(100) -''' +alex.fd(100)''' + From da751c119e102c83e5635a0592d47802d7287bca Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Thu, 30 May 2019 13:41:05 -0400 Subject: [PATCH 109/149] Updated from Brython Server: 5/30/2019 1:41:02 PM From 3aca2b3bd5ab88f6660169d8fae08a16f9c98831 Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Thu, 30 May 2019 13:43:22 -0400 Subject: [PATCH 110/149] Updated from Brython Server: 5/30/2019 1:43:21 PM --- finalproject.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/finalproject.py b/finalproject.py index d805431a..636abb43 100644 --- a/finalproject.py +++ b/finalproject.py @@ -74,24 +74,24 @@ def step(self): cmd,val = self.currentcmd if cmd=="right": - self.vr = -0.06 + self.vr = -0.07 if self.rotationgoal==None: self.currentcmd=None if cmd=="left": - self.vr = 0.06 + self.vr = 0.07 if self.rotationgoal==None: self.currentcmd=None if cmd=="forward": - self.vx=-1*cos(self.rotation) - self.vy=sin(self.rotation) + self.vx=-1.05*cos(self.rotation) + self.vy=1.05*sin(self.rotation) if self.forwardgoal==None: self.currentcmd=None if cmd=="backward": - self.vx=-cos(self.rotation) - self.vy=sin(self.rotation) + self.vx=-2*cos(self.rotation) + self.vy=2*sin(self.rotation) if self.bkgoal==None: self.currentcmd=None From 049507924cedfc13670df197bf1fb1e8fb88d5bb Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Thu, 30 May 2019 13:44:07 -0400 Subject: [PATCH 111/149] Updated from Brython Server: 5/30/2019 1:44:06 PM --- finalproject.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/finalproject.py b/finalproject.py index 636abb43..3de08dea 100644 --- a/finalproject.py +++ b/finalproject.py @@ -84,14 +84,14 @@ def step(self): self.currentcmd=None if cmd=="forward": - self.vx=-1.05*cos(self.rotation) - self.vy=1.05*sin(self.rotation) + self.vx=-1*cos(self.rotation) + self.vy=*sin(self.rotation) if self.forwardgoal==None: self.currentcmd=None if cmd=="backward": - self.vx=-2*cos(self.rotation) - self.vy=2*sin(self.rotation) + self.vx=-cos(self.rotation) + self.vy=sin(self.rotation) if self.bkgoal==None: self.currentcmd=None From 3fba8fee0c8172581197282c3b323bdc8dd92641 Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Thu, 30 May 2019 13:45:06 -0400 Subject: [PATCH 112/149] Updated from Brython Server: 5/30/2019 1:45:05 PM --- finalproject.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/finalproject.py b/finalproject.py index 3de08dea..4fa074be 100644 --- a/finalproject.py +++ b/finalproject.py @@ -85,7 +85,7 @@ def step(self): if cmd=="forward": self.vx=-1*cos(self.rotation) - self.vy=*sin(self.rotation) + self.vy=sin(self.rotation) if self.forwardgoal==None: self.currentcmd=None From c3776ddbe2b325cd4cdbf27b7d95c0ba78d2bf87 Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Thu, 30 May 2019 13:47:03 -0400 Subject: [PATCH 113/149] Updated from Brython Server: 5/30/2019 1:47:02 PM From 4169a903da0a0fc34145e6f283b5386bf2cd6c99 Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Thu, 30 May 2019 13:51:51 -0400 Subject: [PATCH 114/149] Updated from Brython Server: 5/30/2019 1:51:49 PM --- finalproject.py | 46 +++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 41 insertions(+), 5 deletions(-) diff --git a/finalproject.py b/finalproject.py index 4fa074be..db84a119 100644 --- a/finalproject.py +++ b/finalproject.py @@ -74,12 +74,12 @@ def step(self): cmd,val = self.currentcmd if cmd=="right": - self.vr = -0.07 + self.vr = -0.06 if self.rotationgoal==None: self.currentcmd=None if cmd=="left": - self.vr = 0.07 + self.vr = 0.06 if self.rotationgoal==None: self.currentcmd=None @@ -320,15 +320,51 @@ def back(self,x): #alex=Turtle() - -bob = Turtle() #Bob is our turtle +turtle = Turtle() #Bob is our turtle -distance=20 +turtle.left(20) + +turtle.forward(50) +turtle.left(90) +turtle.forward(50) +turtle.left(90) +turtle.forward(50) +turtle.left(90) +turtle.forward(50) +turtle.left(90) + +turtle.left(30) + +turtle.forward(50) +turtle.left(90) +turtle.forward(50) +turtle.left(90) +turtle.forward(50) +turtle.left(90) +turtle.forward(50) +turtle.left(90) + +turtle.left(40) + +turtle.forward(50) +turtle.left(90) +turtle.forward(50) +turtle.left(90) +turtle.forward(50) +turtle.left(90) +turtle.forward(50) +turtle.left(90) + + +''' +distance=20 #spiral for i in range(17): bob.forward(distance) bob.left(90) distance=distance+30 +''' + ''' From 88df56f1970694ba12ae51f4c30400a413fef72e Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Thu, 30 May 2019 13:53:08 -0400 Subject: [PATCH 115/149] Updated from Brython Server: 5/30/2019 1:53:06 PM --- finalproject.py | 35 ----------------------------------- 1 file changed, 35 deletions(-) diff --git a/finalproject.py b/finalproject.py index db84a119..9b9323bb 100644 --- a/finalproject.py +++ b/finalproject.py @@ -320,41 +320,6 @@ def back(self,x): #alex=Turtle() -turtle = Turtle() #Bob is our turtle - -turtle.left(20) - -turtle.forward(50) -turtle.left(90) -turtle.forward(50) -turtle.left(90) -turtle.forward(50) -turtle.left(90) -turtle.forward(50) -turtle.left(90) - -turtle.left(30) - -turtle.forward(50) -turtle.left(90) -turtle.forward(50) -turtle.left(90) -turtle.forward(50) -turtle.left(90) -turtle.forward(50) -turtle.left(90) - -turtle.left(40) - -turtle.forward(50) -turtle.left(90) -turtle.forward(50) -turtle.left(90) -turtle.forward(50) -turtle.left(90) -turtle.forward(50) -turtle.left(90) - ''' distance=20 #spiral From 9c1509a7165d321248a34e9b207fe9d69daaa70d Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Thu, 30 May 2019 14:45:00 -0400 Subject: [PATCH 116/149] Updated from Brython Server: 5/30/2019 2:44:59 PM --- finalproject.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/finalproject.py b/finalproject.py index 9b9323bb..e8047fc8 100644 --- a/finalproject.py +++ b/finalproject.py @@ -317,18 +317,22 @@ def back(self,x): #position, direction, penstate, color Screen() # Creates a playground for turtles -#alex=Turtle() +turtle=Turtle() -''' -distance=20 #spiral +turtle.forward(100) +turtle.lt(120) +turtle.bk(39) +turtle.rt(180) + +'''distance=20 #spiral for i in range(17): bob.forward(distance) bob.left(90) - distance=distance+30 -''' + distance=distance+30''' + @@ -356,7 +360,7 @@ def back(self,x): alex.fd(100)''' - +print(alex.commandlist) '''myapp.run() From 54b648d5993c5349be70b9f2ef735dad97bf7e45 Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Fri, 31 May 2019 14:57:51 -0400 Subject: [PATCH 117/149] Updated from Brython Server: 5/31/2019 2:57:50 PM --- finalproject.py | 41 +++++++++++++++++++++++++---------------- 1 file changed, 25 insertions(+), 16 deletions(-) diff --git a/finalproject.py b/finalproject.py index e8047fc8..5d2148be 100644 --- a/finalproject.py +++ b/finalproject.py @@ -125,17 +125,18 @@ def step(self): elif self.rotationgoal - self.rotation > 0: #left turn if self.rotation + self.vr >= self.rotationgoal: - self.vr=0 - self.rotation=self.rotationgoal - self.rotationgoal=None - self.currentcmd=None + self.vr = 0 + self.rotation = self.rotationgoal + self.rotationgoal = None + self.currentcmd = None else: self.rotation += self.vr if self.rotation == self.rotationgoal: self.vr = 0 - self.rotationgoal=None - self.currentcmd=None + self.rotation = self.rotationgoal + self.rotationgoal = None + self.currentcmd = None if not self.forwardgoal is None: #forward @@ -321,19 +322,27 @@ def back(self,x): turtle=Turtle() -turtle.forward(100) -turtle.lt(120) -turtle.bk(39) -turtle.rt(180) -'''distance=20 #spiral +#turtle.left(20) -for i in range(17): - bob.forward(distance) - bob.left(90) - distance=distance+30''' +turtle.forward(50) +#turtle.left(90) +turtle.forward(50) +#turtle.left(90) +turtle.forward(50) +#turtle.left(100) +turtle.forward(80) +turtle.bk(20) +''' +distance=20 #spiral +for i in range(17): + turtle.forward(distance) + turtle.left(90) + distance=distance+30 + +''' ''' @@ -360,7 +369,7 @@ def back(self,x): alex.fd(100)''' -print(alex.commandlist) +print(turtle.commandlist) '''myapp.run() From f34fca27456a167fe44d2bf18e4edb4c60be3219 Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Fri, 31 May 2019 16:39:06 -0400 Subject: [PATCH 118/149] Updated from Brython Server: 5/31/2019 4:39:05 PM --- finalproject.py | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/finalproject.py b/finalproject.py index 5d2148be..c9e345d0 100644 --- a/finalproject.py +++ b/finalproject.py @@ -98,7 +98,7 @@ def step(self): elif self.commandlist: self.currentcmd = self.commandlist.pop(0) cmd,val = self.currentcmd - + print(cmd, val) if cmd=="right": self.rotationgoal = self.rotation - val*pi/180 @@ -108,6 +108,7 @@ def step(self): if cmd=="forward": self.forwardgoal = val + if cmd=="backward": self.bkgoal = val @@ -139,7 +140,8 @@ def step(self): self.currentcmd = None if not self.forwardgoal is None: #forward - + print(self.forwardgoal) + print(self.distance) if self.forwardgoal - self.distance > 0: if self.distance + (self.vx**2+self.vy**2)**1/2 >= self.forwardgoal: @@ -150,12 +152,14 @@ def step(self): self.y = (self.forwardgoal - self.distance)*sin(self.rotation) + self.y self.distance = 0 - + #print('hi') self.forwardgoal=None self.currentcmd=None else: + print('else') self.x -= self.vx self.y -= self.vy + #print(self.x, self.y) line = LineSegment((self.x,self.y), (self.x - self.vx, self.y - self.vy), positioning = "physical") self.distance = ((self.x-self.fdx)**2+(self.y-self.fdy)**2)**(1/2) @@ -167,7 +171,9 @@ def step(self): self.currentcmd = None self.fdx = self.x self.fdy = self.y + print(self.fdx, self.fdy) self.distance = 0 + #print('hi') if not self.bkgoal is None: #backward @@ -333,6 +339,16 @@ def back(self,x): #turtle.left(100) turtle.forward(80) turtle.bk(20) +turtle.rt(30) +turtle.fd(20) + +turtle.lt(90) +turtle.fd(200) + +turtle.lt(100) +turtle.fd(100) +turtle.lt(90) +turtle.fd(90) ''' distance=20 #spiral From cb6e5ffab7b5bc1f58d588201294861d103be6c8 Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Fri, 31 May 2019 16:43:42 -0400 Subject: [PATCH 119/149] Updated from Brython Server: 5/31/2019 4:43:41 PM --- finalproject.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/finalproject.py b/finalproject.py index c9e345d0..a4d8c574 100644 --- a/finalproject.py +++ b/finalproject.py @@ -150,7 +150,7 @@ def step(self): self.x = (self.forwardgoal - self.distance)*cos(self.rotation) + self.x self.y = (self.forwardgoal - self.distance)*sin(self.rotation) + self.y - + print(self.fdx, self.fdy) self.distance = 0 #print('hi') self.forwardgoal=None @@ -159,7 +159,6 @@ def step(self): print('else') self.x -= self.vx self.y -= self.vy - #print(self.x, self.y) line = LineSegment((self.x,self.y), (self.x - self.vx, self.y - self.vy), positioning = "physical") self.distance = ((self.x-self.fdx)**2+(self.y-self.fdy)**2)**(1/2) From 9173f249dbd3a77f56400826c60c22f6614941b8 Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Fri, 31 May 2019 16:46:52 -0400 Subject: [PATCH 120/149] Updated from Brython Server: 5/31/2019 4:46:51 PM --- finalproject.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/finalproject.py b/finalproject.py index a4d8c574..2bd14d1f 100644 --- a/finalproject.py +++ b/finalproject.py @@ -140,8 +140,7 @@ def step(self): self.currentcmd = None if not self.forwardgoal is None: #forward - print(self.forwardgoal) - print(self.distance) + if self.forwardgoal - self.distance > 0: if self.distance + (self.vx**2+self.vy**2)**1/2 >= self.forwardgoal: @@ -150,9 +149,12 @@ def step(self): self.x = (self.forwardgoal - self.distance)*cos(self.rotation) + self.x self.y = (self.forwardgoal - self.distance)*sin(self.rotation) + self.y - print(self.fdx, self.fdy) + + self.distance = 0 - #print('hi') + + self.fdx = self.x + self.fdy = self.y self.forwardgoal=None self.currentcmd=None else: @@ -161,6 +163,8 @@ def step(self): self.y -= self.vy line = LineSegment((self.x,self.y), (self.x - self.vx, self.y - self.vy), positioning = "physical") self.distance = ((self.x-self.fdx)**2+(self.y-self.fdy)**2)**(1/2) + if (cmd, val)==("forward",90): + print(self.x, self.y) else: @@ -186,7 +190,8 @@ def step(self): self.y = (self.bkgoal - self.distance)*sin(self.rotation) + self.y self.distance = 0 - + self.fdx = self.x + self.fdy = self.y self.bkgoal=None self.currentcmd=None else: From d9efc0dc1040f3a87413d3a235dfa842b8d1aeeb Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Fri, 31 May 2019 16:48:07 -0400 Subject: [PATCH 121/149] Updated from Brython Server: 5/31/2019 4:48:06 PM --- finalproject.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/finalproject.py b/finalproject.py index 2bd14d1f..a01ccaf9 100644 --- a/finalproject.py +++ b/finalproject.py @@ -158,13 +158,10 @@ def step(self): self.forwardgoal=None self.currentcmd=None else: - print('else') self.x -= self.vx self.y -= self.vy line = LineSegment((self.x,self.y), (self.x - self.vx, self.y - self.vy), positioning = "physical") self.distance = ((self.x-self.fdx)**2+(self.y-self.fdy)**2)**(1/2) - if (cmd, val)==("forward",90): - print(self.x, self.y) else: @@ -174,10 +171,10 @@ def step(self): self.currentcmd = None self.fdx = self.x self.fdy = self.y - print(self.fdx, self.fdy) + self.distance = 0 - #print('hi') - + + if not self.bkgoal is None: #backward if self.bkgoal - self.distance > 0: From 62e369b93130a0b997aa69f9ff5c693b3ad83054 Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Fri, 31 May 2019 16:53:08 -0400 Subject: [PATCH 122/149] Updated from Brython Server: 5/31/2019 4:53:08 PM --- finalproject.py | 44 ++++++++++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/finalproject.py b/finalproject.py index a01ccaf9..ec5f4924 100644 --- a/finalproject.py +++ b/finalproject.py @@ -98,7 +98,7 @@ def step(self): elif self.commandlist: self.currentcmd = self.commandlist.pop(0) cmd,val = self.currentcmd - print(cmd, val) + if cmd=="right": self.rotationgoal = self.rotation - val*pi/180 @@ -326,30 +326,35 @@ def back(self,x): #position, direction, penstate, color Screen() # Creates a playground for turtles -turtle=Turtle() +import math +radius=100 +petals=4 + + +def draw_arc(b,r): #bob the turtle,corner-to-corner length (radius) of petal (assume 60 degree central angle of sector for simplicity) + c=2*math.pi*r #Circumference of circle + ca=c/(360/60) #Circumference of arc (assume 60 degree central angle of sector as above) + n=int(ca/3)+1 #number of segments + l=ca/n #length of segment + for i in range(n): + b.fd(l) + b.lt(360/(n*6)) + +def draw_petal(b,r): + draw_arc(b,r) + b.lt(180-60) + draw_arc(b,r) -#turtle.left(20) +bob=Turtle() -turtle.forward(50) -#turtle.left(90) -turtle.forward(50) -#turtle.left(90) -turtle.forward(50) -#turtle.left(100) -turtle.forward(80) -turtle.bk(20) -turtle.rt(30) -turtle.fd(20) +#draw_petal(bob,radius) -turtle.lt(90) -turtle.fd(200) +for i in range(petals): + draw_petal(bob,radius) + bob.lt(360/petals) -turtle.lt(100) -turtle.fd(100) -turtle.lt(90) -turtle.fd(90) ''' distance=20 #spiral @@ -386,7 +391,6 @@ def back(self,x): alex.fd(100)''' -print(turtle.commandlist) '''myapp.run() From ba4e8e7e21779d127eb294385288a5ab2fd1e5cb Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Fri, 31 May 2019 16:57:28 -0400 Subject: [PATCH 123/149] Updated from Brython Server: 5/31/2019 4:57:28 PM --- finalproject.py | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/finalproject.py b/finalproject.py index ec5f4924..8a678982 100644 --- a/finalproject.py +++ b/finalproject.py @@ -326,12 +326,13 @@ def back(self,x): #position, direction, penstate, color Screen() # Creates a playground for turtles +bob=Turtle() -import math +''' +import math #PETALS radius=100 petals=4 - def draw_arc(b,r): #bob the turtle,corner-to-corner length (radius) of petal (assume 60 degree central angle of sector for simplicity) c=2*math.pi*r #Circumference of circle ca=c/(360/60) #Circumference of arc (assume 60 degree central angle of sector as above) @@ -341,20 +342,17 @@ def draw_arc(b,r): #bob the turtle,corner-to-corner length (radius) of petal (a b.fd(l) b.lt(360/(n*6)) + def draw_petal(b,r): draw_arc(b,r) b.lt(180-60) draw_arc(b,r) - - -bob=Turtle() - -#draw_petal(bob,radius) + b.rt(360/petals-30) # this will take care of the correct angle b/w petals for i in range(petals): draw_petal(bob,radius) - bob.lt(360/petals) - + bob.lt(360/4) +''' ''' distance=20 #spiral From feacb3de204d370477b628959a5a97348174dff9 Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Fri, 31 May 2019 17:08:10 -0400 Subject: [PATCH 124/149] Updated from Brython Server: 5/31/2019 5:08:09 PM --- finalproject.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/finalproject.py b/finalproject.py index 8a678982..a1c2974b 100644 --- a/finalproject.py +++ b/finalproject.py @@ -326,13 +326,26 @@ def back(self,x): #position, direction, penstate, color Screen() # Creates a playground for turtles -bob=Turtle() +painter = Turtle() + +for i in range(50): + painter.forward(50) + painter.left(123) # Let's go counterclockwise this time +''' +star = Turtle() + +for i in range(6): + star.forward(100) + star.right(144) + +''' ''' import math #PETALS radius=100 petals=4 +bob=Turtle() def draw_arc(b,r): #bob the turtle,corner-to-corner length (radius) of petal (assume 60 degree central angle of sector for simplicity) c=2*math.pi*r #Circumference of circle ca=c/(360/60) #Circumference of arc (assume 60 degree central angle of sector as above) From 3d040f79ac83a1f5f3f1be76e216c05cdf6c51e9 Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Sat, 1 Jun 2019 14:23:43 -0400 Subject: [PATCH 125/149] Updated from Brython Server: 6/1/2019 2:23:43 PM --- finalproject.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/finalproject.py b/finalproject.py index a1c2974b..2a65c759 100644 --- a/finalproject.py +++ b/finalproject.py @@ -326,11 +326,13 @@ def back(self,x): #position, direction, penstate, color Screen() # Creates a playground for turtles -painter = Turtle() -for i in range(50): - painter.forward(50) - painter.left(123) # Let's go counterclockwise this time +''' +spiral=Turtle() +for i in range(500): # this "for" loop will repeat these functions 500 times + spiral.forward(i) + spiral.left(91) +''' ''' star = Turtle() From 8fd9326dc715219196636c6b1c5e0cb38cec6406 Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Sat, 1 Jun 2019 14:26:47 -0400 Subject: [PATCH 126/149] Updated from Brython Server: 6/1/2019 2:26:47 PM --- finalproject.py | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/finalproject.py b/finalproject.py index 2a65c759..2e9cead6 100644 --- a/finalproject.py +++ b/finalproject.py @@ -253,6 +253,7 @@ def rt(self,x): >>> turtle.right(45) >>> turtle.heading() 337.0''' + return self.right(x) def left(self,x): @@ -300,6 +301,7 @@ def lt(self,x): >>> turtle.left(45) >>> turtle.heading() 67.0''' + return self.left(x) @@ -307,9 +309,49 @@ def heading(self): return self.combinedhead def forward(self,x): + '''Move the turtle forward by the specified distance. + + Aliases: forward | fd + + Argument: + distance -- a number (integer or float) + + Move the turtle forward by the specified distance, in the direction + the turtle is headed. + + Example: + >>> position() + (0.00, 0.00) + >>> forward(25) + >>> position() + (25.00,0.00) + >>> forward(-75) + >>> position() + (-50.00,0.00)''' + self.commandlist.append(("forward",x)) def fd(self,x): + '''Move the turtle forward by the specified distance. + + Aliases: forward | fd + + Argument: + distance -- a number (integer or float) + + Move the turtle forward by the specified distance, in the direction + the turtle is headed. + + Example: + >>> position() + (0.00, 0.00) + >>> forward(25) + >>> position() + (25.00,0.00) + >>> forward(-75) + >>> position() + (-50.00,0.00)''' + return self.forward(x) def backward(self,x): From 9dfc2f620bd8686a179f4f57ac78dff132905350 Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Sat, 1 Jun 2019 14:27:45 -0400 Subject: [PATCH 127/149] Updated from Brython Server: 6/1/2019 2:27:45 PM --- finalproject.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/finalproject.py b/finalproject.py index 2e9cead6..510feb94 100644 --- a/finalproject.py +++ b/finalproject.py @@ -355,6 +355,23 @@ def fd(self,x): return self.forward(x) def backward(self,x): + '''Move the turtle backward by distance. + + Aliases: back | backward | bk + + Argument: + distance -- a number + + Move the turtle backward by distance ,opposite to the direction the + turtle is headed. Do not change the turtle's heading. + + Example: + >>> position() + (0.00, 0.00) + >>> backward(30) + >>> position() + (-30.00, 0.00)''' + self.commandlist.append(("backward",x)) def bk(self,x): From e1ba11203816be7b7a5c0bb8697c84161b57d33e Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Sat, 1 Jun 2019 14:28:12 -0400 Subject: [PATCH 128/149] Updated from Brython Server: 6/1/2019 2:28:12 PM --- finalproject.py | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/finalproject.py b/finalproject.py index 510feb94..5ed196d2 100644 --- a/finalproject.py +++ b/finalproject.py @@ -375,9 +375,43 @@ def backward(self,x): self.commandlist.append(("backward",x)) def bk(self,x): + '''Move the turtle backward by distance. + + Aliases: back | backward | bk + + Argument: + distance -- a number + + Move the turtle backward by distance ,opposite to the direction the + turtle is headed. Do not change the turtle's heading. + + Example: + >>> position() + (0.00, 0.00) + >>> backward(30) + >>> position() + (-30.00, 0.00)''' + return self.backward(x) def back(self,x): + '''Move the turtle backward by distance. + + Aliases: back | backward | bk + + Argument: + distance -- a number + + Move the turtle backward by distance ,opposite to the direction the + turtle is headed. Do not change the turtle's heading. + + Example: + >>> position() + (0.00, 0.00) + >>> backward(30) + >>> position() + (-30.00, 0.00)''' + return self.backward(x) From f4d6e8878a445917509bf567815a6c57ed9752c1 Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Tue, 4 Jun 2019 10:55:46 -0400 Subject: [PATCH 129/149] Updated from Brython Server: 6/4/2019 10:55:46 AM --- finalproject.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/finalproject.py b/finalproject.py index 5ed196d2..481d1f57 100644 --- a/finalproject.py +++ b/finalproject.py @@ -37,9 +37,11 @@ def step(self): class Turtle(Sprite): #defining colors black = Color(0x000000, 1.0) + red = Color(0xF01414, 1.0) white = Color(0xFFFFFF, 1.0) thinlinewhite = LineStyle(1, white) thinlineblack = LineStyle(1, black) + thinlinered = LineStyle(1, red) def __init__(self): width=Screen.width height=Screen.height From a5a8072c2d898f9dfd971ae5ec51191d86be5937 Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Tue, 4 Jun 2019 11:01:12 -0400 Subject: [PATCH 130/149] Updated from Brython Server: 6/4/2019 11:01:12 AM --- finalproject.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/finalproject.py b/finalproject.py index 481d1f57..41acc231 100644 --- a/finalproject.py +++ b/finalproject.py @@ -39,10 +39,13 @@ class Turtle(Sprite): black = Color(0x000000, 1.0) red = Color(0xF01414, 1.0) white = Color(0xFFFFFF, 1.0) + blue = Color(0x1464F0, 1.0) thinlinewhite = LineStyle(1, white) thinlineblack = LineStyle(1, black) thinlinered = LineStyle(1, red) + thinlineblue = LineStyle(1, blue) def __init__(self): + self.color = black width=Screen.width height=Screen.height screencenter=(width/2,height/2) #finds a tuple for the center of the screen @@ -96,6 +99,9 @@ def step(self): self.vy=sin(self.rotation) if self.bkgoal==None: self.currentcmd=None + + if cmd=="color": + self.color = val elif self.commandlist: self.currentcmd = self.commandlist.pop(0) @@ -414,7 +420,10 @@ def back(self,x): >>> position() (-30.00, 0.00)''' - return self.backward(x) + return self.backward(x) + + def color(self, x): + self.commandlist.append(("color",x)) From 64c0440520666b85532e446d44fe2d9b7a748210 Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Tue, 4 Jun 2019 11:04:54 -0400 Subject: [PATCH 131/149] Updated from Brython Server: 6/4/2019 11:04:50 AM --- finalproject.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/finalproject.py b/finalproject.py index 41acc231..4658c713 100644 --- a/finalproject.py +++ b/finalproject.py @@ -45,11 +45,12 @@ class Turtle(Sprite): thinlinered = LineStyle(1, red) thinlineblue = LineStyle(1, blue) def __init__(self): - self.color = black + self.color = self.black + self.thinline = self.thinlineblack width=Screen.width height=Screen.height screencenter=(width/2,height/2) #finds a tuple for the center of the screen - startturtle=PolygonAsset([(5,5),(20,13),(5,21),(10,13),(5,5)],self.thinlineblack, self.black) + startturtle=PolygonAsset([(5,5),(20,13),(5,21),(10,13),(5,5)],self.thinline, self.color) super().__init__(startturtle, screencenter) self.rotationgoal = None self.forwardgoal = None @@ -437,14 +438,14 @@ def color(self, x): spiral.forward(i) spiral.left(91) ''' -''' + star = Turtle() for i in range(6): star.forward(100) star.right(144) -''' + ''' import math #PETALS From d05ea2c1b82e4c90e035ddc1e14cd08346215ddb Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Tue, 4 Jun 2019 11:07:42 -0400 Subject: [PATCH 132/149] Updated from Brython Server: 6/4/2019 11:07:42 AM --- finalproject.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/finalproject.py b/finalproject.py index 4658c713..18986229 100644 --- a/finalproject.py +++ b/finalproject.py @@ -73,6 +73,8 @@ def __init__(self): self.fdx = width/2 self.fdy = height/2 + self.colorgoal = None + def step(self): @@ -101,8 +103,8 @@ def step(self): if self.bkgoal==None: self.currentcmd=None - if cmd=="color": - self.color = val + + elif self.commandlist: self.currentcmd = self.commandlist.pop(0) @@ -119,7 +121,15 @@ def step(self): if cmd=="backward": - self.bkgoal = val + self.bkgoal = val + + if cmd=="color": + if val == "red": + self.color = self.red + self.thinline = self.thinlinered + if val == "black": + self.color = self.black + self.thinline = self.thinlineblack if not self.rotationgoal is None: #TURNS From 88cfa5776dcfeea4f2a3c58c7e9d6eed8be9eff4 Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Tue, 4 Jun 2019 11:08:51 -0400 Subject: [PATCH 133/149] Updated from Brython Server: 6/4/2019 11:08:51 AM --- finalproject.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/finalproject.py b/finalproject.py index 18986229..ccab6c75 100644 --- a/finalproject.py +++ b/finalproject.py @@ -73,8 +73,6 @@ def __init__(self): self.fdx = width/2 self.fdy = height/2 - self.colorgoal = None - def step(self): @@ -130,6 +128,10 @@ def step(self): if val == "black": self.color = self.black self.thinline = self.thinlineblack + if val == "blue": + self.color = self.blue + self.thinline = self.thinlineblue + self.currentcmd = None if not self.rotationgoal is None: #TURNS From 5ab4b8deaabd28c528c3ffd70c5e78a7a0f66a79 Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Tue, 4 Jun 2019 11:12:48 -0400 Subject: [PATCH 134/149] Updated from Brython Server: 6/4/2019 11:12:48 AM --- finalproject.py | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/finalproject.py b/finalproject.py index ccab6c75..f55ad338 100644 --- a/finalproject.py +++ b/finalproject.py @@ -45,12 +45,12 @@ class Turtle(Sprite): thinlinered = LineStyle(1, red) thinlineblue = LineStyle(1, blue) def __init__(self): - self.color = self.black - self.thinline = self.thinlineblack + self.currentcolor = self.black + self.currentthinline = self.thinlineblack width=Screen.width height=Screen.height screencenter=(width/2,height/2) #finds a tuple for the center of the screen - startturtle=PolygonAsset([(5,5),(20,13),(5,21),(10,13),(5,5)],self.thinline, self.color) + startturtle=PolygonAsset([(5,5),(20,13),(5,21),(10,13),(5,5)],self.currentthinline, self.currentcolor) super().__init__(startturtle, screencenter) self.rotationgoal = None self.forwardgoal = None @@ -102,7 +102,6 @@ def step(self): self.currentcmd=None - elif self.commandlist: self.currentcmd = self.commandlist.pop(0) @@ -123,14 +122,14 @@ def step(self): if cmd=="color": if val == "red": - self.color = self.red - self.thinline = self.thinlinered + self.currentcolor = self.red + self.currentthinline = self.thinlinered if val == "black": - self.color = self.black - self.thinline = self.thinlineblack + self.currentcolor = self.black + self.currentthinline = self.thinlineblack if val == "blue": - self.color = self.blue - self.thinline = self.thinlineblue + self.currentcolor = self.blue + self.currentthinline = self.thinlineblue self.currentcmd = None if not self.rotationgoal is None: #TURNS @@ -453,6 +452,8 @@ def color(self, x): star = Turtle() +star.color("red") + for i in range(6): star.forward(100) star.right(144) From 691e8b8fafc1dfe77f50e8bc3198bcbe3d6c5268 Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Tue, 4 Jun 2019 11:13:34 -0400 Subject: [PATCH 135/149] Updated from Brython Server: 6/4/2019 11:13:34 AM From 5199f140ce6047b832171bd27e0c8ebae034605a Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Tue, 4 Jun 2019 13:18:10 -0400 Subject: [PATCH 136/149] Updated from Brython Server: 6/4/2019 1:18:06 PM From ed2025620e8636d2ea5e343bd12a54ea74d18bc9 Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Tue, 4 Jun 2019 13:21:38 -0400 Subject: [PATCH 137/149] Updated from Brython Server: 6/4/2019 1:21:38 PM --- finalproject.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/finalproject.py b/finalproject.py index f55ad338..86f6c3f5 100644 --- a/finalproject.py +++ b/finalproject.py @@ -180,7 +180,7 @@ def step(self): else: self.x -= self.vx self.y -= self.vy - line = LineSegment((self.x,self.y), (self.x - self.vx, self.y - self.vy), positioning = "physical") + line = LineSegment((self.x,self.y), (self.x - self.vx, self.y - self.vy), style = self.currentthinline, positioning = "physical") self.distance = ((self.x-self.fdx)**2+(self.y-self.fdy)**2)**(1/2) From 5961a958ff17ebf30918d8880bb28f7ab0aec08f Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Tue, 4 Jun 2019 13:22:12 -0400 Subject: [PATCH 138/149] Updated from Brython Server: 6/4/2019 1:22:12 PM --- finalproject.py | 1 - 1 file changed, 1 deletion(-) diff --git a/finalproject.py b/finalproject.py index 86f6c3f5..0d73e4b8 100644 --- a/finalproject.py +++ b/finalproject.py @@ -116,7 +116,6 @@ def step(self): if cmd=="forward": self.forwardgoal = val - if cmd=="backward": self.bkgoal = val From 8cf7aaa8df3db2fb39ac8aa98bcb9702e7a9005a Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Tue, 4 Jun 2019 13:25:13 -0400 Subject: [PATCH 139/149] Updated from Brython Server: 6/4/2019 1:25:12 PM From c0b231214a1fa8a107c3d0804d1464958002e18f Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Tue, 4 Jun 2019 13:34:33 -0400 Subject: [PATCH 140/149] Updated from Brython Server: 6/4/2019 1:34:32 PM --- finalproject.py | 73 +++++++++++++++++++++++++------------------------ 1 file changed, 37 insertions(+), 36 deletions(-) diff --git a/finalproject.py b/finalproject.py index 0d73e4b8..42a38930 100644 --- a/finalproject.py +++ b/finalproject.py @@ -44,6 +44,7 @@ class Turtle(Sprite): thinlineblack = LineStyle(1, black) thinlinered = LineStyle(1, red) thinlineblue = LineStyle(1, blue) + def __init__(self): self.currentcolor = self.black self.currentthinline = self.thinlineblack @@ -51,14 +52,14 @@ def __init__(self): height=Screen.height screencenter=(width/2,height/2) #finds a tuple for the center of the screen startturtle=PolygonAsset([(5,5),(20,13),(5,21),(10,13),(5,5)],self.currentthinline, self.currentcolor) - super().__init__(startturtle, screencenter) + self.turtle = Sprite(startturtle, screencenter) self.rotationgoal = None self.forwardgoal = None self.bkgoal = None self.vr = 0 - self.fxcenter = 1 - self.fycenter = 1/2 + self.turtle.fxcenter = 1 + self.turtle.fycenter = 1/2 self.vx = 0 self.vy = 0 @@ -84,7 +85,7 @@ def step(self): if self.rotationgoal==None: self.currentcmd=None - if cmd=="left": + if cmd=="left": self.vr = 0.06 if self.rotationgoal==None: self.currentcmd=None @@ -108,10 +109,10 @@ def step(self): cmd,val = self.currentcmd if cmd=="right": - self.rotationgoal = self.rotation - val*pi/180 + self.rotationgoal = self.turtle.rotation - val*pi/180 if cmd=="left": - self.rotationgoal = self.rotation + val*pi/180 + self.rotationgoal = self.turtle.rotation + val*pi/180 if cmd=="forward": self.forwardgoal = val @@ -133,28 +134,28 @@ def step(self): if not self.rotationgoal is None: #TURNS - if self.rotationgoal - self.rotation < 0: #right turn - if self.rotation + self.vr <= self.rotationgoal: + if self.rotationgoal - self.turtle.rotation < 0: #right turn + if self.turtle.rotation + self.vr <= self.rotationgoal: self.vr = 0 - self.rotation=self.rotationgoal + self.turtle.rotation=self.rotationgoal self.rotationgoal=None self.currentcmd=None else: - self.rotation += self.vr + self.turtle.rotation += self.vr - elif self.rotationgoal - self.rotation > 0: #left turn - if self.rotation + self.vr >= self.rotationgoal: + elif self.rotationgoal - self.turtle.rotation > 0: #left turn + if self.turtle.rotation + self.vr >= self.rotationgoal: self.vr = 0 - self.rotation = self.rotationgoal + self.turtle.rotation = self.rotationgoal self.rotationgoal = None self.currentcmd = None else: - self.rotation += self.vr + self.turtle.rotation += self.vr - if self.rotation == self.rotationgoal: + if self.turtle.rotation == self.rotationgoal: self.vr = 0 - self.rotation = self.rotationgoal + self.turtle.rotation = self.rotationgoal self.rotationgoal = None self.currentcmd = None @@ -166,21 +167,21 @@ def step(self): self.vx = 0 self.vy = 0 - self.x = (self.forwardgoal - self.distance)*cos(self.rotation) + self.x - self.y = (self.forwardgoal - self.distance)*sin(self.rotation) + self.y + self.turtle.x = (self.forwardgoal - self.distance)*cos(self.rotation) + self.turtle.x + self.turtle.y = (self.forwardgoal - self.distance)*sin(self.rotation) + self.turtle.y self.distance = 0 - self.fdx = self.x - self.fdy = self.y + self.fdx = self.turtle.x + self.fdy = self.turtle.y self.forwardgoal=None self.currentcmd=None else: - self.x -= self.vx - self.y -= self.vy - line = LineSegment((self.x,self.y), (self.x - self.vx, self.y - self.vy), style = self.currentthinline, positioning = "physical") - self.distance = ((self.x-self.fdx)**2+(self.y-self.fdy)**2)**(1/2) + self.turtle.x -= self.vx + self.turtle.y -= self.vy + line = LineSegment((self.turtle.x,self.turtle.y), (self.turtle.x - self.vx, self.turtle.y - self.vy), style = self.currentthinline, positioning = "physical") + self.distance = ((self.turtle.x-self.fdx)**2+(self.turtle.y-self.fdy)**2)**(1/2) else: @@ -188,8 +189,8 @@ def step(self): self.vy = 0 self.forwardgoal = None self.currentcmd = None - self.fdx = self.x - self.fdy = self.y + self.fdx = self.turtle.x + self.fdy = self.turtle.y self.distance = 0 @@ -202,19 +203,19 @@ def step(self): self.vx = 0 self.vy = 0 - self.x = (self.bkgoal - self.distance)*cos(self.rotation) + self.x - self.y = (self.bkgoal - self.distance)*sin(self.rotation) + self.y + self.turtle.x = (self.bkgoal - self.distance)*cos(self.rotation) + self.turtle.x + self.turtle.y = (self.bkgoal - self.distance)*sin(self.rotation) + self.turtle.y self.distance = 0 - self.fdx = self.x - self.fdy = self.y + self.fdx = self.turtle.x + self.fdy = self.turtle.y self.bkgoal=None self.currentcmd=None else: - self.x += self.vx - self.y += self.vy - line = LineSegment((self.x,self.y), (self.x - self.vx, self.y - self.vy), positioning = "physical") - self.distance = ((self.x-self.fdx)**2+(self.y-self.fdy)**2)**(1/2) + self.turtle.x += self.vx + self.turtle.y += self.vy + line = LineSegment((self.turtle.x,self.turtle.y), (self.turtle.x - self.vx, self.turtle.y - self.vy), positioning = "physical") + self.distance = ((self.turtle.x-self.fdx)**2+(self.turtle.y-self.fdy)**2)**(1/2) else: @@ -222,8 +223,8 @@ def step(self): self.vy = 0 self.bkgoal = None self.currentcmd = None - self.fdx = self.x - self.fdy = self.y + self.fdx = self.turtle.x + self.fdy = self.turtle.y self.distance = 0 From 676de83187e203395eff09f9a81ca42af8954e3e Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Tue, 4 Jun 2019 13:41:39 -0400 Subject: [PATCH 141/149] Updated from Brython Server: 6/4/2019 1:41:40 PM --- finalproject.py | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/finalproject.py b/finalproject.py index 42a38930..7e3605fb 100644 --- a/finalproject.py +++ b/finalproject.py @@ -24,6 +24,8 @@ class Screen(App): If none exists at the moment, create a new one and return it, else return the existing one''' app=None + theturtle = None + def __init__(self): super().__init__() self.run() @@ -31,10 +33,15 @@ def __init__(self): #Screen.app.run() def step(self): - for s in self.getSpritesbyClass(Turtle): - s.step() + self.theturtle.step() + #for s in self.getSpritesbyClass(Turtle): + # s.step() + + @classmethod + def registerturtle(cls, turtle): + cls.theturtle = turtle -class Turtle(Sprite): +class Turtle: #defining colors black = Color(0x000000, 1.0) red = Color(0xF01414, 1.0) @@ -46,6 +53,7 @@ class Turtle(Sprite): thinlineblue = LineStyle(1, blue) def __init__(self): + Screen.registerturtle(self) self.currentcolor = self.black self.currentthinline = self.thinlineblack width=Screen.width @@ -91,14 +99,14 @@ def step(self): self.currentcmd=None if cmd=="forward": - self.vx=-1*cos(self.rotation) - self.vy=sin(self.rotation) + self.vx=-1*cos(self.turtle.rotation) + self.vy=sin(self.turtle.rotation) if self.forwardgoal==None: self.currentcmd=None if cmd=="backward": - self.vx=-cos(self.rotation) - self.vy=sin(self.rotation) + self.vx=-cos(self.turtle.rotation) + self.vy=sin(self.turtle.rotation) if self.bkgoal==None: self.currentcmd=None @@ -167,8 +175,8 @@ def step(self): self.vx = 0 self.vy = 0 - self.turtle.x = (self.forwardgoal - self.distance)*cos(self.rotation) + self.turtle.x - self.turtle.y = (self.forwardgoal - self.distance)*sin(self.rotation) + self.turtle.y + self.turtle.x = (self.forwardgoal - self.distance)*cos(self.turtle.rotation) + self.turtle.x + self.turtle.y = (self.forwardgoal - self.distance)*sin(self.turtle.rotation) + self.turtle.y self.distance = 0 @@ -203,8 +211,8 @@ def step(self): self.vx = 0 self.vy = 0 - self.turtle.x = (self.bkgoal - self.distance)*cos(self.rotation) + self.turtle.x - self.turtle.y = (self.bkgoal - self.distance)*sin(self.rotation) + self.turtle.y + self.turtle.x = (self.bkgoal - self.distance)*cos(self.turtle.rotation) + self.turtle.x + self.turtle.y = (self.bkgoal - self.distance)*sin(self.turtle.rotation) + self.turtle.y self.distance = 0 self.fdx = self.turtle.x From 52c781457a484ecbf2af8740df8aacae0b31e089 Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Tue, 4 Jun 2019 13:50:21 -0400 Subject: [PATCH 142/149] Updated from Brython Server: 6/4/2019 1:50:18 PM --- finalproject.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/finalproject.py b/finalproject.py index 7e3605fb..05799bcc 100644 --- a/finalproject.py +++ b/finalproject.py @@ -59,6 +59,7 @@ def __init__(self): width=Screen.width height=Screen.height screencenter=(width/2,height/2) #finds a tuple for the center of the screen + #self.newturtle(self.currentcolor, self.currentthinline) startturtle=PolygonAsset([(5,5),(20,13),(5,21),(10,13),(5,5)],self.currentthinline, self.currentcolor) self.turtle = Sprite(startturtle, screencenter) self.rotationgoal = None @@ -82,6 +83,21 @@ def __init__(self): self.fdx = width/2 self.fdy = height/2 + def newturtle(self, color, line): + if self.turtle: + x = self.turtle.x + y = self.turtle.y + r = self.turtle.rotation + self.turtle.destroy() + else: + x = self.turtle.x + y = self.turtle.y + r = self.turtle.rotation + startturtle=PolygonAsset([(5,5),(20,13),(5,21),(10,13),(5,5)],self.currentthinline, self.currentcolor) + self.turtle = Sprite(startturtle, screencenter) + self.turtle.x = x + self.turtle.fxcenter = 1 + self.turtle.fycenter = 1/2 def step(self): From fe1ae65f739b6d3e22a5a904f338debcd2e5ab47 Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Tue, 4 Jun 2019 13:51:53 -0400 Subject: [PATCH 143/149] Updated from Brython Server: 6/4/2019 1:51:53 PM From 18a7825dde5166a0eb25b88b325ed5cc0ab218a5 Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Tue, 4 Jun 2019 13:54:50 -0400 Subject: [PATCH 144/149] Updated from Brython Server: 6/4/2019 1:54:51 PM --- finalproject.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/finalproject.py b/finalproject.py index 05799bcc..e34abfae 100644 --- a/finalproject.py +++ b/finalproject.py @@ -47,10 +47,17 @@ class Turtle: red = Color(0xF01414, 1.0) white = Color(0xFFFFFF, 1.0) blue = Color(0x1464F0, 1.0) + green = Color(0x54C175, 1.0) + yellow = Color(0xFAFF44, 1.0) + orange = Color(0xFFA500, 1.0) + thinlinewhite = LineStyle(1, white) thinlineblack = LineStyle(1, black) thinlinered = LineStyle(1, red) thinlineblue = LineStyle(1, blue) + thinlinegreen = LineStyle(1, green) + thinlineyellow = LineStyle(1, yellow) + thinlineorange = LineStyle(1, orange) def __init__(self): Screen.registerturtle(self) From dcc8602e30f43b9af7ab01907b7862b79e4b4487 Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Tue, 4 Jun 2019 13:56:07 -0400 Subject: [PATCH 145/149] Updated from Brython Server: 6/4/2019 1:56:07 PM --- finalproject.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/finalproject.py b/finalproject.py index e34abfae..44359c4f 100644 --- a/finalproject.py +++ b/finalproject.py @@ -50,6 +50,7 @@ class Turtle: green = Color(0x54C175, 1.0) yellow = Color(0xFAFF44, 1.0) orange = Color(0xFFA500, 1.0) + cyan = Color(0x00FFFF, 1.0) thinlinewhite = LineStyle(1, white) thinlineblack = LineStyle(1, black) @@ -58,6 +59,7 @@ class Turtle: thinlinegreen = LineStyle(1, green) thinlineyellow = LineStyle(1, yellow) thinlineorange = LineStyle(1, orange) + thinlinecyan = LineStyle(1, cyan) def __init__(self): Screen.registerturtle(self) From 9a2ebd63f45019bdac9b11429255e66d70bb5bee Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Tue, 4 Jun 2019 13:57:11 -0400 Subject: [PATCH 146/149] Updated from Brython Server: 6/4/2019 1:57:12 PM --- finalproject.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/finalproject.py b/finalproject.py index 44359c4f..14556677 100644 --- a/finalproject.py +++ b/finalproject.py @@ -162,7 +162,19 @@ def step(self): self.currentthinline = self.thinlineblack if val == "blue": self.currentcolor = self.blue - self.currentthinline = self.thinlineblue + self.currentthinline = self.thinlineblue + if val == "green": + self.currentcolor = self.green + self.currentthinline = self.thinlinegreen + if val == "yellow": + self.currentcolor = self.yellow + self.currentthinline = self.thinlineyellow + if val == "orange": + self.currentcolor = self.orange + self.currentthinline = self.thinlineorange + if val == "cyan": + self.currentcolor = self.cyan + self.currentthinline = self.thinlinecyan self.currentcmd = None if not self.rotationgoal is None: #TURNS From eb4ee696898ad55f2fb620d510dc5ff5d42c6084 Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Tue, 4 Jun 2019 13:58:10 -0400 Subject: [PATCH 147/149] Updated from Brython Server: 6/4/2019 1:58:10 PM --- finalproject.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/finalproject.py b/finalproject.py index 14556677..b7fe1bfd 100644 --- a/finalproject.py +++ b/finalproject.py @@ -497,7 +497,7 @@ def color(self, x): star = Turtle() -star.color("red") +star.color("cyan") for i in range(6): star.forward(100) From 79e33464a11ad99a6284ca66f215ee6615509132 Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Tue, 4 Jun 2019 14:02:15 -0400 Subject: [PATCH 148/149] Updated from Brython Server: 6/4/2019 2:02:15 PM --- finalproject.py | 1 - 1 file changed, 1 deletion(-) diff --git a/finalproject.py b/finalproject.py index b7fe1bfd..c1070c23 100644 --- a/finalproject.py +++ b/finalproject.py @@ -497,7 +497,6 @@ def color(self, x): star = Turtle() -star.color("cyan") for i in range(6): star.forward(100) From 56d80d19ef4766162f86f7466e34dca11651754f Mon Sep 17 00:00:00 2001 From: miViriaz15 <46974607+miViriaz15@users.noreply.github.com> Date: Tue, 4 Jun 2019 14:27:22 -0400 Subject: [PATCH 149/149] Updated from Brython Server: 6/4/2019 2:27:19 PM --- finalproject.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/finalproject.py b/finalproject.py index c1070c23..4f9c9d5d 100644 --- a/finalproject.py +++ b/finalproject.py @@ -497,8 +497,9 @@ def color(self, x): star = Turtle() +star.color("green") -for i in range(6): +for i in range(5): star.forward(100) star.right(144) @@ -531,7 +532,7 @@ def draw_petal(b,r): bob.lt(360/4) ''' ''' - +turtle = Turtle() distance=20 #spiral for i in range(17): @@ -539,9 +540,9 @@ def draw_petal(b,r): turtle.left(90) distance=distance+30 -''' - +''' +alex = Turtle() ''' alex.bk(100) alex.rt(60) @@ -554,6 +555,8 @@ def draw_petal(b,r): alex.bk(100) alex.rt(60) alex.bk(100) + +''' alex.lt(60) alex.fd(100) alex.lt(60) @@ -563,8 +566,9 @@ def draw_petal(b,r): alex.lt(60) alex.fd(100) alex.lt(60) -alex.fd(100)''' - +alex.fd(100) +alex.lt(60) +alex.fd(100) '''myapp.run()