10
votes
N dimensional cubes
Generation of vertices
You could use itertools.product to generate vertices. You can ...
10
votes
Simple (Very Easy to Make) RPG Game Simulation in Python and Turtle
jedi_gif = "/home/asus/Arief_tempo/images/random/jedi.gif"
It's unclear why this image has an absolute path but no others do. They should probably all be relative,...
7
votes
Accepted
Drawing dragon curves using Turtle graphics
Whitespace
There should be a blank line between two method definitions.
Also, some blank lines inside of the methods would give the code room to breathe, and allow you to visually separate individual &...
7
votes
Drawing a mathematical envelope with turtle graphics
Overview
You've done an excellent job:
Overall code layout is good
You did a good job partitioning code into functions
You leveraged code written by others with the imports
Used meaningful names for ...
7
votes
Accepted
Drawing a mathematical envelope with turtle graphics
It's good that you got this working (especially since you only started a week ago). It's also unsurprising that you're using turtle, which is geared toward beginner graphics.
As you've already seen, ...
6
votes
Simple (Very Easy to Make) RPG Game Simulation in Python and Turtle
Just a note of something that was particularly jarring when viewing your code; for stylistic reasons, you shouldn't have spaces on either side of the arguments:
...
6
votes
Python analog clock with turtle - runs slow
Avoid import *; there's only a few symbols you need from turtle.
There's a lot of repetition in your hand logic. Consider factoring out a class that does the common ...
5
votes
Python OOP Whac-A-Mole program using turtle
Terminology
one [class] for Game which is the super class
What you probably mean is that it is the class that controls everything and such is on top of the logical class hierarchy. But when ...
5
votes
Accepted
Basic Ray Tracer
Overview
You've done an excellent job:
Overall code layout is good
You did a good job partitioning code into functions
You leveraged code written by others with the imports
Used meaningful names for ...
4
votes
Accepted
Python Turtle - Olympic flag re-creation
Your function kind-of works as intended, except the obvious deviation occurring at the crossings of rings. However, you can only draw the logo at one specific size and you need a heck of a lot of code ...
Mast♦
- 13.5k
4
votes
Accepted
Drawing fractals with Turtle
Couple performance and code style related notes:
if you can define something outside/before a loop, do so. For example, there is no need to define linSys inside ...
4
votes
Drawing fractals with Turtle
For each shape, you have this kind of code to generate the movement "recipe":
...
4
votes
Python Checkers
Performance
This is very inefficient:
def onGrid(x,y):
if((x in range(8)) and (y in range(8))):
return True
else:
return False
The ...
4
votes
Accepted
Python - Random Mandala
I don't know why you would want to shorten your code. It is already just 73 lines long (including the final blank line). Apart from that, "short" does not automatically mean "good". Maybe concise ...
4
votes
Accepted
Draw checker board
In essence, the code is well designed. You’ve split the code into simple, reusable functions and the logic is clear.
But there are still improvements to be made:
You relly on the global variable <...
4
votes
Sierpinski turtle triangle
I'm a python beginner,so at the moment I can only see that you can slightly improve your code using range in the function draw_polygon, so instead of
...
4
votes
Accepted
Sierpinski turtle triangle
Nice. I only have three comments.
In draw_polygon() use a for loop rather than an explicit counter:
...
3
votes
Symmetries of Triangle Python Turtle
Starting at the bottom of the code:
You don't have an if __name__ == '__main__': block. Unless things have changed in Python 3, you really ought to have one. (This ...
3
votes
Accepted
Python Pong using turtle
The major issues I see with your code are:
Use of while True: in an event driven environment. We need to put
the ball on a timer event instead.
The angle of ...
3
votes
Python Turtle based Pong game
First - You have numeric constants scattered all over the code.
Try to change the board width to 500 and you will immediately understand. Numeric constants like board width shall appear exactly once ...
3
votes
Accepted
Python Beginner - Basic Hangman Game Using Turtle
Relative file paths
WORDLIST_FILENAME = "E:/My Documents/Programming/Projects/Hangman/words.txt"
should be modified so that it's relative. The easy thing ...
3
votes
Python analog clock with turtle - runs slow
I found the correct way to optimize your code: the drawing code takes some time, so you should not wait 1 full second, but only wait until the time elapsed from the start of the loop is one second:
<...
3
votes
Accepted
Turtle language parser in python 3
The code is pretty small and straight-forward, I mainly see minor improvements. I find it somewhat strange that parse_file() is what calls on the main function, and ...
2
votes
Python Turtle based Pong game
Okay, thanks for fixing up the code. Now, to make it more pythonic, we need to move all the statements (not functions) into the entry point, which is a
...
2
votes
Accepted
Blackjack in Python (using Turtle)
There's good news and bad news.
For beginner code, this is fairly well written. The graphics are intuitive and the controls straightforward.
However, the site you've used (trinket.io) allows a kind ...
Mast♦
- 13.5k
2
votes
Python the Dragon's Curve with turtle
Here are some suggestions and remarks, in no particular order:
i is not a great name for a variable in most cases, and especially not when it's not short for "...
2
votes
Accepted
Turtle controller with simple instruction set
Classes (and functions) should ideally do one thing and do it well. The Python Zen also stipulates "There should be one-- and preferably only one --obvious way to do it."
Your class goes against this ...
2
votes
Sierpinski turtle triangle
Good luck in your learning, very nice start, i was much poorer in my begining! Viewing your code i suggest a structural change besides what @RootTwo and @dariosicily told.
The Spirit of Functions
...
2
votes
Simple (Very Easy to Make) RPG Game Simulation in Python and Turtle
One guiding principle in programming is to write DRY code, Don't Repeat Yourself. Your JediLuke class and your Orc class are ...
2
votes
Accepted
Symmetries of Triangle Python Turtle
I'm not an experienced user of either tkinter not turtle graphics, so I can't offer specific improvements with regards to those. I can offer some general Python advice though.
I like the Label class ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
turtle-graphics × 49python × 45
python-3.x × 12
game × 11
beginner × 10
fractals × 6
object-oriented × 4
tkinter × 4
homework × 3
java × 2
performance × 2
recursion × 2
random × 2
computational-geometry × 2
checkers-draughts × 2
algorithm × 1
python-2.x × 1
time-limit-exceeded × 1
mathematics × 1
tic-tac-toe × 1
api × 1
animation × 1
playing-cards × 1
timer × 1
graphics × 1