spkuehl / chess-clock Goto Github PK
View Code? Open in Web Editor NEWChess clock for adafruit featherboard with circuitpython
Chess clock for adafruit featherboard with circuitpython
Should always look xx:yy when it is paused, currently if stopped on an odd number it will look xxyy.
Link to adafruit 7 segment display instructions.
Add dependency information.
b
and s
are not good variables. I do not know appropriate names.
Initial main
while loop took me some time to understand. A comment makes its purpose clear.
I do not know how you start the clock. Looks like its by pressing s
button. Could this be dropped if first button starts the clock of other player? That's how I use existing clocks.
Following comments are about the current code. They do not reflect possible things that might be intended for future development.
Method get_display
in CountdownTimer
implies return value. It does not. Name should change to reflect no return.
Method get_display
has parameter time_left
. It is part of self
. Method does reference self. time_left
. Parameter could be dropped and use self. time_left
everywhere.
init
parameter: increment=0
may not be appropriate. Can a timer work with zero increment?
Line
Line 99 in 781a005
time_display
. It is not used. In IDE check for other unused variables.
In main
method, True loop has duplicate code. Design change could reduce duplicate code. Replace player_1
and player_2
with an array and two variables for active and paused index.
Change from while True:
to something that checks if the game is over.
Something like: while (player_1.flagged == False and player_2.flagged == False):
Add a pause button (need a new hardware button, could be the discussed in #5) to stop both timers.
To resume the game press the pause button again.
Line 32 in 06432c6
Design change could reduce duplicate code. Replace player_1 and player_2 with an array and two variables for active and paused index.
When the device boots up the first thing to do is configure and confirm game settings.
Could have 10+5 as the default.
In addition to software enhancements, there will probably need to be an additional button (select) added to the hardware.
54.43 not 54:43 to indicate 54 seconds.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.