Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Return to Question

Commonmark migration
Source Link

I'd like you to build me a clock that displays time in this format:

18 ----------
19 --------------------------------------------------

This displays '18:10'. The current hour and the next hour are shown at the front of the line, followed by a space and a number of dashes: on the first line the number of minutes that have passed in this hour, and the second line shows how many more minutes to go in this hour.

#To clarify

To clarify

  • The clock should display the system's time. If fetching the time from another source is more convenient, that's fine too. It may not be supplied as input.
  • At 18:00, the top line is just 18 (Trailing spaces allowed but not required)
  • At 18:59, the bottom line is 19 -
  • The hours < 10 are either pre-padded with a 0 (01 -----) or right-aligned ( 1 -----). A left-aligned single digit is not allowed, not even if the dashes start at the right place (1 ----- is invalid).
  • The clock should display the hours in a 24h-format.
  • Although it's called the 24h format, there is not actually a 24 on it. During the 23rd hour, the second line starts with 00 or 0.
  • The display needs to be updated at least once a minute, but that doesn't have to happen at exactly 00 seconds. You may update more frequently / continuously if that is more convenient, but the result must of course still be legible - not one smear all over the screen.

#Input

Input

None.

#Output

Output

  • As described above. Trailing spaces to pad the clock to 60-ish positions is allowed on both lines, a trailing newline is also allowed.
  • The screen needs to be cleared when displaying the next minute: either with a clear-screen command or by adding no less than 30 newlines.

#Additional rules

Additional rules

I'd like you to build me a clock that displays time in this format:

18 ----------
19 --------------------------------------------------

This displays '18:10'. The current hour and the next hour are shown at the front of the line, followed by a space and a number of dashes: on the first line the number of minutes that have passed in this hour, and the second line shows how many more minutes to go in this hour.

#To clarify

  • The clock should display the system's time. If fetching the time from another source is more convenient, that's fine too. It may not be supplied as input.
  • At 18:00, the top line is just 18 (Trailing spaces allowed but not required)
  • At 18:59, the bottom line is 19 -
  • The hours < 10 are either pre-padded with a 0 (01 -----) or right-aligned ( 1 -----). A left-aligned single digit is not allowed, not even if the dashes start at the right place (1 ----- is invalid).
  • The clock should display the hours in a 24h-format.
  • Although it's called the 24h format, there is not actually a 24 on it. During the 23rd hour, the second line starts with 00 or 0.
  • The display needs to be updated at least once a minute, but that doesn't have to happen at exactly 00 seconds. You may update more frequently / continuously if that is more convenient, but the result must of course still be legible - not one smear all over the screen.

#Input

None.

#Output

  • As described above. Trailing spaces to pad the clock to 60-ish positions is allowed on both lines, a trailing newline is also allowed.
  • The screen needs to be cleared when displaying the next minute: either with a clear-screen command or by adding no less than 30 newlines.

#Additional rules

I'd like you to build me a clock that displays time in this format:

18 ----------
19 --------------------------------------------------

This displays '18:10'. The current hour and the next hour are shown at the front of the line, followed by a space and a number of dashes: on the first line the number of minutes that have passed in this hour, and the second line shows how many more minutes to go in this hour.

To clarify

  • The clock should display the system's time. If fetching the time from another source is more convenient, that's fine too. It may not be supplied as input.
  • At 18:00, the top line is just 18 (Trailing spaces allowed but not required)
  • At 18:59, the bottom line is 19 -
  • The hours < 10 are either pre-padded with a 0 (01 -----) or right-aligned ( 1 -----). A left-aligned single digit is not allowed, not even if the dashes start at the right place (1 ----- is invalid).
  • The clock should display the hours in a 24h-format.
  • Although it's called the 24h format, there is not actually a 24 on it. During the 23rd hour, the second line starts with 00 or 0.
  • The display needs to be updated at least once a minute, but that doesn't have to happen at exactly 00 seconds. You may update more frequently / continuously if that is more convenient, but the result must of course still be legible - not one smear all over the screen.

Input

None.

Output

  • As described above. Trailing spaces to pad the clock to 60-ish positions is allowed on both lines, a trailing newline is also allowed.
  • The screen needs to be cleared when displaying the next minute: either with a clear-screen command or by adding no less than 30 newlines.

Additional rules

support leading spaces
Source Link
Erik the Outgolfer
  • 40.8k
  • 5
  • 46
  • 125

