Removing the extra dictionary tool because it's not really needed. Instead, we will...
authorRobert Sesek <rsesek@bluestatic.org>
Thu, 22 May 2008 01:30:12 +0000 (21:30 -0400)
committerRobert Sesek <rsesek@bluestatic.org>
Thu, 22 May 2008 01:30:12 +0000 (21:30 -0400)
* Dictionary/dictionary.txt: Moved ..
* Dictionary/: Removed
* dictionary.ka: Removed
* Source/AppController.h: Making the dictionary ivar mutable
* Source/AppController.m:
(-[init]): Load the words from dictionary.txt
(-[findWords:]): Still a broken algorithm, but making progress

Dictionary/Dictionary.m [deleted file]
Dictionary/Dictionary.xcodeproj/.gitignore [deleted file]
Dictionary/Dictionary.xcodeproj/project.pbxproj [deleted file]
Dictionary/Dictionary_Prefix.pch [deleted file]
Scrabbalize.xcodeproj/project.pbxproj
Source/AppController.h
Source/AppController.m
dictionary.ka [deleted file]
dictionary.txt [moved from Dictionary/dictionary.txt with 100% similarity]

diff --git a/Dictionary/Dictionary.m b/Dictionary/Dictionary.m
deleted file mode 100644 (file)
index d70daff..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Scrabbalize
- * Copyright (c) 2007, Blue Static <http://www.bluestatic.org>
- * 
- * This program is free software; you can redistribute it and/or modify it under the terms of the GNU 
- * General Public License as published by the Free Software Foundation; either version 2 of the 
- * License, or (at your option) any later version.
- * 
- * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without 
- * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
- * General Public License for more details.
- * 
- * You should have received a copy of the GNU General Public License along with this program; if not, 
- * write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- */
-
-#import <Foundation/Foundation.h>
-#import "Word.h"
-
-int main (int argc, const char * argv[]) 
-{
-       NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
-       
-       if (argc != 2)
-       {
-               printf("This utility takes in a list of words separated by new lines and creates a keyed archive with them. \n");
-               printf("Usage: dictionary <file.txt>\n");
-               return 1;
-       }
-       
-       NSString *file = [NSString stringWithContentsOfFile:[NSString stringWithUTF8String:argv[1]]];
-       file = [file stringByReplacingOccurrencesOfString:@"\r\n" withString:@"\n"];
-       file = [file stringByReplacingOccurrencesOfString:@"\r" withString:@"\n"];
-       
-       NSArray *strings = [file componentsSeparatedByString:@"\n"];
-       NSMutableArray *words = [[NSMutableArray alloc] init];
-       for (int i = 0; i < [strings count]; i++)
-       {
-               NSString *str = [strings objectAtIndex:i];
-               Word *word = [[Word alloc] initWithWord:str];
-               [words addObject:word];
-               [word release];
-       }
-       
-       BOOL result = [NSKeyedArchiver archiveRootObject:words toFile:@"dictionary.ka"];
-       if (result)
-       {
-               printf("Created the dictionary archive.\n");
-       }
-       else
-       {
-               printf("There was an error in archiving the dictionary. Sorry.\n");
-       }
-       
-       [pool drain];
-       return 0;
-}
diff --git a/Dictionary/Dictionary.xcodeproj/.gitignore b/Dictionary/Dictionary.xcodeproj/.gitignore
deleted file mode 100644 (file)
index 985f576..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-*.perspectivev3
-*.perspective
-*.pbxuser
\ No newline at end of file
diff --git a/Dictionary/Dictionary.xcodeproj/project.pbxproj b/Dictionary/Dictionary.xcodeproj/project.pbxproj
deleted file mode 100644 (file)
index 7e0bc84..0000000
+++ /dev/null
@@ -1,226 +0,0 @@
-// !$*UTF8*$!
-{
-       archiveVersion = 1;
-       classes = {
-       };
-       objectVersion = 44;
-       objects = {
-
-/* Begin PBXBuildFile section */
-               1EB0367F0DE319BE00880828 /* Word.m in Sources */ = {isa = PBXBuildFile; fileRef = 1EB0367D0DE319BE00880828 /* Word.m */; };
-               8DD76F9A0486AA7600D96B5E /* Dictionary.m in Sources */ = {isa = PBXBuildFile; fileRef = 08FB7796FE84155DC02AAC07 /* Dictionary.m */; settings = {ATTRIBUTES = (); }; };
-               8DD76F9C0486AA7600D96B5E /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 08FB779EFE84155DC02AAC07 /* Foundation.framework */; };
-               8DD76F9F0486AA7600D96B5E /* Dictionary.1 in CopyFiles */ = {isa = PBXBuildFile; fileRef = C6859EA3029092ED04C91782 /* Dictionary.1 */; };
-/* End PBXBuildFile section */
-
-/* Begin PBXCopyFilesBuildPhase section */
-               8DD76F9E0486AA7600D96B5E /* CopyFiles */ = {
-                       isa = PBXCopyFilesBuildPhase;
-                       buildActionMask = 8;
-                       dstPath = /usr/share/man/man1/;
-                       dstSubfolderSpec = 0;
-                       files = (
-                               8DD76F9F0486AA7600D96B5E /* Dictionary.1 in CopyFiles */,
-                       );
-                       runOnlyForDeploymentPostprocessing = 1;
-               };
-/* End PBXCopyFilesBuildPhase section */
-
-/* Begin PBXFileReference section */
-               08FB7796FE84155DC02AAC07 /* Dictionary.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Dictionary.m; sourceTree = "<group>"; };
-               08FB779EFE84155DC02AAC07 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = "<absolute>"; };
-               1EB0367D0DE319BE00880828 /* Word.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = Word.m; path = ../Source/Word.m; sourceTree = SOURCE_ROOT; };
-               1EB0367E0DE319BE00880828 /* Word.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Word.h; path = ../Source/Word.h; sourceTree = SOURCE_ROOT; };
-               32A70AAB03705E1F00C91783 /* Dictionary_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Dictionary_Prefix.pch; sourceTree = "<group>"; };
-               8DD76FA10486AA7600D96B5E /* Dictionary */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = Dictionary; sourceTree = BUILT_PRODUCTS_DIR; };
-               C6859EA3029092ED04C91782 /* Dictionary.1 */ = {isa = PBXFileReference; lastKnownFileType = text.man; path = Dictionary.1; sourceTree = "<group>"; };
-/* End PBXFileReference section */
-
-/* Begin PBXFrameworksBuildPhase section */
-               8DD76F9B0486AA7600D96B5E /* Frameworks */ = {
-                       isa = PBXFrameworksBuildPhase;
-                       buildActionMask = 2147483647;
-                       files = (
-                               8DD76F9C0486AA7600D96B5E /* Foundation.framework in Frameworks */,
-                       );
-                       runOnlyForDeploymentPostprocessing = 0;
-               };
-/* End PBXFrameworksBuildPhase section */
-
-/* Begin PBXGroup section */
-               08FB7794FE84155DC02AAC07 /* Dictionary */ = {
-                       isa = PBXGroup;
-                       children = (
-                               08FB7795FE84155DC02AAC07 /* Source */,
-                               C6859EA2029092E104C91782 /* Documentation */,
-                               08FB779DFE84155DC02AAC07 /* External Frameworks and Libraries */,
-                               1AB674ADFE9D54B511CA2CBB /* Products */,
-                       );
-                       name = Dictionary;
-                       sourceTree = "<group>";
-               };
-               08FB7795FE84155DC02AAC07 /* Source */ = {
-                       isa = PBXGroup;
-                       children = (
-                               32A70AAB03705E1F00C91783 /* Dictionary_Prefix.pch */,
-                               08FB7796FE84155DC02AAC07 /* Dictionary.m */,
-                               1EB0367D0DE319BE00880828 /* Word.m */,
-                               1EB0367E0DE319BE00880828 /* Word.h */,
-                       );
-                       name = Source;
-                       sourceTree = "<group>";
-               };
-               08FB779DFE84155DC02AAC07 /* External Frameworks and Libraries */ = {
-                       isa = PBXGroup;
-                       children = (
-                               08FB779EFE84155DC02AAC07 /* Foundation.framework */,
-                       );
-                       name = "External Frameworks and Libraries";
-                       sourceTree = "<group>";
-               };
-               1AB674ADFE9D54B511CA2CBB /* Products */ = {
-                       isa = PBXGroup;
-                       children = (
-                               8DD76FA10486AA7600D96B5E /* Dictionary */,
-                       );
-                       name = Products;
-                       sourceTree = "<group>";
-               };
-               C6859EA2029092E104C91782 /* Documentation */ = {
-                       isa = PBXGroup;
-                       children = (
-                               C6859EA3029092ED04C91782 /* Dictionary.1 */,
-                       );
-                       name = Documentation;
-                       sourceTree = "<group>";
-               };
-/* End PBXGroup section */
-
-/* Begin PBXNativeTarget section */
-               8DD76F960486AA7600D96B5E /* Dictionary */ = {
-                       isa = PBXNativeTarget;
-                       buildConfigurationList = 1DEB927408733DD40010E9CD /* Build configuration list for PBXNativeTarget "Dictionary" */;
-                       buildPhases = (
-                               8DD76F990486AA7600D96B5E /* Sources */,
-                               8DD76F9B0486AA7600D96B5E /* Frameworks */,
-                               8DD76F9E0486AA7600D96B5E /* CopyFiles */,
-                       );
-                       buildRules = (
-                       );
-                       dependencies = (
-                       );
-                       name = Dictionary;
-                       productInstallPath = "$(HOME)/bin";
-                       productName = Dictionary;
-                       productReference = 8DD76FA10486AA7600D96B5E /* Dictionary */;
-                       productType = "com.apple.product-type.tool";
-               };
-/* End PBXNativeTarget section */
-
-/* Begin PBXProject section */
-               08FB7793FE84155DC02AAC07 /* Project object */ = {
-                       isa = PBXProject;
-                       buildConfigurationList = 1DEB927808733DD40010E9CD /* Build configuration list for PBXProject "Dictionary" */;
-                       compatibilityVersion = "Xcode 3.0";
-                       hasScannedForEncodings = 1;
-                       mainGroup = 08FB7794FE84155DC02AAC07 /* Dictionary */;
-                       projectDirPath = "";
-                       projectRoot = "";
-                       targets = (
-                               8DD76F960486AA7600D96B5E /* Dictionary */,
-                       );
-               };
-/* End PBXProject section */
-
-/* Begin PBXSourcesBuildPhase section */
-               8DD76F990486AA7600D96B5E /* Sources */ = {
-                       isa = PBXSourcesBuildPhase;
-                       buildActionMask = 2147483647;
-                       files = (
-                               8DD76F9A0486AA7600D96B5E /* Dictionary.m in Sources */,
-                               1EB0367F0DE319BE00880828 /* Word.m in Sources */,
-                       );
-                       runOnlyForDeploymentPostprocessing = 0;
-               };
-/* End PBXSourcesBuildPhase section */
-
-/* Begin XCBuildConfiguration section */
-               1DEB927508733DD40010E9CD /* Debug */ = {
-                       isa = XCBuildConfiguration;
-                       buildSettings = {
-                               COPY_PHASE_STRIP = NO;
-                               GCC_DYNAMIC_NO_PIC = NO;
-                               GCC_ENABLE_FIX_AND_CONTINUE = YES;
-                               GCC_MODEL_TUNING = G5;
-                               GCC_OPTIMIZATION_LEVEL = 0;
-                               GCC_PRECOMPILE_PREFIX_HEADER = YES;
-                               GCC_PREFIX_HEADER = Dictionary_Prefix.pch;
-                               INSTALL_PATH = /usr/local/bin;
-                               PRODUCT_NAME = Dictionary;
-                               ZERO_LINK = YES;
-                       };
-                       name = Debug;
-               };
-               1DEB927608733DD40010E9CD /* Release */ = {
-                       isa = XCBuildConfiguration;
-                       buildSettings = {
-                               DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
-                               GCC_MODEL_TUNING = G5;
-                               GCC_PRECOMPILE_PREFIX_HEADER = YES;
-                               GCC_PREFIX_HEADER = Dictionary_Prefix.pch;
-                               INSTALL_PATH = /usr/local/bin;
-                               PRODUCT_NAME = Dictionary;
-                       };
-                       name = Release;
-               };
-               1DEB927908733DD40010E9CD /* Debug */ = {
-                       isa = XCBuildConfiguration;
-                       buildSettings = {
-                               GCC_C_LANGUAGE_STANDARD = c99;
-                               GCC_WARN_ABOUT_RETURN_TYPE = YES;
-                               GCC_WARN_UNUSED_VARIABLE = YES;
-                               PREBINDING = NO;
-                               SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.5.sdk";
-                       };
-                       name = Debug;
-               };
-               1DEB927A08733DD40010E9CD /* Release */ = {
-                       isa = XCBuildConfiguration;
-                       buildSettings = {
-                               ARCHS = (
-                                       ppc,
-                                       i386,
-                               );
-                               GCC_C_LANGUAGE_STANDARD = c99;
-                               GCC_WARN_ABOUT_RETURN_TYPE = YES;
-                               GCC_WARN_UNUSED_VARIABLE = YES;
-                               PREBINDING = NO;
-                               SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.5.sdk";
-                       };
-                       name = Release;
-               };
-/* End XCBuildConfiguration section */
-
-/* Begin XCConfigurationList section */
-               1DEB927408733DD40010E9CD /* Build configuration list for PBXNativeTarget "Dictionary" */ = {
-                       isa = XCConfigurationList;
-                       buildConfigurations = (
-                               1DEB927508733DD40010E9CD /* Debug */,
-                               1DEB927608733DD40010E9CD /* Release */,
-                       );
-                       defaultConfigurationIsVisible = 0;
-                       defaultConfigurationName = Release;
-               };
-               1DEB927808733DD40010E9CD /* Build configuration list for PBXProject "Dictionary" */ = {
-                       isa = XCConfigurationList;
-                       buildConfigurations = (
-                               1DEB927908733DD40010E9CD /* Debug */,
-                               1DEB927A08733DD40010E9CD /* Release */,
-                       );
-                       defaultConfigurationIsVisible = 0;
-                       defaultConfigurationName = Release;
-               };
-/* End XCConfigurationList section */
-       };
-       rootObject = 08FB7793FE84155DC02AAC07 /* Project object */;
-}
diff --git a/Dictionary/Dictionary_Prefix.pch b/Dictionary/Dictionary_Prefix.pch
deleted file mode 100644 (file)
index 721058b..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- * Scrabbalize
- * Copyright (c) 2007, Blue Static <http://www.bluestatic.org>
- * 
- * This program is free software; you can redistribute it and/or modify it under the terms of the GNU 
- * General Public License as published by the Free Software Foundation; either version 2 of the 
- * License, or (at your option) any later version.
- * 
- * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without 
- * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
- * General Public License for more details.
- * 
- * You should have received a copy of the GNU General Public License along with this program; if not, 
- * write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- */
-
-#ifdef __OBJC__
-    #import <Foundation/Foundation.h>
-#endif
index d5f49da8c2ddb484154ede6eda38a9989a3c86cd..29550171b0176aa71b69d01b13f54793cb0e7336 100644 (file)
@@ -7,7 +7,7 @@
        objects = {
 
 /* Begin PBXBuildFile section */
-               1EAAC7970D16E9950058A23D /* dictionary.ka in Resources */ = {isa = PBXBuildFile; fileRef = 1EAAC7960D16E9950058A23D /* dictionary.ka */; };
+               1E1231A30DE502CE00A60AF5 /* dictionary.txt in Resources */ = {isa = PBXBuildFile; fileRef = 1E1231A20DE502CE00A60AF5 /* dictionary.txt */; };
                1EAAC79B0D16E9CE0058A23D /* AppController.m in Sources */ = {isa = PBXBuildFile; fileRef = 1EAAC79A0D16E9CE0058A23D /* AppController.m */; };
                1EAAC8420D16F4A40058A23D /* Word.m in Sources */ = {isa = PBXBuildFile; fileRef = 1EAAC8410D16F4A40058A23D /* Word.m */; };
                1EAAC93C0D17129D0058A23D /* NSStringAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = 1EAAC93B0D17129D0058A23D /* NSStringAdditions.m */; };
