alcemirfernandes / pynguin

Automatically exported from code.google.com/p/pynguin
GNU General Public License v3.0
0 stars 0 forks source link

non-function code in scratch area doesn't run properly when beginning with reset #10

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. put commands (outside of a function) in the scratch area, beginning with 
reset  e.g.:
reset()
for i in range(90):
    fd(i)
    lt(1)
2. Hit "Test"
3. Sometimes it works, sometimes it doesn't, and requires multiple "Tests" to 
start.

What is the expected output? What do you see instead?
Going?  Stopping.

What version of the product are you using? On what operating system?
0.8, Ubuntu 9.10

Please provide any additional information below.
I also recall noticing some strange behavior with functions that begin with 
reset(), though I can't track it down at the moment. . .

Original issue reported on code.google.com by aresnick...@gmail.com on 13 Jun 2010 at 11:00

GoogleCodeExporter commented 9 years ago
You'll have to read the code for reset() to see why that is a bad idea (tm).

Basically, the first thing reset() does is clear out everything, including any 
queued moves that might be part of the reset itself.

That's going to cause trouble.

Maybe what you want instead of reset() is:

clear()
home()
?

Original comment by miss...@hotmail.com on 14 Jun 2010 at 1:21

GoogleCodeExporter commented 9 years ago
Maybe pynguin.reset() should be separated from the full-on whole system reset.

When you run reset() as part of a script, what exactly are you hoping will be 
reset?

Original comment by miss...@hotmail.com on 15 Jun 2010 at 7:58

GoogleCodeExporter commented 9 years ago
Usually, people are just trying to:
"""
clear()
goto(0,0)
turnto(0)
"""

pynguin.reset() separated out would be pretty nice (especially if you can clear 
only what a pynguin has drawn, though that might be annoying. . .)

Original comment by aresnick...@gmail.com on 15 Jun 2010 at 9:03

GoogleCodeExporter commented 9 years ago
> clear()
> goto(0,0)
> turnto(0)

Ok. I will think of a way to separate out that functionality. I think reset() 
is good name for bringing the pynguin back to its initial state.

I think I would add to that list:

pendown()
nofill()
width(2)
color('white')
fillcolor(100, 220, 110) # the default
fillrule('winding')

Any objection to those?

I think if someone wants different settings, they could create their own 
function that sets things up the way they want ...

def reset2():
    reset()
    color('black')
    fill(color='white')

or whatever...

What would be a good name for completely resetting the workspace? (back to 1 
fresh pynguin, fully cleared screen, etc...)  Maybe

full_reset() or 
reset(full=True)
restart() or
refresh() or
...
?

> especially if you can clear only what a pynguin has drawn

pynguin.clear() should only remove what that one pynguin has drawn. Anything 
drawn by another pynguin should be unaffected. Or am I misunderstanding what 
you need?

Original comment by miss...@hotmail.com on 15 Jun 2010 at 11:24

GoogleCodeExporter commented 9 years ago
> I think I would add to that list:
>
> pendown()
> nofill()
> width(2)
> color('white')
> fillcolor(100, 220, 110) # the default
> fillrule('winding')
>
>Any objection to those?

Sounds good to me--I've run into some issues that require me to penup/pendown 
to get the penguin drawing again.  That said, the right strategy is to probably 
just address those issues?  I'll keep my eye out.

> What would be a good name for completely resetting the workspace? (back to 1 
fresh pynguin, fully cleared screen, etc...)  Maybe
> 
> full_reset() or 
> reset(full=True)
> restart() or
> refresh() or
> ...
> ?

full_reset, reset(full=True) sound good to me.

> pynguin.clear() should only remove what that one pynguin has drawn. Anything 
drawn by another pynguin should be unaffected. Or am I misunderstanding what 
you need?

Nope, sounds great!

Thanks!

Original comment by aresnick...@gmail.com on 15 Jun 2010 at 11:31

GoogleCodeExporter commented 9 years ago
>> pynguin.clear() should only remove what that one pynguin has drawn.

> sounds great!

Sorry. What I meant is: it already works like that (at least it should). 
If not, please file a separate issue.

Original comment by miss...@hotmail.com on 16 Jun 2010 at 12:20

GoogleCodeExporter commented 9 years ago
This issue was closed by revision 26633a9bf2.

Original comment by miss...@hotmail.com on 1 Jul 2010 at 4:17