Permalink
Browse files

Added first letter hints. Fixed frame size bug. Added more quotes.

  • Loading branch information...
1 parent 6af4034 commit 58185f8af875f710b818c1d6d62435d0d1143dd4 @debreuil committed Dec 26, 2011
@@ -35,6 +35,7 @@
84C9D8E2149E822700486E32 /* GameView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 84C9D8E1149E822700486E32 /* GameView.xib */; };
84C9D8E5149E8D6E00486E32 /* VTC_letterer_pro.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 84C9D8E4149E8D6E00486E32 /* VTC_letterer_pro.ttf */; };
84D674DD149FBA6900782018 /* AnswerGrid.m in Sources */ = {isa = PBXBuildFile; fileRef = 84D674DC149FBA6900782018 /* AnswerGrid.m */; };
+ 84F9CD0014A7CD6000891234 /* errorTile.png in Resources */ = {isa = PBXBuildFile; fileRef = 84F9CCFF14A7CD6000891234 /* errorTile.png */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
@@ -89,6 +90,7 @@
84D674DB149FBA6900782018 /* AnswerGrid.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AnswerGrid.h; sourceTree = "<group>"; };
84D674DC149FBA6900782018 /* AnswerGrid.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AnswerGrid.m; sourceTree = "<group>"; };
84D674DE149FBDF500782018 /* GridProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GridProtocol.h; sourceTree = "<group>"; };
+ 84F9CCFF14A7CD6000891234 /* errorTile.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = errorTile.png; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -197,6 +199,7 @@
84827BC3149E66AE0098E408 /* Images */ = {
isa = PBXGroup;
children = (
+ 84F9CCFF14A7CD6000891234 /* errorTile.png */,
84827BCF149E67170098E408 /* bkgGameH.jpg */,
84827BD0149E67170098E408 /* bkgGameV.jpg */,
84827BD1149E67170098E408 /* let_norm.png */,
@@ -323,6 +326,7 @@
84827BDA149E67170098E408 /* let_sel2.png in Resources */,
84C9D8E2149E822700486E32 /* GameView.xib in Resources */,
84C9D8E5149E8D6E00486E32 /* VTC_letterer_pro.ttf in Resources */,
+ 84F9CD0014A7CD6000891234 /* errorTile.png in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -8,153 +8,13 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
isPathRelative = "1"
- filePath = "WordGrid/AnswerGrid.m"
- timestampString = "346384350.69017"
- startingColumnNumber = "9223372036854775807"
- endingColumnNumber = "9223372036854775807"
- startingLineNumber = "190"
- endingLineNumber = "190"
- landmarkName = "-getCurrentWordStart"
- landmarkType = "5">
- </FileBreakpoint>
- <FileBreakpoint
- shouldBeEnabled = "No"
- ignoreCount = "0"
- continueAfterRunningActions = "No"
- isPathRelative = "1"
- filePath = "WordGrid/AnswerGrid.m"
- timestampString = "346382170.211683"
- startingColumnNumber = "9223372036854775807"
- endingColumnNumber = "9223372036854775807"
- startingLineNumber = "159"
- endingLineNumber = "159"
- landmarkName = "-getWordStartIndex:"
- landmarkType = "5">
- </FileBreakpoint>
- <FileBreakpoint
- shouldBeEnabled = "No"
- ignoreCount = "0"
- continueAfterRunningActions = "No"
- isPathRelative = "1"
- filePath = "WordGrid/AnswerGrid.m"
- timestampString = "346382170.211683"
- startingColumnNumber = "9223372036854775807"
- endingColumnNumber = "9223372036854775807"
- startingLineNumber = "74"
- endingLineNumber = "74"
- landmarkName = "-ownTileSelected:"
- landmarkType = "5">
- </FileBreakpoint>
- <FileBreakpoint
- shouldBeEnabled = "No"
- ignoreCount = "0"
- continueAfterRunningActions = "No"
- isPathRelative = "1"
filePath = "WordGrid/TileGrid.m"
- timestampString = "346382134.567348"
- startingColumnNumber = "9223372036854775807"
- endingColumnNumber = "9223372036854775807"
- startingLineNumber = "352"
- endingLineNumber = "352"
- landmarkName = "-onSelectTile:"
- landmarkType = "5">
- </FileBreakpoint>
- <FileBreakpoint
- shouldBeEnabled = "No"
- ignoreCount = "0"
- continueAfterRunningActions = "No"
- isPathRelative = "1"
- filePath = "WordGrid/Tile.m"
- timestampString = "346382279.909243"
- startingColumnNumber = "9223372036854775807"
- endingColumnNumber = "9223372036854775807"
- startingLineNumber = "180"
- endingLineNumber = "180"
- landmarkName = "-touchesEnded:withEvent:"
- landmarkType = "5">
- </FileBreakpoint>
- <FileBreakpoint
- shouldBeEnabled = "No"
- ignoreCount = "0"
- continueAfterRunningActions = "No"
- isPathRelative = "1"
- filePath = "WordGrid/Tile.m"
- timestampString = "346382279.909243"
- startingColumnNumber = "9223372036854775807"
- endingColumnNumber = "9223372036854775807"
- startingLineNumber = "182"
- endingLineNumber = "182"
- landmarkName = "-touchesEnded:withEvent:"
- landmarkType = "5">
- </FileBreakpoint>
- <FileBreakpoint
- shouldBeEnabled = "No"
- ignoreCount = "0"
- continueAfterRunningActions = "No"
- isPathRelative = "1"
- filePath = "WordGrid/AnswerGrid.m"
- timestampString = "346383476.691344"
- startingColumnNumber = "9223372036854775807"
- endingColumnNumber = "9223372036854775807"
- startingLineNumber = "73"
- endingLineNumber = "73"
- landmarkName = "-ownTileSelected:"
- landmarkType = "5">
- </FileBreakpoint>
- <FileBreakpoint
- shouldBeEnabled = "No"
- ignoreCount = "0"
- continueAfterRunningActions = "No"
- isPathRelative = "1"
- filePath = "WordGrid/Tile.m"
- timestampString = "346383487.24233"
- startingColumnNumber = "9223372036854775807"
- endingColumnNumber = "9223372036854775807"
- startingLineNumber = "178"
- endingLineNumber = "178"
- landmarkName = "-touchesEnded:withEvent:"
- landmarkType = "5">
- </FileBreakpoint>
- <FileBreakpoint
- shouldBeEnabled = "No"
- ignoreCount = "0"
- continueAfterRunningActions = "No"
- isPathRelative = "1"
- filePath = "WordGrid/TileGrid.m"
- timestampString = "346383522.890245"
- startingColumnNumber = "9223372036854775807"
- endingColumnNumber = "9223372036854775807"
- startingLineNumber = "351"
- endingLineNumber = "351"
- landmarkName = "-onSelectTile:"
- landmarkType = "5">
- </FileBreakpoint>
- <FileBreakpoint
- shouldBeEnabled = "No"
- ignoreCount = "0"
- continueAfterRunningActions = "No"
- isPathRelative = "1"
- filePath = "WordGrid/GameVC.m"
- timestampString = "346383568.738127"
- startingColumnNumber = "9223372036854775807"
- endingColumnNumber = "9223372036854775807"
- startingLineNumber = "73"
- endingLineNumber = "73"
- landmarkName = "-answerSelected:"
- landmarkType = "5">
- </FileBreakpoint>
- <FileBreakpoint
- shouldBeEnabled = "No"
- ignoreCount = "0"
- continueAfterRunningActions = "No"
- isPathRelative = "1"
- filePath = "WordGrid/GameVC.m"
- timestampString = "346384092.926921"
+ timestampString = "346560650.704567"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
- startingLineNumber = "75"
- endingLineNumber = "75"
- landmarkName = "-answerSelected:"
+ startingLineNumber = "338"
+ endingLineNumber = "338"
+ landmarkName = "-insertTile:At:"
landmarkType = "5">
</FileBreakpoint>
</FileBreakpoints>
View
@@ -21,31 +21,35 @@ + (void) initialize
],
[NSArray arrayWithObjects:
@"OPPORTUNITIES MULTIPLY AS THEY ARE SEIZED",
- @"", nil
+ @" E TAE Z TIPIA T MUYRLPOIINLTOPESESUHERSYD", nil
],
[NSArray arrayWithObjects:
@"PRETEND INFERIORITY AND ENCOURAGE HIS ARROGANCE",
- @"", nil
+ @" A N N FRETDA PRIENEN EGIRRDIAIRORUONHSTYEAOCGCE", nil
],
[NSArray arrayWithObjects:
@"BUILD YOUR OPPONENT A GOLDEN BRIDGE TO RETREAT ACROSS",
- @"", nil
+ @" AT Y DA TBUIUODIENCOLORLNRERSDPPOERTOATGOGENBRES", nil
],
[NSArray arrayWithObjects:
@"ALL WARFARE IS BASED ON DECEPTION",
- @"", nil
+ @" E TCI ESIPS ANAOD FREBEALLDORAWN", nil
+ ],
+ [NSArray arrayWithObjects:
+ @"TO A SURROUNDED ENEMY YOU MUST LEAVE A WAY OF ESCAPE",
+ @" E U LSUND TSUMODEEOAERRCAYFYMNSUEAVEYOETAWAPO", nil
],
[NSArray arrayWithObjects:
- @"TO A SURROUNDED ENEMY, YOU MUST LEAVE A WAY OF ESCAPE",
- @"", nil
+ @"ON A RAINY NIGHT IN SOHO THE WIND WAS WHISTLING ALL ITS CHARMS",
+ @"R A S A OIWITDIRMNNWANINTSAYHESLSNGSTHICHIOHOWNIGHTALL", nil
],
nil
];
}
+ (int) getCurrentIndex
{
- return 2;
+ return 8;
}
+ (NSString *) getCurrentQuote
{
View
@@ -12,9 +12,13 @@
- (int) getWordStartIndex:(int)index;
- (int) getCurrentWordStart;
- (NSString *) getCurrentLetter;
+- (NSString *) getCurrentCorrectLetter;
- (Tile *) removeCurrentTile;
- (Tile *) getNextTile;
- (void) setNextTileUsingTile:(Tile *)srcTile;
- (BOOL) atWordBoundry;
+- (void) showFirstLetterHints;
+- (void) showVowelHints;
+- (Boolean) testCurrentWordCorrect;
@end
View
@@ -13,7 +13,7 @@ - (void) setup
answer = [AnswerData getCurrentQuote];
answerWords = [answer componentsSeparatedByString: @" "];
gw = 15;
- gh = 3;
+ gh = 4;
margin = 2;
answerIndex = 0;
@@ -65,7 +65,7 @@ - (void) createLetters
}
}
}
- }
+ }
}
- (void) ownTileSelected:(Tile *)tile;
@@ -121,6 +121,39 @@ - (void) layoutGrid:(Boolean)useAnimation
}
}
}
+ [self showFirstLetterHints];
+}
+
+- (void) showFirstLetterHints
+{
+ int counter = 0;
+ for (int wordIndex = 0; wordIndex < answerWords.count; wordIndex++)
+ {
+ NSString *word = [answerWords objectAtIndex:wordIndex];
+ Tile *t = [tiles objectAtIndex:counter];
+ [t setLetterShowing:YES];
+ counter += word.length;
+ }
+}
+
+- (void) showVowelHints
+{
+ int counter = 0;
+ for (int wordIndex = 0; wordIndex < answerWords.count; wordIndex++)
+ {
+ NSString *word = [answerWords objectAtIndex:wordIndex];
+ for (int let = 0; let < word.length; let++)
+ {
+ unichar letter = [word characterAtIndex:let];
+ if(letter == 'A' || letter == 'E' || letter == 'I' || letter == 'O' || letter == 'U')
+ {
+ Tile *t = [tiles objectAtIndex:counter + let];
+ [t setLetterShowing:YES];
+ //break;
+ }
+ }
+ counter += word.length;
+ }
}
- (Tile *) getNextTile
@@ -196,7 +229,18 @@ - (NSString *) getCurrentLetter
NSString *result = nil;
if(answerIndex > 0)
{
- result = [[tiles objectAtIndex:answerIndex] letter];
+ Tile *t = [tiles objectAtIndex:answerIndex];
+ result = t.letter;
+ }
+ return result;
+}
+- (NSString *) getCurrentCorrectLetter
+{
+ NSString *result = nil;
+ if(answerIndex >= 0)
+ {
+ Tile *t = [tiles objectAtIndex:answerIndex];
+ result = t.correctLetter;
}
return result;
}
@@ -210,6 +254,7 @@ - (Tile *) removeCurrentTile
//[result setLetter:@""];
[result setIsSelectable:NO];
[result setSelected:NO];
+ [result setErrorMarkVisible:NO];
answerIndex--;
[[tiles objectAtIndex:answerIndex] setIsSelectable:YES];
}
@@ -232,4 +277,57 @@ - (BOOL) atWordBoundry
return result;
}
+- (NSRange) getWordRange
+{
+ int counter = 0;
+ int wordLen = 0;
+ int start = 0;
+
+ for (; start < answerIndex; start += wordLen)
+ {
+ if(counter < answerWords.count)
+ {
+ wordLen = [[answerWords objectAtIndex:counter] length];
+ counter++;
+ }
+ else
+ {
+ break;
+ }
+ }
+
+ return NSMakeRange(start - wordLen, wordLen);
+}
+
+- (Boolean) testCurrentWordCorrect
+{
+ Boolean result = NO;
+ if([self atWordBoundry])
+ {
+ result = YES;
+ NSRange range = [self getWordRange];
+ for (int i = range.location; i < range.location + range.length; i++)
+ {
+ Tile *t = [tiles objectAtIndex:i];
+ if(![t isCorrectLetter])
+ {
+ result = NO;
+ }
+ }
+
+ if(!result)
+ {
+ for (int i = range.location; i < range.location + range.length; i++)
+ {
+ Tile *t = [tiles objectAtIndex:i];
+ [t setErrorMarkVisible:YES];
+ }
+ }
+ }
+ return result;
+}
+
@end
+
+
+
Oops, something went wrong.

0 comments on commit 58185f8

Please sign in to comment.