Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Game Development

Reply
 
LinkBack Thread Tools Display Modes
Old 04-08-2011, 12:56 PM   #76 (permalink)
Registered Member
 
Join Date: Apr 2011
Posts: 4
stellyPC is on a distinguished road
Default

Quote:
Originally Posted by bvawter View Post
in xcode 4, double click your project name (on the left column). a new window pops up with several tabs. click the "build" tab and change the base sdk to match the sdk you are presently using. Sometimes you have to quit xcode and reopen to get this to "take."
thanks works great!

Anther question:

in the code i posted the catsgame is not working!

do you know wahts the prob ?



thanks??
stellyPC is offline   Reply With Quote
Old 04-11-2011, 12:47 PM   #77 (permalink)
Registered Member
 
Join Date: Apr 2011
Posts: 4
stellyPC is on a distinguished road
Default

Quote:
Originally Posted by stellyPC View Post
thanks works great!

Anther question:

in the code i posted the catsgame is not working!

do you know wahts the prob ?



thanks??

i find out what was wrong the catsgame code was only running when there was a winner because it ws connected with if and the brakets where all closing after it HERE is the right way:

-(void)processLogic{
//The process Logic will check for a win, if one is present it will present
//a UIAlert. If one is not found it will display a Draw message if all the spaces are filled.

if([self checkForWin]){
if(playerToken==1){
myAlertView = [[UIAlertView alloc] initWithTitle:@"Winner!" message:@"Player X wins!" delegate:self cancelButtonTitle:@"Ok." otherButtonTitles:nil];
[myAlertView show];

[self resetBoard];
}
if(playerToken==2){
myAlertView = [[UIAlertView alloc] initWithTitle:@"Winner!" message:@"Player O wins!" delegate:self cancelButtonTitle:@"Ok." otherButtonTitles:nil];
[myAlertView show];

[self resetBoard];

}
}else{
if(numberOfPlays == 8){
myAlertView = [[UIAlertView alloc] initWithTitle:@"No Winner!" message:@"It's a cats game!" delegate:self cancelButtonTitle:@"Ok." otherButtonTitles:nil];
[myAlertView show];

[self resetBoard];


}
}


}
stellyPC is offline   Reply With Quote
Old 04-11-2011, 12:49 PM   #78 (permalink)
Registered Member
 
Join Date: Apr 2011
Posts: 4
stellyPC is on a distinguished road
Default 1 Player mode

Does someone has a code for an intellegent COM-opponent?
i just get random.... so the COM is very silly player
stellyPC is offline   Reply With Quote
Old 06-09-2011, 04:56 PM   #79 (permalink)
Registered Member
 
Join Date: Jun 2011
Posts: 1
uioy is on a distinguished road
Default

Hey Im a completely NOOB... i have an error in the tic tac toe app, When I put this:
Code:
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
//The error is in Switch an it sais "Switch Quantity, not an Integer" really i don't //have any idea, help please
	switch (PlayerToken){
		case 1:
			TheImg = XImg;
			break;
		case 2:
			TheImg = OImg;
			break;
	}
BTW, the tutorial is very very good, it was helpful. Thank you.
uioy is offline   Reply With Quote
Old 06-12-2011, 09:47 PM   #80 (permalink)
New User
 
Join Date: Jun 2011
Posts: 5
lzwujun is on a distinguished road
Default

Sweet, did you use the displayWinner method? or did you code something else?
lzwujun is offline   Reply With Quote
Old 06-13-2011, 09:32 PM   #81 (permalink)
Registered Member
 
Join Date: Jan 2011
Location: Lakeland, TN
Posts: 3
bvawter is on a distinguished road
Default playerToken must be declared as an integer.

make sure your decarations in the .h file are correct:

//new variable for the images added
IBOutlet UIImage * theImg;

//integer that represents the player
NSInteger playerToken;
NSInteger numberOfPlays;
}
@property (nonatomic,retain) UIImage *theImg;//new
@property (nonatomic,retain) UIImage *oImg;
@property (nonatomic,retain) UIImage *xImg;










Quote:
Originally Posted by uioy View Post
Hey Im a completely NOOB... i have an error in the tic tac toe app, When I put this:
Code:
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
//The error is in Switch an it sais "Switch Quantity, not an Integer" really i don't //have any idea, help please
	switch (PlayerToken){
		case 1:
			TheImg = XImg;
			break;
		case 2:
			TheImg = OImg;
			break;
	}
BTW, the tutorial is very very good, it was helpful. Thank you.
bvawter is offline   Reply With Quote
Old 07-03-2011, 07:51 AM   #82 (permalink)
Registered Member
 
Join Date: Jun 2011
Location: Sydney, Australia
Posts: 44
new2objectivec is on a distinguished road
Default

Quote:
Originally Posted by stellyPC View Post
Does someone has a code for an intellegent COM-opponent?
i just get random.... so the COM is very silly player

I just finished my first tictactoe game and the computer player is quite "smart". May be you can have a look at how I did it?

At high level:
1) build an array storing status of each of the 8 possible rows (3xhorizontal, 3xvertical, 2xcross) that could win
2) update status at each move
3) based on score work out the most critical one
4) add a few extra "special" conditions which the logic couldn't handle

For further info, please see this post on my blog. Full source code also available.
New 2 Objective-C: [Open Source Game] TicTacToe Ver 1.00

Last edited by new2objectivec; 07-03-2011 at 08:03 AM.
new2objectivec is offline   Reply With Quote
Old 08-28-2011, 11:07 AM   #83 (permalink)
JaGDiSH
 
Join Date: Sep 2010
Location: Ahmedabad
Posts: 57
jagds is on a distinguished road
Send a message via Skype™ to jagds
Default

this is very good tutorial... Thanks...
jagds is offline   Reply With Quote
Reply

Bookmarks

Tags
game tutorial, tic tac toe

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 422
9 members and 413 guests
13dario13, ChrisYates, fredidf, gmarro, iOS.Lover, Leslie80, Meoz, Wikiboo, Yosh_K
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,670
Threads: 94,121
Posts: 402,903
Top Poster: BrianSlick (7,990)
Welcome to our newest member, Yosh_K
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 04:38 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0