108 votes
Accepted

How clean is my snow?

Let's look at the code. from random import randrange import time Your imports are very minimal! Good. ...
Sjoerd Job Postmus's user avatar
61 votes

How clean is my snow?

Cool animation! Let's get some linting out of the way. As per PEP 8, you should use 4 spaces of indentation consistently, and function names should be snake_case. ...
200_success's user avatar
37 votes

How clean is my snow?

You don't get drops of snow! Clearly it should be for flake in flurry:
Loofer's user avatar
  • 615
33 votes
Accepted

Loading... animating dots in C

Too frenetic I ran your program but it was very frenetic. It was constantly clearing the "Loading" prompt and reprinting it which resulted in a flickering effect. In addition, the cursor also moved ...
JS1's user avatar
  • 28.5k
30 votes

How clean is my snow?

I'm surprised no one has talked about your character choice! Why are their a bunch of hashtags falling? Nah, I kid, it was an ok choice of character, but we can do better! What about changing the <...
Dair's user avatar
  • 5,824
21 votes

How clean is my snow?

def createRandomDrops(): dropCount = 4 for i in range(dropCount): Magic number 4 in middle of the code ...
Hurda's user avatar
  • 311
14 votes

Maze generator & animator in Python

This is a tip I make a lot, but if you have a collection that's simply tracking "membership", and you don't care about order, you should consider using a Set over a List. I think this is the case for ...
Carcigenicate's user avatar
12 votes

Loading... animating dots in C

You can get rid of that flickering green box by disabling the cursor. fputs("\e[?25l", stdout); /* hide the cursor */ If you want it back, you can re-enable it. ...
syb0rg's user avatar
  • 21.8k
12 votes
Accepted

Counting people inside the house game

You're right - there is a lot of duplication. Also, some organization is needed. Organize! Before you do anything else, get everything into a function of some kind. All those statements at module ...
aghast's user avatar
  • 12.3k
11 votes

"Star Catcher" game

Your code is good, but you have one massive oversight: It's hackable. Your code shouldn't be accessable from the Console. I would recommend using getters and setters to limit incorrect addition: <...
Quill's user avatar
  • 11.9k
10 votes

How clean is my snow?

from random import randrange I would suggest using import random Then in your code use ...
warvariuc's user avatar
  • 337
10 votes
Accepted

Human-like mouse movement

You can get much cleaner code and more readable code if you do 3 things: Use OOP and custom types to better encapsulate values Use more descriptive names Write more helper methods that encapsulate ...
Dan Oberlam's user avatar
  • 7,764
10 votes

Countdown control with arc animation

There are a couple of things which could be more consistent. ...
Peter Taylor's user avatar
  • 24.1k
8 votes
Accepted

A "C" shape of 7 boxes that turn green on click

This has "interview question" all over it :D Anyways. First, I'd avoid inline styles. The most common issue with inline styles is that they are hard to override. Only ...
Joseph's user avatar
  • 25k
8 votes

Loading... animating dots in C

I would probably tie this into whatever code is actually loading something, and print a new dot (or use a /-\| spinner) every 100 kb or whatever number makes, ...
Random832's user avatar
  • 366
7 votes

A "C" shape of 7 boxes that turn green on click

Throwing in the green flag if (box.style.backgroundColor !== 'green') { This string comparison isn't very efficient. By the looks of it, you are trying to use ...
SirPython's user avatar
  • 13.3k
7 votes

Loading... animating dots in C

Instead of the double for loop: one for dots and one for spaces, you could write combined one: ...
I'll add comments tomorrow's user avatar
7 votes

Countdown control with arc animation

1) DispatcherTimer is good for periodic UI updates, but it should not be used to measure time, because it is just not accurate enough. For precise time measurement ...
Nikita B's user avatar
  • 13k
6 votes

Parallax animation, running well on Chrome but slow on Safari

The major issue that I see in your code is that you keep requestAnimationFrame no matter what. This obviously causes the browser to update the css of the element at ...
Bruno Costa's user avatar
  • 5,566
6 votes

UIButton subclass with animated 'shimmer' effect

Okay, so sometimes posting a question is the best way to figure out an answer yourself 🙃. I was looking for an alternative to having the gradient colors evenly spaced (my hack was to repeat the ...
MathewS's user avatar
  • 653
6 votes

Interactive small town

JavaScript The loop that generates people - an expensive bridge to cross ”...DOM access is actually pretty costly - I think of it like if I have a bridge - like two pieces of land with a toll bridge, ...
Sᴀᴍ Onᴇᴌᴀ's user avatar
6 votes
Accepted

D3js: transition from stacked bar chart to bar chart with different datasets

Before dealing with the "enter", "update" and "exit" pattern, which is specific to D3, I'd like to address some general issues first. Do not mix jQuery and D3: this mix is normally unnecessary. Not ...
Gerardo Furtado's user avatar
6 votes

Counting people inside the house game

I noticed that you are repeating some of the code under animate_person_going_inside and `animate_person_going_outside functions. Also when rendering the text, some ...
alpha_989's user avatar
  • 215
6 votes
Accepted

Ring Timer Animation with Chasing Tail using CoreAnimation

There is one problem with your approach: Additional sublayers are added in draw() and in animateTimerReset() and never removed. ...
Martin R's user avatar
  • 23.1k
6 votes
Accepted

Time delay indication bar for a text game

You can use bar.count rather than your sum You can use ' ' * n, rather than your for loop. ...
Peilonrayz's user avatar
  • 42.7k
6 votes

Basic orbiting planets in P5.js

Use of p5.js and JavaScript Math is part of the standard JavaScript library. You shouldn't pollute its namespace with your own code, because it could interfere ...
200_success's user avatar
6 votes
Accepted

Sierpiński's carpet fractal animation for teaching Python 3

Algorithm You can simplify the code and make it run faster if you construct the next-level carpet by continuing to work on the previous image (punching more holes in it), rather than starting with a ...
200_success's user avatar
6 votes

Maze generator in Python- Gif animator-Custom colors/sizes

Type hints row_index, column_index, rows, columns I can guess that these are all int based on the docs. But adding ...
Reinderien's user avatar
6 votes

Bash script simple countdown timer with dotted output

Validate inputs The script quietly ignores invalid inputs. It would be good to add some validation logic and fail when used incorrectly. Since the counter* ...
janos's user avatar
  • 111k
5 votes
Accepted

Front End Web exercise, no HTML

There isn't much (that I see) to say about this code; it is mostly straightforward and easy to understand. Therefore, my review will be fairly short. Refactoring Take a look at your ...
SirPython's user avatar
  • 13.3k

Only top scored, non community-wiki answers of a minimum length are eligible