Data update
This commit is contained in:
parent
8e4e15fa56
commit
72eb4943cb
1853 changed files with 35514 additions and 9441 deletions
38
Task/Semordnilap/FutureBasic/semordnilap.basic
Normal file
38
Task/Semordnilap/FutureBasic/semordnilap.basic
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
#plist NSAppTransportSecurity @{NSAllowsArbitraryLoads:YES}
|
||||
|
||||
local fn Dictionary as CFArrayRef
|
||||
CFURLRef url = fn URLWithString( @"http://wiki.puzzlers.org/pub/wordlists/unixdict.txt" )
|
||||
CFStringRef string = fn StringWithContentsOfURL( url, NSASCIIStringEncoding, NULL )
|
||||
end fn = fn StringComponentsSeparatedByCharactersInSet( string, fn CharacterSetNewlineSet )
|
||||
|
||||
local fn ReverseString( inString as CFStringRef ) as CFStringRef
|
||||
CFMutableStringRef outString = fn MutableStringNew
|
||||
for long index = len(inString) - 1 to 0 step -1
|
||||
MutableStringAppendString( outString, mid(inString,index,1) )
|
||||
next
|
||||
end fn = outString
|
||||
|
||||
void local fn Doit
|
||||
CFMutableArrayRef pairs = fn MutableArrayNew
|
||||
CFArrayRef words = fn Dictionary
|
||||
NSUInteger count = len(words), i, index
|
||||
for i = 0 to count - 2
|
||||
CFStringRef wd1 = words[i]
|
||||
CFStringRef wd2 = fn ReverseString( wd1 )
|
||||
index = fn ArrayIndexOfObjectInRange( words, wd2, fn CFRangeMake( i+1, count-(i+1) ) )
|
||||
if ( index != NSNotFound ) then MutableArrayAddObject( pairs, @{@"wd1":wd1,@"wd2":wd2} )
|
||||
next
|
||||
|
||||
text ,,,,, 60
|
||||
for i = 1 to 5
|
||||
count = len(pairs)
|
||||
index = rnd(count)-1
|
||||
CFDictionaryRef dict = pairs[index]
|
||||
print dict[@"wd1"],dict[@"wd2"]
|
||||
MutableArrayRemoveObjectAtIndex( pairs, index )
|
||||
next
|
||||
end fn
|
||||
|
||||
fn DoIt
|
||||
|
||||
HandleEvents
|
||||
Loading…
Add table
Add a link
Reference in a new issue