Sponsored Content
Full Discussion: Simple Chess Clock
Top Forums Programming Simple Chess Clock Post 302928094 by junior-helper on Tuesday 9th of December 2014 12:50:52 AM
Old 12-09-2014
Code:
#!/bin/bash

menu () {
    printf "\n %s\n\n" "Duration (total): $durtot seconds, duration (last run): $durlr seconds"
    printf "    1 $startorcont     2 RESET    3 QUIT\n\n"
    printf " => "; read choice

    case "$choice" in
        1) time1=$(date '+%s')
            printf " Counting... Press ENTER to stop counting "; read blah
            time2=$(date '+%s'); durlr=$((time2-time1)); durtot=$((durtot + durlr))
            startorcont="CONTINUE" ;;
        2) durtot=0; durlr=0; startorcont="START   " ;;
        3) exit ;;
        *) echo "Invalid choice!" ;;
    esac
}

durtot=0
durlr=0
startorcont="START   "

while :; do
    menu
done

Above is my humble bash/GNU date approach. Hope I didn't miss the point.
 

5 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

chess perl program questions

Hello guys, While going over the book, I ran into this chess program and I have few questions 1) on line 40), why is not $chessboard-> ) ??? 40 unless (defined $chessboard->) { 2) 20 foreach my $i (reverse (0..7)) { #Row 1 #!/usr/bin/perl -w 2 # 3 # 4 5 ... (1 Reply)
Discussion started by: hankooknara
1 Replies

2. Forum Support Area for Unregistered Users & Account Problems

Chess at the UNIX Forums.

Just to let you know, we have installed Chess at the UNIX forums: Chess Club - The UNIX Forums (0 Replies)
Discussion started by: Neo
0 Replies

3. UNIX for Dummies Questions & Answers

A Simple Clock, Well Maybe Not That Simple...

The attachment says it all really... It is a DEMO at a glance digital readout using the "date" command to make it useful... For a Mocbook Pro 13", OSX 10.7.5, but may well work on Linux variants too. Enjoy... #!/bin/bash # # Clock.sh # A bash DEMO to create a 6 x 7 character set... (4 Replies)
Discussion started by: wisecracker
4 Replies

4. What is on Your Mind?

Chess Players: Which Online Resources (and Software) Do You Use and Why?

Hi Chess Players, Which Online Resources (and Software) Do You Use and Why? As for me, I use chessgames.com and chessbase.com; but currently I'm using chessgames.com the most; I like exploring openings in the chessgames.com opening explorer. For analysis on the desktop (Mac) or iPhone I... (8 Replies)
Discussion started by: Neo
8 Replies

5. What is on Your Mind?

How to Play Chess in Facebook Messenger

Have you ever wondered to play chess while you chat with your friends? Facebook has made this possible. FB keeps coming up with more and more new ideas for its users but this time it is a more intellectual one. Facebook has built a build-in-functionality in Facebook messenger, in which you just... (0 Replies)
Discussion started by: Neo
0 Replies
CLOCK(1)						      General Commands Manual							  CLOCK(1)

NAME
clock - display the time in an icon or window SYNOPSIS
clock AVAILABILITY
This command is available with the OpenWindows environment. For information about installing OpenWindows, refer to the OpenWindows Instal- lation and Start-Up Guide. DESCRIPTION
clock is an OpenWindows XView utility that displays the current time in a window or icon. When the window is open, clock can display the time in either analog or digital format. The clock window is scalable in either format. USAGE
When the clock window is open, it has a floating menu from which you can bring up a property window. From this property sheet, you can modify the display of the tool by selecting either the Analog or Digital choice box. Seconds: On the analog version, this selection starts a second hand on the face of the clock. On the digital version, it adds two dig- its to the digital readout. Date: Turns on a date display for both analog and digital versions of clock. BUGS
If you reset the system time, clock will not reflect the new time until you change its window state from open to icon, or vice versa. To reset the system time, see date (1V). The date display does not go well with the round clock face. Occasionally, when clock is uncovered, the face will be visually corrupted. Use the Refresh button from the frame menu to repair. 11 June 1990 CLOCK(1)
All times are GMT -4. The time now is 01:06 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy