Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
37
Task/Nautical-bell/Seed7/nautical-bell.seed7
Normal file
37
Task/Nautical-bell/Seed7/nautical-bell.seed7
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
$ include "seed7_05.s7i";
|
||||
include "time.s7i";
|
||||
include "duration.s7i";
|
||||
include "keybd.s7i";
|
||||
|
||||
const array string: watch is [] ("Middle", "Morning", "Forenoon", "Afternoon", "Dog", "First");
|
||||
const array string: bells is [] ("One Bell", "Two Bells", "Three Bells", "Four Bells", "Five Bells", "Six Bells", "Seven Bells", "Eight Bells");
|
||||
|
||||
const func time: truncToHalfHour (in time: aTime) is func
|
||||
result
|
||||
var time: truncatedTime is time.value;
|
||||
begin
|
||||
truncatedTime := aTime;
|
||||
truncatedTime.minute := aTime.minute div 30 * 30;
|
||||
truncatedTime.second := 0;
|
||||
truncatedTime.micro_second := 0;
|
||||
end func;
|
||||
|
||||
const proc: main is func
|
||||
local
|
||||
var time: nextTime is time.value;
|
||||
var time: midnight is time.value;
|
||||
var integer: minutes is 0;
|
||||
begin
|
||||
writeln;
|
||||
nextTime := truncToHalfHour(time(NOW));
|
||||
midnight := truncToDay(nextTime);
|
||||
while TRUE do
|
||||
nextTime +:= 30 . MINUTES;
|
||||
await(nextTime);
|
||||
minutes := toMinutes(nextTime - midnight);
|
||||
writeln(str_hh_mm(nextTime, ":") <& " - " <&
|
||||
watch[succ((minutes - 30) mdiv 240 mod 6)] <& " watch - " <&
|
||||
bells[succ((minutes - 30) mdiv 30 mod 8)] <& " Gone.");
|
||||
flush(OUT);
|
||||
end while;
|
||||
end func;
|
||||
Loading…
Add table
Add a link
Reference in a new issue