for the full @/swapcoding experience, i need to be able to measure time spent coding. i found a neater way to do it than using a dumb chess clock. do this:
source <(curl -s https://iio.ie/gittime)
this installs two functions into the current shell. then the workflow in the game is the following:
gitstart function when your turn begins.
git commit with a reasonable message when your turn ends.
gittime function at the end of the game to get a summary of the time spent.
works in both bash and zsh.
gitstart just commits an empty commit with start as the sole commit message.
gittime then simply adds up the time between the commits except for the start commits.
the full source of the script is this:
loading... (needs javascript, check the js console for errors if this is not loading)
the output looks something like this:
min task --- ---- 3 initial project setup with source code and makefiles 7 create the game state structures 11 render the state into a nice interface 6 add colors to the interface 5 advance the state based on user prompt 8 detect end of game state and quit total time: 0 h 40 m
the min column represents the elapsed minutes for the given task.
so i had the opportunity to try swapcoding with a friend. we both created a simple terminal tic-tac-toe game. it had a nice, colorful terminal interface, an optimal ai player, player hints, etc. the experience was super fun and we achieved much more than i initially expected. it's something i totally want to try again. we did it without a clock but we really missed it. so i came up with this easy to share hack for the next time.
Published on 2022-08-21.
Add new comment:
(Adding a new comment or reply requires javascript.)