Alice Community  

Go Back   Alice Community > Alice 2 > How do I...?

Reply
 
Thread Tools Display Modes
Help with Program
Old
MegaDaffy
Guest
 
Status:
Posts: n/a
Smile Help with Program - 03-11-2008, 01:01 PM

Hello! I'm almost finished with my "Tic-Tac-Toe" program, however I keep entering an infinite loop when it's the computer's turn.

My question is there a way to set the Parameters and Variables to integers?

Thank You For Your Time!
   
Reply With Quote
Old
Lprsti99
Guest
 
Status:
Posts: n/a
Default 03-11-2008, 01:22 PM

Not quite sure what you're asking. Mind posting the program? Might give me a better understanding of what you're having a problem with.
   
Reply With Quote
Old
DickBaldwin
Guest
 
Status:
Posts: n/a
Default 03-11-2008, 01:37 PM

Quote:
Originally Posted by MegaDaffy View Post
Hello! I'm almost finished with my "Tic-Tac-Toe" program, however I keep entering an infinite loop when it's the computer's turn.

My question is there a way to set the Parameters and Variables to integers?

Thank You For Your Time!
Go to Google and search for the following keywords:

alice integer type site:www.alice.org

I believe that you will find the answer to your question there.

If you don't find it there, go to Google and search for the following keywords:

alice integer type site:www.dickbaldwin.com

I'm reasonably sure that you will find the answer to your question there.

Dick Baldwin
Free Alice tutorials: http://www.dickbaldwin.com/tocalice.htm
Free programming tutorials: http://www.dickbaldwin.com/toc.htm
   
Reply With Quote
Old
MegaDaffy
Guest
 
Status:
Posts: n/a
Default 03-12-2008, 09:15 PM

Quote:
Originally Posted by Lprsti99 View Post
Not quite sure what you're asking. Mind posting the program? Might give me a better understanding of what you're having a problem with.
Sure! Here You Go!
Attached Files
File Type: a2w TicTacToe.a2w (526.2 KB, 227 views)
   
Reply With Quote
Old
Lprsti99
Guest
 
Status:
Posts: n/a
Default 03-13-2008, 12:34 PM

Ok, wow... Right off the bat, I suggest you set up the x's and o's so that they are in the corresponding spots (like x1, o1, and 1 are in the same square) Will post more once I get a better look

EDIT: Hmmm, well, for some reason your while loop is not changing your Spot Available variable. you are getting the random numbers fine, but it's as if the if/else statements are not even running. I've tried replacing some of your statements with object and world variables, but to no avail. I tried making new methods with parameters to check if a spot was available and tried using events, as well. What's frustrating is, as far as I can tell, the code should work, even as you had it, but it doesn't. This might be one of the bugs that Alice 2 has, in which case, you might be out of luck. It'd be good for DrJim or DickBaldwin to look at the program, though, as they have more expertise than I do. Otherwise, though, you might consider setting the program up as a two player game, as opposed to a game vs a computer (besides, the computer randomly picking a spot wouldn't be hard to beat.)

Sorry I couldn't be of more help. If I think of anything else, I'll post it.

Last edited by Lprsti99; 03-13-2008 at 01:49 PM. Reason: Avoid a double post.
   
Reply With Quote
Reply

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

Forum Jump



Copyright ©2024, Carnegie Mellon University
Alice 2.x © 1999-2012, Alice 3.x © 2008-2012, Carnegie Mellon University. All rights reserved.