Alice Community  

Go Back   Alice Community > Alice 2 > Share Worlds

Reply
 
Thread Tools Display Modes
Old
GameKid
Senior Member
 
GameKid's Avatar
 
Status: Offline
Posts: 467
Join Date: May 2011
Location: My magnificent castle
Default 11-04-2011, 03:05 PM

Very nice! I played a few games with my sister.
Maybe someday you could add an AI to play against.
Until then: Four stars.


[COLOR=e4eaf2]Your text here[/COLOR]
Come on, you know you want to try it.
   
Reply With Quote
Old
cacho5230
Junior Member
 
Status: Offline
Posts: 4
Join Date: May 2012
Location: santiago del estero
Default 05-28-2012, 01:06 AM

Quote:
Originally Posted by Dameria View Post
I got the idea from another user about 2 days ago to make a tic-tac-toe game, and I have just now finished it fully! I am very proud of this game I created because as far as I know there are no flaws. This includes no multiple wins, no playing after someone won, and so on. It even surprisingly works on both Alice 2.2 and Alice 2.0!

So here it is. I even have a few ideas for a Tic-Tac-Toe 2.0 (hey that rhymes!), in which more things will be added.

Please tell me what you think about the game, tell me if there is anything I missed, or maybe some ideas for 2.0, thanks!

Download Tic-Tac-Toe 2.0 below for the latest and best version.
I have taken the first version of Tic-Tac-Toe off because it has been getting more views than version 2.0 just because it is the first in the list. I do not want this to happen, so I have moved the version 1 download to the post where I originally introduced version 2.0, just in case you do want to download it.
ESPANISH
Hola, tiene un problema el tic-tac-toe . cuando un jugador gana no se marca en el scoreboard

----------
ENGLISH
Hello, you have a problem tic-tac-toe. when a player wins is not marked on the scoreboard.
please help
   
Reply With Quote
Tic-Tac-Toe
Old
cedricdosss
Junior Member
 
Status: Offline
Posts: 10
Join Date: Nov 2012
Default Tic-Tac-Toe - 11-19-2012, 03:31 PM

Very nice and well done. I enjoyed it at work now with coworker.
Do you do it for fun?
   
Reply With Quote
Old
Dameria
Senior Member
 
Dameria's Avatar
 
Status: Offline
Posts: 978
Join Date: Sep 2009
Location: United States
Default 11-19-2012, 06:03 PM

No I don't play it very often. I made it mostly as a challenge for myself to see if I could. I am very proud of it though. Thank you for trying it!


Check out my best projects so far and please comment:

Tic-Tac-Toe 2.0 ................... http://www.alice.org/community/showthread.php?t=3548
Alice Paint ........................... http://www.alice.org/community/showthread.php?p=23408
Real-Time Clock .................. http://www.alice.org/community/showthread.php?p=12725
Maze Game ......................... http://www.alice.org/community/showthread.php?t=4301
   
Reply With Quote
Old
stylo
Junior Member
 
Status: Offline
Posts: 1
Join Date: Nov 2012
Default 11-22-2012, 10:22 AM

Very nice game, I'm playing it, if I find errors I'll report here. Thanks.
   
Reply With Quote
tic tac toe
Old
taeweas
Junior Member
 
Status: Offline
Posts: 4
Join Date: Nov 2015
Default tic tac toe - 11-30-2015, 06:47 PM

So I used your game as a template, because I did not want to completely just rip you off for my project. I am not fully competent with alice and therefore wanted to dumb it down a little bit as I think my teacher would know if I did. I just do not understand how you determine which players turn it is. Here are 2 kind of infant projects, one using the text boxes like you did, and the other using colors instead of x's and o's. Where can I go from here? Btw, props on your game, very very cool. Any help is greatly appreciated!
Attached Files
File Type: a2w Great Project (1).a2w (52.1 KB, 6 views)
File Type: a2w Great Project.a2w (49.7 KB, 5 views)
   
Reply With Quote
Old
Dameria
Senior Member
 
Dameria's Avatar
 
Status: Offline
Posts: 978
Join Date: Sep 2009
Location: United States
Default 11-30-2015, 10:06 PM

Hello taeweas and welcome to the forums!

