ABC problem: Difference between revisions

m
Line 4,518:
include "NSLog.incl"
 
local fn CanSpellCanBlocksSpell( w as CFStringRef ) as CFStringRef
NSUInteger i, j, length i, countj
CFStringRef cFinal = @"", result = @"YESNO"
Boolean letterFound
CFMutableArrayRef blocks
CFStringRef result = @"YES"
CFArrayRef blocks = @[@[@"B",fn @"O"],MutableArrayWithArray( @[@"XBO", @"KXK"], @[@"D", @"Q"], @[@"CDQ", @"PCP"]
@[@"NNA", @"AGT"], @[@"GRE", @"TTG"], @[@"RQD", @"EFS"], @[@"TJW", @"G"], @[@"Q", @"D"], @[@"FHU", @"SVI"]
@[@"JAN", @"WOB"], @[@"H", @"U"], @[@"VER", @"IFS"], @[@"ALY", @"NPC"], @[@"O", @"BZM"], @[@"E", @"R"],¬)
@[@"F", @"S"], @[@"L", @"Y"], @[@"P", @"C"], @[@"Z", @"M"]]
CFStringRef testWordcfStr = fn StringUppercaseString( w )
NSUInteger length = fn StringLength( cfStr )
lengthNSUInteger count = fn StringLengthArrayCount( testWordblocks )
count = fn ArrayCount( blocks )
for i = 0 to length - 1
letterFound = NO
for j = 0 to count - 1
CFStringRef subStringcharStr = mid( testWordcfStr, i, 1 )
CFStringRef compareStr = fn ArrayObjectAtIndex( blocks, j )
// NSLog( @"%@\n", subString )
CFArrayRefCFStringRef testStr1 tempArr = fn ArrayObjectAtIndexmid( blockscompareStr, 0, j1 )
NSLog(CFStringRef @"%@;testStr2 %@ %@",= subStringmid( compareStr, tempArr[0]1, tempArr[1] )
if not( letterFound andfn StringIsEqual( subStringcharStr, == tempArr[0]testStr1 ) or ( substring == tempArr[1]YES )
cFinal = fn StringByAppendingString( cFinal, testStr1 ) : MutableArrayReplaceObjectAtIndex( blocks, @" ", j ) : exit for
//tempArr[0] = -1
end //tempArr[1] = -1if
if ( letterFoundfn StringIsEqual( charStr, testStr2 ) == YES )
cFinal = fn StringByAppendingString( cFinal, testStr2 ) : MutableArrayReplaceObjectAtIndex( blocks, @" ", j ) : exit for
end if
next
if ( not letterFound ) then result = @"NO" : exit fn
next
if fn StringIsEqual( cFinal, cfStr ) == YES then result = @"YES"
end fn = result
 
NSLog( @"a: Can blocks spell? %@", fn CanBlocksSpell( @"a" ) )
 
NSLog( @"aBark: Can blocks spell? %@\n", fn CanSpellCanBlocksSpell( @"aBark" ) )
NSLog( @"BarkBOOK: Can blocks spell? %@\n", fn CanSpellCanBlocksSpell( @"BarkBOOK" ) )
NSLog( @"bOokTrEaT: Can blocks spell? %@\n", fn CanSpellCanBlocksSpell( @"bOokTrEaT" ) )
NSLog( @"treatCOMMON: Can blocks spell? %@\n", fn CanSpellCanBlocksSpell( @"treatCOMMON" ) )
NSLog( @"COMMONSquad: Can blocks spell? %@\n", fn CanSpellCanBlocksSpell( @"COMMONSquad" ) )
NSLog( @"squadconFUse: Can blocks spell? %@\n", fn CanSpellCanBlocksSpell( @"squadconFUse" ) )
NSLog( @"cnfuse: %@\n", fn CanSpell( @"cnfuse" ) )
 
 
HandleEvents
715

edits