Skip to main content
36 votes

Car crash reaction time

Some of the numbers might seem plucked out of thin air but they aren't Still better have them explained. I can understand 3.6 and even ...
vnp's user avatar
  • 58.7k
18 votes

Car crash reaction time

I suggest breaking the code into functions, so you can easily import your code into a Python shell and test that your computation is exact (and not just thinking it ...
301_Moved_Permanently's user avatar
17 votes
Accepted

Extremely simple timer class in C++

Keep solid picture of usage in your head When creating a library, it is extremely important to always keep the intended usage in mind. If the usage syntax is disgusting, it is better to think of a ...
Incomputable's user avatar
  • 9,724
16 votes
Accepted

Progress Bar in C++

I wrote a simple main() function to test this: int main() { show_progress_bar(100, "progress", '#'); } I ...
Toby Speight's user avatar
  • 88.3k
13 votes

Car crash reaction time

It crashes if user input for speed_ms is not integer If user presses any key before t = input("GO!! ") his reaction time is ...
Lau's user avatar
  • 231
12 votes

Car crash reaction time

If it's wet, the friction_coefficient will be lower. Which means that Bd will be lower (which is probably wrong). It's ...
Reinstate Monica's user avatar
12 votes

Car crash reaction time

player_1 is read and assigned but never used. If the user misspells wet (e.g. as Wet or as <...
Toby Speight's user avatar
  • 88.3k
10 votes
Accepted

Stopwatch class

First off, the obligatory recommendation that you use System.Diagnostics.StopWatch for this purpose, and not DateTime.Now (or ...
VisualMelon's user avatar
  • 7,581
10 votes

Stopwatch class

Good effort. A few small points, with lots of links to my blog along the way. namespace Stopwatch { public class Stopwatch { Never name a class the ...
Eric Lippert's user avatar
10 votes

Countdown control with arc animation

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

Stopwatch class

You have done well. You have created a class for the Stopwatch which only responsibility is just exactly what a Stopwatch should do : Start, Stop and calculate the duration. What I don't like are ...
Heslacher's user avatar
  • 51k
8 votes
Accepted

A simple stop watch which I want to extend

Don't use member variables for temporary storage Your class Timer has a member variable mvSession, which is unnecessary. It is ...
G. Sliepen's user avatar
  • 69.2k
8 votes
Accepted

Digital clock with Python Tkinter

To start, it's crucial that you stop creating a brand new label ten times a second. Just modify the existing one. Also, this is so simple that a class is not called for. Move as much as possible away ...
Reinderien's user avatar
  • 71.1k
7 votes
Accepted

CHIP-8 delay timer in C++

When doing emulation you should disconnect from the real world and only provide a abstract view to a world. In other words don't use a real time clock instead simulate the timer by linking it to the ...
ratchet freak's user avatar
7 votes
Accepted

Async friendly Timer

The API would really benefit from some inline documentation (///), but mostly looks good. Threading I'm no expert but it looks fine to me. The only thing that is ...
VisualMelon's user avatar
  • 7,581
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
  • 13.1k
7 votes

Countdown Timer in Python

Before entering into the meat of the answer, let's talk about time accuracy for a bit. For starter, time.sleep is not extremely accurate as it can be (a little bit)...
301_Moved_Permanently's user avatar
7 votes

Productivity/Timer app that uses twilio to send SMS-reminders

Ways of improving: work_time and break_time as constant values deserve to be defined as CONSTANTS ...
RomanPerekhrest's user avatar
7 votes

Productivity/Timer app that uses twilio to send SMS-reminders

RomanPerekhrest has brought up several good points that you should definitely follow. One point that was not mentioned however, is the recursive way you call your ...
AlexV's user avatar
  • 7,363
7 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 ...
Reinderien's user avatar
  • 71.1k
7 votes
Accepted

Heartbeats per minute in vanilla HTML JS

You have an off-by-one error! Notice that even if you tap a steady beat, the display will initially show a high bpm before asymptotically settling down to something approximating the correct value. ...
200_success's user avatar
7 votes
Accepted

This is a simple stopwatch cli application with a few options

Check the return value of library functions From the man page: signal() returns the previous value of the signal handler. On failure, it returns SIG_ERR, and errno is set to indicate the error. ...
Madagascar's user avatar
  • 10.1k
6 votes

Stopwatch class

You did actually very well, hovewer there's one major problem that would make your class unusable in production environment. Don't forget the DateTime.Now is a ...
vasek's user avatar
  • 284
6 votes
Accepted

Three versions of a counting-up timer in JavaScript

Performance is not a significant concern, since all three callbacks have very little code, and they execute only once per second. Rather, you should aim for clarity. In my opinion, Version 1 is ...
200_success's user avatar
6 votes
Accepted

Pausable Timer Implementation for SDL in C

I don't see too much that I feel like complaining about. Standard Types In timer.h, you use Uint32. This is not a standard type. It comes from SDL, which in turn ...
Reinderien's user avatar
  • 71.1k
6 votes
Accepted

Safe Dispose of Timer

Review property Interval and methods ExternalStart, ExternalStart should throw ...
dfhwze's user avatar
  • 14.2k
6 votes

Tick. Tick. *breathe* BOOM! - Setting up real, stable asynchronous callbacks with WinAPI Timers in VBA

First I'd like to say that this is impressive work, overall pretty squeaky clean... despite the adjustments needed to make it build on x64 :) One enhancement I can see in terms of readability, would ...
Mathieu Guindon's user avatar
6 votes

Time duration conversion with units

Looks pretty good; these comments are mainly nitpicking: Error messages should be streamed to std::cerr, not std::cout. Whilst ...
Toby Speight's user avatar
  • 88.3k
6 votes
Accepted

Time duration conversion with units

Avoid defining your own constants There's no need to use your own constants for the duration of a millisecond, second, minute and so on; just use the right ...
G. Sliepen's user avatar
  • 69.2k
6 votes

Templatizing a Timer class

Time warp Anything but std::chrono::steady_clock does not guarantee being monotonic and ticks having more-or-less constant time between them as time moves forward. ...
Incomputable's user avatar
  • 9,724

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