After numerous tries attempting to do a 1 Liner with colon the bas program hangs in checking file... before compile and Run:
[ You are not allowed to view this attachment ]
Here is what the abbreviated program looks like:
" 4761328509" in INSTR call was replaced by all permutations of 10 digits minus the ones starting with 0
created with this file:
_TITLE "All Digits 1 liner with colon Program Writer" 'B+ add value translator 2019-03-31 'from "Permutations wo recursion" translate from SmallBasic to QB64 2019-03-31
'from "Permutations" translation from: PowerBASIC, tsh copy from Liberty link 2017-02-04
' 2020-09-21 OK for a 2 Liner version of All Digits following up on Steve's ideas
' OK let's use a colon and not waste space in IDE ;-))
' 2020-09-22 That program got constantly got stuck in checking file, never compliled.
' So I used another permutation generator to write a DAT file that generates all the permutations of 10 digits.
' This program will open that file and skip down to line 362,881 which ends all permutations that start with 0
' and begins with permuations that start with 1. That cuts 1/10 of 3,628,810 permutations out from line which
' should make the program easier to check and run. Let's see...
' NOPE: again gets stuck checking the file, even with 10% less permutations in the string.
'here is the simple model of the line to write tested to make sure it did find 69
'1 n = n + 1: IF INSTR(" 4761328509", LEFT$(STR$(n * n) + _TRIM$(STR$(n ^ 3)) + SPC(9), 11)) THEN PRINT n, n ^ 2, n ^ 3 ELSE GOTO 1
' now replace " 4761328509" with All Permutations of 10 digits except those that start with 0
OPEN "All Digits 1 Liner with colon.bas" FOR OUTPUT AS #1 ' output .bas program file
PRINT #1, "1 n = n + 1: IF INSTR(" + CHR$(34);
i = i + 1
'IF i < 362890 THEN ' debugging tests
'ELSE ' debugging tests
'EXIT WHILE ' debugging tests
'END IF ' debugging tests
PRINT #1, CHR$(34) + ", LEFT$(STR$(n * n) + _TRIM$(STR$(n ^ 3)) + SPC(9), 11)) THEN PRINT n, n ^ 2, n ^ 3 ELSE GOTO 1" PRINT "Bas program file ready."
Attached is: 10 Digit Permutations.DAT file in case anyone else wants to take a shot at it. Might be handy for other things too.
Now you may well ask why the colon after saying no colons, well I didn't say no colons I said colons will count as extra lines, in this case this would be counted as a "2 Liner" but I just thought it would look cool to see only 1 line that says GOTO itself at the end of it. Oh well. In byte counts, colons count the same as CR + LF so there is that side of it too.
I think it's getting hung at INSTR with the extra-extra long literal string and would not be saved by actual 2 liner without colon.