First off, I have to apologize for the way that I programmed this game. As an undergraduate college student about to get his degree in Computer Science, I am wincing as I look back at this programming. It's disgusting code-wise; completely unorganized, inefficient, and non-intuitive. Back when I made this I had little understanding of object oriented code design. Enough of my self-pity though, I'll try to help you understand what I did.

First of all, in my program if you scroll down to the bottom of the Events board you can see that I have an event with the condition "When the world starts, do" followed by the method "scoreboardBackground.setNames". To see this method, you have to maximize the "Scoreboard" object group in the objects window under the Play button. In this folder you will see an object "scoreboardBackground" that you can click on. In the window directly below the objects window you should see the text "scoreboardBackground's details". This is the details window. There should be 3 tabs under this text: properties, methods, and function. Click on "methods" and you will see all of the methods available for this object. I chose to create a method under this object and call it "setNames", you should see it at the top of the methods tab. Press the "edit" box next to the method to open the code.

In the scoreboardBackground.setNames method you can see the code I used to ask the user to set their name using the message boxes when you first run the program. At the very bottom of this method you will see a command to run "world.randomTurn". That randomTurn method is unique in that it is the only global method that I created (for some reason). If you click on the "world" object at the very top of the objects section and click to edit the "randomTurn" method in the world's methods section, you can see the strange code that I created to select the first player's turn. It basically chooses an integer, either 0 or 1 (for some reason I had it generate a 3 or 4, then subtracted by 3??? I'm strange) and assigns that number to the global variable "playerTurn" (found in the "world" object's properties tab). The method now decides that it's O's turn if a 0 is randomly generated or X's turn if a 1 is generated. It then changes the text property of the "turnText" object (found in the object folder "PlayersTurn") to either O or X, whichever "world.playerTurn" is randomly set to. This text is displayed in the gray "Players Turn" square of the world.

If you thought that was the confusing part, you were wrong. If you look at the events, you will see that every clickable square has an event that is triggered when said square is clicked, each calling a different method.
In hindsight, I could have made this into a single event with a single global method by creating an object list through the world's properties tab -> create new variable -> Object + checkbox for List, but I didn't learn how to do this until later in my Alice days.
Anyways... each of these methods pretty much do the same thing, they set the corresponding text within the box to either O or X, depending on whose turn it is by using "world.playerTurn" as the conditional, and then it either calls the method "winText.Player X Won" or "winText.Player O Won!" (don't ask my why O has an exclamation at the end while X doesn't, I don't know why. Maybe I like player O more?). These method names are deceiving though because they don't actually mean that the player has won, but rather it is a method to check to see if the player won. Within these methods are "if" condition blocks checking every single possible combination that would indicate a win; so any diagonal, horizontal, or vertical combination of that player's symbol (O or X) would indicate a win, I think there are 8 possible combinations. If a win is detected, it will show the winning text and background that has been hiding this entire time, flash the winning texts, increment the winner's score, and run the method "winText.playAgain" to ask you if you want to play again.

Sorry about the bad code and for this giant mess of a post. I hope it wasn't too confusing and that it helps you make your own game. I am willing to take a look at your progress and give help if you have any specific questions. Just reply here with your questions and updated project and I'll give feedback.


Check out my best projects so far and please comment:

Tic-Tac-Toe 2.0 ................... http://www.alice.org/community/showthread.php?t=3548
Alice Paint ........................... http://www.alice.org/community/showthread.php?p=23408
Real-Time Clock .................. http://www.alice.org/community/showthread.php?p=12725
Maze Game ......................... http://www.alice.org/community/showthread.php?t=4301
   
Reply With Quote
Old
taeweas
Junior Member
 
Status: Offline
Posts: 4
Join Date: Nov 2015
Default 12-03-2015, 12:10 PM

Thanks for your help! Here is what I have so far, I'm just having trouble implementing the lists to make one global method. Im trying to keep it simple as well....Thanks for the feedback
Attached Files
File Type: a2w g5.a2w (88.3 KB, 5 views)

Last edited by taeweas; 12-05-2015 at 08:51 PM.
   
Reply With Quote
Reply

Tags
fun, game, tac, tic, 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

Forum Jump



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