@@ -22,7 +22,7 @@
                089C165DFE840E0CC02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = "<group>"; };
                1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; };
                13E42FB307B3F0F600E4EEF1 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = /System/Library/Frameworks/CoreData.framework; sourceTree = "<absolute>"; };
-               1EAAC7960D16E9950058A23D /* dictionary.ka */ = {isa = PBXFileReference; lastKnownFileType = file.bplist; path = dictionary.ka; sourceTree = "<group>"; };
+               1E1231A20DE502CE00A60AF5 /* dictionary.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = dictionary.txt; sourceTree = "<group>"; };
                1EAAC7990D16E9CE0058A23D /* AppController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppController.h; path = Source/AppController.h; sourceTree = "<group>"; };
                1EAAC79A0D16E9CE0058A23D /* AppController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AppController.m; path = Source/AppController.m; sourceTree = "<group>"; };
                1EAAC8400D16F4A40058A23D /* Word.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Word.h; path = Source/Word.h; sourceTree = "<group>"; };
                        isa = PBXGroup;
                        children = (
                                1EC5B65F0D1CDCAA007D1D24 /* Scrabbalize.icns */,
-                               1EAAC7960D16E9950058A23D /* dictionary.ka */,
+                               1E1231A20DE502CE00A60AF5 /* dictionary.txt */,
                                8D1107310486CEB800E47090 /* Info.plist */,
                                089C165CFE840E0CC02AAC07 /* InfoPlist.strings */,
                                29B97318FDCFA39411CA2CEA /* MainMenu.nib */,
                        files = (
                                8D11072A0486CEB800E47090 /* MainMenu.nib in Resources */,
                                8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */,
-                               1EAAC7970D16E9950058A23D /* dictionary.ka in Resources */,
                                1EC5B6600D1CDCAA007D1D24 /* Scrabbalize.icns in Resources */,
+                               1E1231A30DE502CE00A60AF5 /* dictionary.txt in Resources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
index 6c8a057b12b92c1bb3b46d88aa094b9187a03a0d..11ad7efa7e8b40f78b317c4579bb7604b83e3cd9 100644 (file)
@@ -19,7 +19,7 @@
 
 @interface AppController : NSObject
 {
-       NSArray *dictionary;
+       NSMutableArray *dictionary;
        
        // interface
        IBOutlet NSTextField *tilesField;
index a6541fe7d5113c5ce49b5b8c465271d55c7b8fda..35c0850e446b90de8f2a6483b315afe003e362ba 100644 (file)
 {
        if (self = [super init])
        {
-               NSString *path = [NSString stringWithFormat:@"%@/dictionary.ka", [[NSBundle mainBundle] resourcePath]];
-               dictionary = [NSKeyedUnarchiver unarchiveObjectWithFile:path];
+               NSString *path = [NSString stringWithFormat:@"%@/dictionary.txt", [[NSBundle mainBundle] resourcePath]];
+               NSString *file = [NSString stringWithContentsOfFile:path];
+               NSArray *strings = [file componentsSeparatedByString:@"\n"];
+               
+               dictionary = [[NSMutableArray alloc] init];
+               for (int i = 0; i < [strings count]; i++)
+               {
+                       NSString *str = [strings objectAtIndex:i];
+                       Word *word = [[Word alloc] initWithWord:str];
+                       [dictionary addObject:word];
+                       [word release];
+               }
        }
        return self;
 }
@@ -60,7 +70,7 @@
                }
                
                BOOL add = YES;
-               for (int j = 0, k = numWild; j < [word length]; j++, k++)
+               for (int j = 0, k = numWild; j < length; j++, k++)
                {
                        if ([[word alphagram] characterAtIndex:j] != [tiles characterAtIndex:k])
                        {
diff --git a/dictionary.ka b/dictionary.ka
deleted file mode 100644 (file)
index 9ff6330..0000000
Binary files a/dictionary.ka and /dev/null differ
similarity index 100%
rename from Dictionary/dictionary.txt
rename to dictionary.txt