Data update
This commit is contained in:
parent
81fd053722
commit
52a6ef48dd
10248 changed files with 63654 additions and 6775 deletions
28
Task/ABC-problem/EMal/abc-problem.emal
Normal file
28
Task/ABC-problem/EMal/abc-problem.emal
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
List words ← text["", "A", "Bark", "book", "TREAT", "COMMON", "SQuAd", "CONFUSE"]
|
||||
List checks ← logic[true, true, true, false, true, false, true, true]
|
||||
fun canMakeWord ← logic by text word
|
||||
if word.length æ 0 do return true end
|
||||
List wblocks ← text[
|
||||
"BO", "XK", "DQ", "CP", "NA",
|
||||
"GT", "RE", "TG", "QD", "FS",
|
||||
"JW", "HU", "VI", "AN", "OB",
|
||||
"ER", "FS", "LY", "PC", "ZM"]
|
||||
for each text ch in word.upper().split()
|
||||
logic found ← false
|
||||
for each text wblock in wblocks
|
||||
if wblock.find(ch) ≥ 0
|
||||
wblocks[wblockIndex] ← Text.EMPTY
|
||||
found ← true
|
||||
break
|
||||
end
|
||||
end
|
||||
if not found do return false end
|
||||
end
|
||||
return true
|
||||
end
|
||||
writeLine("word".padEnd(11, " "), "|", "canMakeWord", "|", "isCorrect")
|
||||
for each text word in words
|
||||
writeLine(word.padEnd(11, " "), "|",
|
||||
(text!canMakeWord(word)).padEnd(11, " "), "|",
|
||||
(canMakeWord(word) æ checks[wordIndex]))
|
||||
end
|
||||
|
|
@ -1,30 +1,26 @@
|
|||
include "NSLog.incl"
|
||||
|
||||
local fn CanBlocksSpell( w as CFStringRef ) as CFStringRef
|
||||
NSUInteger i, j
|
||||
CFStringRef s = @"", t1, t2 : if fn StringIsEqual( w, @"" ) then exit fn = @"YES" else w = ucase(w)
|
||||
long i, j
|
||||
CFStringRef s = @"", t1, t2 : if fn StringIsEqual( w, @"" ) then exit fn = @"YES" else w = ucase(w)
|
||||
|
||||
mda(0) = {@"BO",@"XK",@"DQ",@"CP",@"NA",@"GT",@"RE",@"TG",@"QD",¬
|
||||
@"FS",@"JW",@"HU",@"VI",@"AN",@"OB",@"ER",@"FS",@"LY",@"PC",@"ZM"}
|
||||
mda(0) = {@"BO",@"XK",@"DQ",@"CP",@"NA",@"GT",@"RE",@"TG",@"QD",¬
|
||||
@"FS",@"JW",@"HU",@"VI",@"AN",@"OB",@"ER",@"FS",@"LY",@"PC",@"ZM"}
|
||||
|
||||
for i = 0 to len(w) - 1
|
||||
for j = 0 to mda_count - 1
|
||||
t1 = mid( mda(j), 0, 1 ) : t2 = mid( mda(j), 1, 1 )
|
||||
if ( fn StringIsEqual( mid( w, i, 1 ), t1 ) ) then s = fn StringByAppendingString( s, t1 ) : mda(j) = @" " : break
|
||||
if ( fn StringIsEqual( mid( w, i, 1 ), t2 ) ) then s = fn StringByAppendingString( s, t2 ) : mda(j) = @" " : break
|
||||
next
|
||||
next
|
||||
if fn StringIsEqual( s, w ) then exit fn = @"YES"
|
||||
for i = 0 to len(w) - 1
|
||||
for j = 0 to mda_count - 1
|
||||
t1 = mid( mda(j), 0, 1 ) : t2 = mid( mda(j), 1, 1 )
|
||||
if ( fn StringIsEqual( mid( w, i, 1 ), t1 ) ) then s = fn StringByAppendingString( s, t1 ) : mda(j) = @" " : break
|
||||
if ( fn StringIsEqual( mid( w, i, 1 ), t2 ) ) then s = fn StringByAppendingString( s, t2 ) : mda(j) = @" " : break
|
||||
next
|
||||
next
|
||||
if fn StringIsEqual( s, w ) then exit fn = @"YES"
|
||||
end fn = @"NO"
|
||||
|
||||
NSUInteger i
|
||||
long i
|
||||
CFArrayRef words
|
||||
CFStringRef w
|
||||
words = @[@"", @"a",@"Bark",@"BOOK",@"TrEaT",@"COMMON",@"Squad",@"conFUse",@"ABBA",@"aUtO"]
|
||||
for w in words
|
||||
printf @"Can blocks spell %7s : %@", fn StringUTF8String( w ), fn CanBlocksSpell( w )
|
||||
printf @"Can blocks spell %7s : %@", fn StringUTF8String( w ), fn CanBlocksSpell( w )
|
||||
next
|
||||
|
||||
NSLog( @"%@", fn WindowPrintViewString( 1 ) )
|
||||
|
||||
HandleEvents
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ local fn blocks( wordList as str255 )
|
|||
found = instr$( 1, blocks, ch )
|
||||
select found
|
||||
case > 3: mid$( blocks, found and -2, 2 ) = "__" : text , , fn ColorYellow
|
||||
rect fill ( x, y + 5.5, 15, 15 ), fn ColorBrown
|
||||
rect fill ( x, y + 1, 15, 15 ), fn ColorBrown
|
||||
case 0: text , , fn ColorLightGray
|
||||
case < 4: blocks=" ,;BOXKDQCPNAGTRETGQDFSJWHUVIANOBERFSLYPCZM": x=3: y+=26: ch=""
|
||||
end select
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue