~Help ME~ click=color?
Author |
Message |
nogardreyals
|
Posted: Tue Jan 08, 2008 4:56 pm Post subject: ~Help ME~ click=color? |
|
|
I want to make a game where its white pieces versus black pieces. Where if the white pieces are surrounded by black pieces then all the white pieces turn black and same if you have black pieces. (I dunno what the game is called but its a popular board game)
I want to recreate it using turing.
I already have a grid but i need to know how to do the following things.
1. When i click a box in a grid the box turns color. I know its possible to do a bunch of "if" statements like
if button = 1 and x < 20 and y < 20
then
drawfillbox (2, 4, 6, 8, black)
but i have over 18x18 boxes so is there an easier way to make it do that?
2. I have never seen anyone do this but is there a way where the program recognizes that your white pieces are surrounded by black pieces and automatically turn them all black. Or if you have five pieces in a row and recognize if you win or not.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
like chess games made on this site. How do you guys make the computer realize that player one is checkmate...
![Laughing Laughing](http://compsci.ca/v3/images/smiles/icon_lol.gif) |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
Euphoracle
![](http://compsci.ca/v3/uploads/user_avatars/11170373664bf5f25f636f1.png)
|
Posted: Tue Jan 08, 2008 5:02 pm Post subject: RE:~Help ME~ click=color? |
|
|
Reversi? Sounds like reversi. |
|
|
|
|
![](images/spacer.gif) |
nogardreyals
|
Posted: Tue Jan 08, 2008 5:05 pm Post subject: Re: ~Help ME~ click=color? |
|
|
yah im gonna make either reversi or omok from maple story. can anyone help? |
|
|
|
|
![](images/spacer.gif) |
nogardreyals
|
|
|
|
![](images/spacer.gif) |
TokenHerbz
![](http://compsci.ca/v3/uploads/user_avatars/717170395558e628d9452b.jpg)
|
Posted: Tue Jan 08, 2008 5:54 pm Post subject: Re: ~Help ME~ click=color? |
|
|
can you post some of your code, i want to know how you've started the program.
and regards to your questions, There should be a way
Actually i'm going to make this program too, since it seems pretty neat and i'm bored |
|
|
|
|
![](images/spacer.gif) |
Zampano
![](http://compsci.ca/v3/uploads/user_avatars/123384421747e86c6cddac1.gif)
|
Posted: Tue Jan 08, 2008 7:36 pm Post subject: Re: ~Help ME~ click=color? |
|
|
It doesn't seem like any one's given you an answer yet, so I will.
1. Unless you are want to use Turing's GUI, there isn't much of a way to work around using ifs (or is there?). But you can make it much easier on yourself by putting the ifs into two nested loops and having their increments be the x and y of the pieces you want to select. You can exit when MouseB is true. OF course, in a game like this, the piece selection is the least of your problems.
2. Yes, though not exactly as you said. Use a recursive function that focuses around the piece just laid down and keeps calling itself each time it sees another of its own colour.
Just like here: http://compsci.ca/v3/viewtopic.php?t=16781 |
|
|
|
|
![](images/spacer.gif) |
|
|