I'd like you to build me a clock that displays time in this format:

18 ----------
19 --------------------------------------------------

This displays '18:10'. The current hour and the next hour are shown at the front of the line, followed by a space and a number of dashes: on the first line the number of minutes that have passed in this hour, and the second line shows how many more minutes to go in this hour.

#To clarify

  • The clock should display the system's time. If fetching the time from another source is more convenient, that's fine too. It may not be supplied as input.
  • At 18:00, the top line is just 18 (Trailing spaces allowed but not required)
  • At 18:59, the bottom line is 19 -
  • The hours < 10 are either pre-padded with a 0 (01 -----) or right-aligned ( 1 -----). A left-aligned single digit is not allowed, not even if the dashes start at the right place (1 ----- is invalid).
  • The clock should display the hours in a 24h-format.
  • Although it's called the 24h format, there is not actually a 24 on it. During the 23rd hour, the second line starts with 00 or 0.
  • The display needs to be updated at least once a minute, but that doesn't have to happen at exactly 00 seconds. You may update more frequently / continuously if that is more convenient, but the result must of course still be legible - not one smear all over the screen.

#Input

None.

#Output

  • As described above. Trailing spaces to pad the clock to 60-ish positions is allowed on both lines, a trailing newline is also allowed.
  • The screen needs to be cleared when displaying the next minute: either with a clear-screen command or by adding no less than 30 newlines.

#Additional rules

I'd like you to build me a clock that displays time in this format:

18 ----------
19 --------------------------------------------------

This displays '18:10'. The current hour and the next hour are shown at the front of the line, followed by a space and a number of dashes: on the first line the number of minutes that have passed in this hour, and the second line shows how many more minutes to go in this hour.

#To clarify

  • The clock should display the system's time. If fetching the time from another source is more convenient, that's fine too. It may not be supplied as input.
  • At 18:00, the top line is just 18 (Trailing spaces allowed but not required)
  • At 18:59, the bottom line is 19 -
  • The hours < 10 are either pre-padded with a 0 (01 -----) or right-aligned ( 1 -----). A left-aligned single digit is not allowed, not even if the dashes start at the right place (1 ----- is invalid).
  • The clock should display the hours in a 24h-format.
  • Although it's called the 24h format, there is not actually a 24 on it. During the 23rd hour, the second line starts with 00 or 0.
  • The display needs to be updated at least once a minute, but that doesn't have to happen at exactly 00 seconds. You may update more frequently / continuously if that is more convenient, but the result must of course still be legible - not one smear all over the screen.

#Input

None.

#Output

  • As described above. Trailing spaces to pad the clock to 60-ish positions is allowed on both lines, a trailing newline is also allowed.
  • The screen needs to be cleared when displaying the next minute: either with a clear-screen command or by adding no less than 30 newlines.

#Additional rules

I'd like you to build me a clock that displays time in this format:

18 ----------
19 --------------------------------------------------

This displays '18:10'. The current hour and the next hour are shown at the front of the line, followed by a space and a number of dashes: on the first line the number of minutes that have passed in this hour, and the second line shows how many more minutes to go in this hour.

#To clarify

  • The clock should display the system's time. If fetching the time from another source is more convenient, that's fine too. It may not be supplied as input.
  • At 18:00, the top line is just 18 (Trailing spaces allowed but not required)
  • At 18:59, the bottom line is 19 -
  • The hours < 10 are either pre-padded with a 0 (01 -----) or right-aligned ( 1 -----). A left-aligned single digit is not allowed, not even if the dashes start at the right place (1 ----- is invalid).
  • The clock should display the hours in a 24h-format.
  • Although it's called the 24h format, there is not actually a 24 on it. During the 23rd hour, the second line starts with 00 or 0.
  • The display needs to be updated at least once a minute, but that doesn't have to happen at exactly 00 seconds. You may update more frequently / continuously if that is more convenient, but the result must of course still be legible - not one smear all over the screen.

#Input

None.

#Output

  • As described above. Trailing spaces to pad the clock to 60-ish positions is allowed on both lines, a trailing newline is also allowed.
  • The screen needs to be cleared when displaying the next minute: either with a clear-screen command or by adding no less than 30 newlines.

#Additional rules

added 140 characters in body
Source Link
steenbergh
  • 8.2k
  • 1
  • 27
  • 43

I'd like you to build me a clock that displays time in this format:

18 ----------
19 --------------------------------------------------

This displays '18:10'. The current hour and the next hour are shown at the front of the line, followed by a space and a number of dashes: on the first line the number of minutes that have passed in this hour, and the second line shows how many more minutes to go in this hour.

#To clarify

  • The clock should display the system's time. If fetching the time from another source is more convenient, that's fine too. It may not be supplied as input.
  • At 18:00, the top line is just 18 (Trailing spaces allowed but not required)
  • At 18:59, the bottom line is 19 -
  • The hours < 10 are either pre-padded with a 0 (01 -----) or right-aligned ( 1 -----). A left-aligned single digit is not allowed, not even if the dashes start at the right place (1 ----- is invalid).
  • The clock should display the hours in a 24h-format.
  • Although it's called the 24h format, there is not actually a 24 on it. During the 23rd hour, the second line starts with 00 or 0.
  • The display needs to be updated at least once a minute, but that doesn't have to happen at exactly 00 seconds. You may update more frequently / continuously if that is more convenient, but the result must of course still be legible - not one smear all over the screen.

#Input

None.

#Output

  • As described above. Trailing spaces to pad the clock to 60-ish positions is allowed on both lines, a trailing newline is also allowed.
  • The screen needs to be cleared when displaying the next minute: either with a clear-screen command or by adding no less than 30 newlines.

#Additional rules

I'd like you to build me a clock that displays time in this format:

18 ----------
19 --------------------------------------------------

This displays '18:10'. The current hour and the next hour are shown at the front of the line, followed by a space and a number of dashes: on the first line the number of minutes that have passed in this hour, and the second line shows how many more minutes to go in this hour.

#To clarify

  • The clock should display the system's time. If fetching the time from another source is more convenient, that's fine too. It may not be supplied as input.
  • At 18:00, the top line is just 18 (Trailing spaces allowed but not required)
  • At 18:59, the bottom line is 19 -
  • The hours < 10 are either pre-padded with a 0 (01 -----) or right-aligned ( 1 -----). A left-aligned single digit is not allowed, not even if the dashes start at the right place (1 ----- is invalid).
  • The clock should display the hours in a 24h-format.
  • The display needs to be updated at least once a minute, but that doesn't have to happen at exactly 00 seconds. You may update more frequently / continuously if that is more convenient, but the result must of course still be legible - not one smear all over the screen.

#Input

None.

#Output

  • As described above. Trailing spaces to pad the clock to 60-ish positions is allowed on both lines, a trailing newline is also allowed.
  • The screen needs to be cleared when displaying the next minute: either with a clear-screen command or by adding no less than 30 newlines.

#Additional rules

I'd like you to build me a clock that displays time in this format:

18 ----------
19 --------------------------------------------------

This displays '18:10'. The current hour and the next hour are shown at the front of the line, followed by a space and a number of dashes: on the first line the number of minutes that have passed in this hour, and the second line shows how many more minutes to go in this hour.

#To clarify

  • The clock should display the system's time. If fetching the time from another source is more convenient, that's fine too. It may not be supplied as input.
  • At 18:00, the top line is just 18 (Trailing spaces allowed but not required)
  • At 18:59, the bottom line is 19 -
  • The hours < 10 are either pre-padded with a 0 (01 -----) or right-aligned ( 1 -----). A left-aligned single digit is not allowed, not even if the dashes start at the right place (1 ----- is invalid).
  • The clock should display the hours in a 24h-format.
  • Although it's called the 24h format, there is not actually a 24 on it. During the 23rd hour, the second line starts with 00 or 0.
  • The display needs to be updated at least once a minute, but that doesn't have to happen at exactly 00 seconds. You may update more frequently / continuously if that is more convenient, but the result must of course still be legible - not one smear all over the screen.

#Input

None.

#Output

  • As described above. Trailing spaces to pad the clock to 60-ish positions is allowed on both lines, a trailing newline is also allowed.
  • The screen needs to be cleared when displaying the next minute: either with a clear-screen command or by adding no less than 30 newlines.

#Additional rules

added 166 characters in body
Source Link
steenbergh
  • 8.2k
  • 1
  • 27
  • 43
Loading
Tweeted twitter.com/StackCodeGolf/status/821395688961507328
edited tags
Link
DJMcMayhem
  • 60.1k
  • 18
  • 203
  • 352
Loading
Source Link
steenbergh
  • 8.2k
  • 1
  • 27
  • 43
Loading

AltStyle によって変換されたページ (->オリジナル) /