Thank you so much. I needed this for a University module I'm doing. I just have to add additional features to it now, which shouldn't be too bad. If I can work a quarter as quickly as you one day I'll be happy.
Hey! For those finding this tutorial, you may need to change up the "fun boardTapped(view: View)" function, as it no longer works in the current version (literally crashes if you press anything) My work around was setting each button like so in the oncreate function: binding.a1.setOnClickListener(this) binding.a2.setOnClickListener(this) etc. Then create override fun onClick(v: View?) { addToBoard(v as Button) } instead of the "fun boardTapped(view: View)" function be sure to also add: class MainActivity : AppCompatActivity(), View.OnClickListener {
Also, to get around draw popping up if you fill-up the board but also win I changed: override fun onClick(v: View?) { addToBoard(v as Button) var victory = false if(checkForVictory(NOUGHT)){ victory = true noughtsScore ++ result("Noughts Win!") } if(checkForVictory(CROSS)){ victory = true crossesScore ++ result("Crosses Win!") } if(fullBoard()) { if (victory == false) { result("Draw") } }
Hey Cal, I think you should make a playlist about layout design using XML, I saw lots of UA-cam tutorials but I'm not able to find any proper playlist for learning layout or android UI design using XML. Thank you.
Best video on Tic Tac Toe game built using Kotlin in UA-cam. Keep it up Cal Sir.
The big grateful from Kazakhstan! You are the best!
Thank you so much. I needed this for a University module I'm doing. I just have to add additional features to it now, which shouldn't be too bad. If I can work a quarter as quickly as you one day I'll be happy.
Hii bro I require it for the same can you please help me how to download it using source code 😿😿
Hey! For those finding this tutorial, you may need to change up the "fun boardTapped(view: View)" function, as it no longer works in the current version (literally crashes if you press anything)
My work around was setting each button like so in the oncreate function:
binding.a1.setOnClickListener(this)
binding.a2.setOnClickListener(this)
etc.
Then create
override fun onClick(v: View?) {
addToBoard(v as Button)
}
instead of the "fun boardTapped(view: View)" function
be sure to also add: class MainActivity : AppCompatActivity(), View.OnClickListener {
Also, to get around draw popping up if you fill-up the board but also win I changed:
override fun onClick(v: View?) {
addToBoard(v as Button)
var victory = false
if(checkForVictory(NOUGHT)){
victory = true
noughtsScore ++
result("Noughts Win!")
}
if(checkForVictory(CROSS)){
victory = true
crossesScore ++
result("Crosses Win!")
}
if(fullBoard()) {
if (victory == false) {
result("Draw")
}
}
Hopefully this can save someone new hours, Kotlin having frequent updates rendering old tutorials useless has made my life hell
Thank you so much Cal Sir. Your videos are very helpful 💌
Sir, please JetPack kotlin complete advanced tuotorial updated with Ecommerce ui design
Good Video Man. Love to see more!
thanks for the code, may I use it for commercial purposes ?
Hi , Cal.. You're amazing. Pls don't give up , okey?
Hey Cal, I think you should make a playlist about layout design using XML, I saw lots of UA-cam tutorials but I'm not able to find any proper playlist for learning layout or android UI design using XML. Thank you.
Why my boardTapped function wasnt created automtically?
I have problem in online that show layout margin not found
If the win happens at the last move, there is a draw and win at the same time ;) great video!
😉
Hi, as soon as I am clicking on board the application is minimising automatically
Nice explaining. Keep it up.
Lâu quá rồi mới nghe anh Đức Phúc hát, thích quá đi thôi.
I am unable to find activity main binding in my syste,
Have you enabled view binding in the build Gradle?
@@CodeWithCal Same with me, i enabled it and somehow it still shows "unresolved reference" i actually tried everything and it doesnt work
hy call need help me plz
i have a make to prayer times list in andoid st
A list view application?
ua-cam.com/video/6qYNxtG0LNE/v-deo.html
love it
unresolved error for me
Bro how to make games
Google. :P