##QBIC , (削除) 82 (削除ここまで) 72 bytes
QBIC , (削除) 82 (削除ここまで) 72 bytes
:[0,23|[0,59|[0,59|~b+c+d=a|?!b$+@:`+right$(@0`+!c,2ドル)+A+right$(B+!d,2ドル)
This hits an unfortunate spot in QBasic, with casting to number, trimming and prepending a 0 when necessary is really costly.
Sample output:
Command line: 119
1:59:59
2:58:59
2:59:58
3:57:59
[... SNIP 270 lines ...]
23:58:38
23:59:37
(削除) Explanation (削除ここまで) I wrote a novel about it:
: Get N, call it 'a'
[0,23| Loop through the hours; this FOR loop is initialised with 2 parameters
using a comma to separate FROM and TO, and a '|' to delimit the argument list
[0,59| Same for the minutes
[0,59| And the seconds
QBIC automatically creates variables to use as loop-counters:
b, c, d (a was already taken by ':')
~b+c+d=a IF a == b+c+d
| THEN
? PRINT
! CAST
b 'b'
$ To String; casting num to str in QBasic adds a space, this is trimmed in QBIC
+@:` Create string A,ドル containing ":"
+right$ This is a QBasic function, but since it's all lowercase (and '$' is
not a function in QBIC) it remains unaltered in the resulting QBasic.
(@0`+!c,2ドル) Pad the minutes by prepending a 0, then taking the rightmost 2 characters.
+A Remember that semicolon in A$? Add it again
+right$ Same for the seconds
(B+!d,2ドル) Reusing the 0-string saves 2 bytes :-)
##QBIC , (削除) 82 (削除ここまで) 72 bytes
:[0,23|[0,59|[0,59|~b+c+d=a|?!b$+@:`+right$(@0`+!c,2ドル)+A+right$(B+!d,2ドル)
This hits an unfortunate spot in QBasic, with casting to number, trimming and prepending a 0 when necessary is really costly.
Sample output:
Command line: 119
1:59:59
2:58:59
2:59:58
3:57:59
[... SNIP 270 lines ...]
23:58:38
23:59:37
(削除) Explanation (削除ここまで) I wrote a novel about it:
: Get N, call it 'a'
[0,23| Loop through the hours; this FOR loop is initialised with 2 parameters
using a comma to separate FROM and TO, and a '|' to delimit the argument list
[0,59| Same for the minutes
[0,59| And the seconds
QBIC automatically creates variables to use as loop-counters:
b, c, d (a was already taken by ':')
~b+c+d=a IF a == b+c+d
| THEN
? PRINT
! CAST
b 'b'
$ To String; casting num to str in QBasic adds a space, this is trimmed in QBIC
+@:` Create string A,ドル containing ":"
+right$ This is a QBasic function, but since it's all lowercase (and '$' is
not a function in QBIC) it remains unaltered in the resulting QBasic.
(@0`+!c,2ドル) Pad the minutes by prepending a 0, then taking the rightmost 2 characters.
+A Remember that semicolon in A$? Add it again
+right$ Same for the seconds
(B+!d,2ドル) Reusing the 0-string saves 2 bytes :-)
QBIC , (削除) 82 (削除ここまで) 72 bytes
:[0,23|[0,59|[0,59|~b+c+d=a|?!b$+@:`+right$(@0`+!c,2ドル)+A+right$(B+!d,2ドル)
This hits an unfortunate spot in QBasic, with casting to number, trimming and prepending a 0 when necessary is really costly.
Sample output:
Command line: 119
1:59:59
2:58:59
2:59:58
3:57:59
[... SNIP 270 lines ...]
23:58:38
23:59:37
(削除) Explanation (削除ここまで) I wrote a novel about it:
: Get N, call it 'a'
[0,23| Loop through the hours; this FOR loop is initialised with 2 parameters
using a comma to separate FROM and TO, and a '|' to delimit the argument list
[0,59| Same for the minutes
[0,59| And the seconds
QBIC automatically creates variables to use as loop-counters:
b, c, d (a was already taken by ':')
~b+c+d=a IF a == b+c+d
| THEN
? PRINT
! CAST
b 'b'
$ To String; casting num to str in QBasic adds a space, this is trimmed in QBIC
+@:` Create string A,ドル containing ":"
+right$ This is a QBasic function, but since it's all lowercase (and '$' is
not a function in QBIC) it remains unaltered in the resulting QBasic.
(@0`+!c,2ドル) Pad the minutes by prepending a 0, then taking the rightmost 2 characters.
+A Remember that semicolon in A$? Add it again
+right$ Same for the seconds
(B+!d,2ドル) Reusing the 0-string saves 2 bytes :-)
- 8.2k
- 1
- 27
- 43
##QBIC, (削除) 82 (削除ここまで) 6672 bytes
:[23|[59|[59|~b+c+d=a|[0,23|[0,59|[0,59|~b+c+d=a|?!b$+@:`+right$(@0`+!c,2ドル)+A+right$(B+!d,2ドル)
This hits an unfortunate spot in QBasic, with casting to number, trimming and prepending a 0 when necessary is really costly.
Sample output:
Command line: 119
1:59:59
2:58:59
2:59:58
3:57:59
[... SNIP 270 lines ...]
23:58:38
23:59:37
(削除) Explanation (削除ここまで) I wrote a novel about it:
: Get N, call it 'a'
[0,23| Loop through the hours; this FOR loop is initialised with 2 parameters
using a comma to separate FROM and TO, and a '|' to delimit the argument list
[0,59| Same for the minutes
[0,59| And the seconds
QBIC automatically creates variables to use as loop-counters:
b, c, d (a was already taken by ':')
~b+c+d=a IF a == b+c+d
| THEN
? PRINT
! CAST
b 'b'
$ To String; casting num to str in QBasic adds a space, this is trimmed in QBIC
+@:` Create string A,ドル containing ":"
+right$ This is a QBasic function, but since it's all lowercase (and '$' is
not a function in QBIC) it remains unaltered in the resulting QBasic.
(@0`+!c,2ドル) Pad the minutes by prepending a 0, then taking the rightmost 2 characters.
+A Remember that semicolon in A$? Add it again
+right$ Same for the seconds
(B+!d,2ドル) Reusing the 0-string saves 2 bytes :-)
##QBIC, (削除) 82 (削除ここまで) 66 bytes
:[23|[59|[59|~b+c+d=a|?!b$+@:`+right$(@0`+!c,2ドル)+A+right$(B+!d,2ドル)
This hits an unfortunate spot in QBasic, with casting to number, trimming and prepending a 0 when necessary is really costly.
Sample output:
Command line: 119
1:59:59
2:58:59
2:59:58
3:57:59
[... SNIP 270 lines ...]
23:58:38
23:59:37
(削除) Explanation (削除ここまで) I wrote a novel about it:
: Get N, call it 'a'
[0,23| Loop through the hours; this FOR loop is initialised with 2 parameters
using a comma to separate FROM and TO, and a '|' to delimit the argument list
[0,59| Same for the minutes
[0,59| And the seconds
QBIC automatically creates variables to use as loop-counters:
b, c, d (a was already taken by ':')
~b+c+d=a IF a == b+c+d
| THEN
? PRINT
! CAST
b 'b'
$ To String; casting num to str in QBasic adds a space, this is trimmed in QBIC
+@:` Create string A,ドル containing ":"
+right$ This is a QBasic function, but since it's all lowercase (and '$' is
not a function in QBIC) it remains unaltered in the resulting QBasic.
(@0`+!c,2ドル) Pad the minutes by prepending a 0, then taking the rightmost 2 characters.
+A Remember that semicolon in A$? Add it again
+right$ Same for the seconds
(B+!d,2ドル) Reusing the 0-string saves 2 bytes :-)
##QBIC, (削除) 82 (削除ここまで) 72 bytes
:[0,23|[0,59|[0,59|~b+c+d=a|?!b$+@:`+right$(@0`+!c,2ドル)+A+right$(B+!d,2ドル)
This hits an unfortunate spot in QBasic, with casting to number, trimming and prepending a 0 when necessary is really costly.
Sample output:
Command line: 119
1:59:59
2:58:59
2:59:58
3:57:59
[... SNIP 270 lines ...]
23:58:38
23:59:37
(削除) Explanation (削除ここまで) I wrote a novel about it:
: Get N, call it 'a'
[0,23| Loop through the hours; this FOR loop is initialised with 2 parameters
using a comma to separate FROM and TO, and a '|' to delimit the argument list
[0,59| Same for the minutes
[0,59| And the seconds
QBIC automatically creates variables to use as loop-counters:
b, c, d (a was already taken by ':')
~b+c+d=a IF a == b+c+d
| THEN
? PRINT
! CAST
b 'b'
$ To String; casting num to str in QBasic adds a space, this is trimmed in QBIC
+@:` Create string A,ドル containing ":"
+right$ This is a QBasic function, but since it's all lowercase (and '$' is
not a function in QBIC) it remains unaltered in the resulting QBasic.
(@0`+!c,2ドル) Pad the minutes by prepending a 0, then taking the rightmost 2 characters.
+A Remember that semicolon in A$? Add it again
+right$ Same for the seconds
(B+!d,2ドル) Reusing the 0-string saves 2 bytes :-)
##QBIC, 82(削除) 82 (削除ここまで) 66 bytes
:[0,23|[0,59|[0,59|~b+c+d=a|[23|[59|[59|~b+c+d=a|?!b$`+"b$+@:"+right$`+right$("0"+`@0`+!c$`c$,2)+":"+right$+A+right$("0"+`B+!d$`d$,2)`
This hits an unfortunate spot in QBasic, with casting to number, trimming and prepending a 0 when necessary is really costly.
Sample output:
Command line: 119
1:59:59
2:58:59
2:59:58
3:57:59
[... SNIP 270 lines ...]
23:58:38
23:59:37(削除) Explanation (削除ここまで) I wrote a novel about it:
: Get N, call it 'a'
[0,23| Loop through the hours; this FOR loop is initialised with 2 parameters
using a comma to separate FROM and TO, and a '|' to delimit the argument list
[0,59| Same for the minutes
[0,59| And the seconds
QBIC automatically creates variables to use as loop-counters:
b, c, d (a was already taken by ':')
~b+c+d=a IF a == b+c+d
| THEN
? PRINT
! CAST
b 'b'
$ To String; casting num to str in QBasic adds a space, this is trimmed in QBIC
+@:` Create string A,ドル containing ":"
+right$ This is a QBasic function, but since it's all lowercase (and '$' is
not a function in QBIC) it remains unaltered in the resulting QBasic.
(@0`+!c,2ドル) Pad the minutes by prepending a 0, then taking the rightmost 2 characters.
+A Remember that semicolon in A$? Add it again
+right$ Same for the seconds
(B+!d,2ドル) Reusing the 0-string saves 2 bytes :-)
##QBIC, 82 bytes
:[0,23|[0,59|[0,59|~b+c+d=a|?!b$`+":"+right$("0"+`!c$`,2)+":"+right$("0"+`!d$`,2)`
This hits an unfortunate spot in QBasic, with casting to number, trimming and prepending a 0 when necessary is really costly.
Sample output:
Command line: 119
1:59:59
2:58:59
2:59:58
3:57:59
[... SNIP 270 lines ...]
23:58:38
23:59:37
##QBIC, (削除) 82 (削除ここまで) 66 bytes
:[23|[59|[59|~b+c+d=a|?!b$+@:`+right$(@0`+!c$,2)+A+right$(B+!d$,2)
This hits an unfortunate spot in QBasic, with casting to number, trimming and prepending a 0 when necessary is really costly.
Sample output:
Command line: 119
1:59:59
2:58:59
2:59:58
3:57:59
[... SNIP 270 lines ...]
23:58:38
23:59:37(削除) Explanation (削除ここまで) I wrote a novel about it:
: Get N, call it 'a'
[0,23| Loop through the hours; this FOR loop is initialised with 2 parameters
using a comma to separate FROM and TO, and a '|' to delimit the argument list
[0,59| Same for the minutes
[0,59| And the seconds
QBIC automatically creates variables to use as loop-counters:
b, c, d (a was already taken by ':')
~b+c+d=a IF a == b+c+d
| THEN
? PRINT
! CAST
b 'b'
$ To String; casting num to str in QBasic adds a space, this is trimmed in QBIC
+@:` Create string A,ドル containing ":"
+right$ This is a QBasic function, but since it's all lowercase (and '$' is
not a function in QBIC) it remains unaltered in the resulting QBasic.
(@0`+!c,2ドル) Pad the minutes by prepending a 0, then taking the rightmost 2 characters.
+A Remember that semicolon in A$? Add it again
+right$ Same for the seconds
(B+!d,2ドル) Reusing the 0-string saves 2 bytes :-)