Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save rahulkhatri19/2f6c2d4a29d7a1e3e8f703a213e41dda to your computer and use it in GitHub Desktop.
Save rahulkhatri19/2f6c2d4a29d7a1e3e8f703a213e41dda to your computer and use it in GitHub Desktop.
var Player1= ArrayList<Int>()
var Player2= ArrayList<Int>()
var ActivePlayer=1
fun GameLogic(cellId:Int, btnSelected: Button){
if (ActivePlayer == 1){
btnSelected.text="X"
btnSelected.setBackgroundColor(Color.GRAY)
Player1.add(cellId)
ActivePlayer=2
}else {
btnSelected.text="0"
btnSelected.setBackgroundColor(Color.BLUE)
Player2.add(cellId)
ActivePlayer=1
}
btnSelected.isEnabled= false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment