Update all new Tasks
This commit is contained in:
parent
00a190b0a6
commit
91df62d461
5697 changed files with 93386 additions and 804 deletions
44
Task/ABC-Problem/FBSL/abc-problem.fbsl
Normal file
44
Task/ABC-Problem/FBSL/abc-problem.fbsl
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
#APPTYPE CONSOLE
|
||||
SUB MAIN()
|
||||
BlockCheck("A")
|
||||
BlockCheck("BARK")
|
||||
BlockCheck("BooK")
|
||||
BlockCheck("TrEaT")
|
||||
BlockCheck("comMON")
|
||||
BlockCheck("sQuAd")
|
||||
BlockCheck("Confuse")
|
||||
pause
|
||||
END SUB
|
||||
|
||||
FUNCTION BlockCheck(str)
|
||||
print str " " iif( Blockable( str ), "can", "cannot" ) " be spelled with blocks."
|
||||
END FUNCTION
|
||||
|
||||
FUNCTION Blockable(str AS STRING)
|
||||
DIM blocks AS STRING = "BOXKDQCPNAGTRETGQDFSJWHUVIANOBERFSLYPCZM"
|
||||
DIM C AS STRING = ""
|
||||
DIM POS AS INTEGER = 0
|
||||
|
||||
FOR DIM I = 1 TO LEN(str)
|
||||
C = str{i}
|
||||
POS = INSTR(BLOCKS, C, 0, 1) 'case insensitive
|
||||
IF POS > 0 THEN
|
||||
'if the pos is odd, it's the first of the pair
|
||||
IF POS MOD 2 = 1 THEN
|
||||
'so clear the first and the second
|
||||
poke(@blocks + pos - 1," ")
|
||||
poke(@blocks + pos," ")
|
||||
'otherwise, it's the last of the pair
|
||||
ELSE
|
||||
'clear the second and the first
|
||||
poke(@blocks + pos - 1," ")
|
||||
poke(@blocks + pos - 2," ")
|
||||
END IF
|
||||
ELSE
|
||||
'not found, so can't be spelled
|
||||
RETURN FALSE
|
||||
END IF
|
||||
NEXT
|
||||
'got thru to here, so can be spelled
|
||||
RETURN TRUE
|
||||
END FUNCTION
|
||||
Loading…
Add table
Add a link
Reference in a new issue