51
Tutorials and articles / Re: Luiji's Tiny BASIC Compiler
« Last post by Cybermonkey on August 31, 2019, 10:15:12 AM »Here's the link to github:
https://github.com/Luiji/TinyBASIC-C
https://github.com/Luiji/TinyBASIC-C
window TITLE "All Digits Multiplication Galileo mod of B+ 25/01/2019"
'// Display all multiplications of two numbers such that,
' between the multiplicants and the result are represented once and only once each digit in the decimal system.
'// Developed in Yabasic by Galileo, 01/2019
' iBASIC conversion of Galileo, 08/2019 (http://ibasic.arredemo.org/download.htm)
FOR a = 1 TO 99
FOR b = 1 TO 9999
IF call(haveAllDigits(TRIM$(STR$(a)) + TRIM$(STR$(b)) + TRIM$(STR$(a * b)))) = true AND a < b THEN PRINT a; "*"; b; "="; a * b
NEXT
NEXT
input chr$(10)+"Press ENTER to exit",a$
end
procedure haveAllDigits (in a$) returns r
la = LEN(a$)
IF la <> 10 THEN endproc
allDigits$ = "0123456789"
FOR i = 1 TO la
p = INSTR(allDigits$, a$[i])
IF p THEN allDigits$[p] = "" ELSE endproc
NEXT
r = true
ENDproc
Case-sensitive sorts are now over 20% faster