Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 ~Help ME~ click=color?
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
nogardreyals




PostPosted: 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
Sponsor
Sponsor
Sponsor
sponsor
Euphoracle




PostPosted: Tue Jan 08, 2008 5:02 pm   Post subject: RE:~Help ME~ click=color?

Reversi? Sounds like reversi.
nogardreyals




PostPosted: 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?
nogardreyals




PostPosted: Tue Jan 08, 2008 5:33 pm   Post subject: RE:~Help ME~ click=color?

can anyone help me? in games like these how did they make a piece appear when you click in that box?

http://www.compsci.ca/v2/viewtopic.php?t=567

http://www.compsci.ca/v2/viewtopic.php?t=2420
TokenHerbz




PostPosted: 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 Smile

Actually i'm going to make this program too, since it seems pretty neat and i'm bored
Zampano




PostPosted: 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
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 6 Posts ]
Jump to:   


Style:  
Search: