Question

I might not be able to express exactly what problem I am having, but I can try. I am working on a Bluetooth Tic Tac Toe Game over android OS. I have developed it. But now I have a problem, I am able to play it over bluetooth, transfer the code, set the desired "X" or "O", but when I transfer the info to be set, I expect other player to wait. Is there any mechanism that can enable me to stop my "board" if my turn is over. And Just when Other user over bluetooth connection transfer she should have her board disabled or on hold and my board should be enabled. currently, both boards are open for random connection, anyone after connecting, can transfer asynchronously. Any expert help would be appreciated.

(I have used treads for transfer, connect, and server actions)

Was it helpful?

Solution

you should "remember" which buttons were are unclicked before you disable the whole board and then re-enable them when its this players turn..
it really depends on your implementation.. if u decide to extend button then add a boolean field "clicked" and then iterate over the 9 buttons and enable only the ones with clicked=false.
another option is just save the button numbers which have been clicked if you are using a grid or some kind of collection to store them.

again, im not sure what u did because u didnt post any code but i advise u to think it over and decide how do u represent a tic-tac-toe button in your app.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top