104 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. ...
59 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. ...
37 votes

How clean is my snow?

You don't get drops of snow! Clearly it should be for flake in flurry:
  • 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 ...
  • 28.4k
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 <...
  • 5,754
20 votes

How clean is my snow?

def createRandomDrops(): dropCount = 4 for i in range(dropCount): Magic number 4 in middle of the code ...
  • 301
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 ...
13 votes
Accepted

A flashing ! exclamation ! point ! bar

I'm just a beginner myself but I feel like I can point out a few things in this code. First, I would add some white space at the top of the file here: ...
  • 8,579
12 votes
Accepted

Making a square move counter-clockwise around the edge

After looking thoroughly at your code, I found a bug. Please be sure this is intended behavior, and if not, fix it. In reverseDirection, you have this: ...
  • 22.2k
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. ...
  • 21.7k
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 ...
  • 12.2k
11 votes
Accepted

Bouncing stacking boxes

if (this.velocity > dampening) { this.velocity -= dampening; } else { this.velocity = 0; } this.velocity = -this.velocity; Seems like you could use ...
  • 22.2k
11 votes
Accepted

Slot Machine Constructor

You have a bug/basic misunderstanding of JS syntax: You can't do chained comparisons in JavaScript, so none of the if(x > num < z) lines work the way you ...
  • 32.9k
11 votes
Accepted

Console-like printing of message JavaScript

Your code is really easy to understand, and there's not much wrong with it. I promise I'll go easy on you. Right on the first lines, something bothers me... You have this: ...
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: <...
  • 11.9k
10 votes
Accepted

Simple random falling object animation in Java

Here is my list of possible improvements: Constants should be made final and if possible also private ...
10 votes

How clean is my snow?

from random import randrange I would suggest using import random Then in your code use ...
  • 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 ...
  • 7,673
10 votes

Countdown control with arc animation

There are a couple of things which could be more consistent. ...
9 votes
Accepted

A Nightmare on setTimeout Street

To generate those nested, nearly identical setTimeout calls, instead of coding them all manually you could have a recursive function that builds and returns a ...
  • 1,308
8 votes

Slot Machine Constructor

Your indentation is all out of whack; in some places, you have unnecessary indenation, and in others you don't have necessary indentation. For example, in the ...
  • 13.2k
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 ...
  • 24.8k
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, ...
  • 366
7 votes
Accepted

A partially overlapping sequence of jQuery animations

@Paritosh has suggested some code to change what you have done, but doesn't explain it at all. The suggestion is that you use a loop ...
  • 28.5k
7 votes

Slot Machine Constructor

Random Issues This seems bad: ...
  • 8,579
7 votes

jQuery plugin to cycle through text and "typewrite" it out

The API design is rather weird. You expect your plugin to be called like $().typeText({ selector: '.words' }) But a design like this would be much more natural ...
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 ...
  • 13.2k
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: ...
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 ...
  • 13k
6 votes

CSS3 transitions performance enhancement

I'm pretty new to CSS, but I do have a few notes: As @Jivings said, the animation worked nicely for me. No stutter or anything. I would use Font Awesome instead of your envelope ...
  • 21.7k

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