Skip to main content

CuriousTacToe - Devlog

Hey guys! Thanks for checking out my version of the simple ‘tic-tac-toe’ game.
This is the first app I’ve ever made in Kotlin (Android Studio)  and would like to tell you a little bit about how it works. 
Just incase you didn't land up here after trying the app, you can download the apk here.

So, how does it work?

To start with, each time the player clicks on the box, the computer plays a move according to a sweet tiny algorithm, that makes the computer play the almost-best-possible move.

This is how the 'sweet tiny algorithm' thinks-

  1. Oh okay, the player has played his chance, now its my chance.
  2. Let’s see if I can win the game in the next move, if yes, I must play that move.
  3. If not, let me check if the player can win in the next move, if yes, then I’ll block it.
'o' is the computer. The computer blocks the player's winning move.
And surprisingly, that's all that the comp does to defeat a human opponent in almost every match!

As you may notice, The last two points are practically useless for the first move, since no one can win in just two moves.

But after playing my app a couple of times I realised its pretty easy to defeat the computer unless you are playing with your eyes closed. So, after a little brainstorming with my mom, I came up with certain best moves for the computer to play in the first few chances, like-

  • If the player marks a corner in the first move then the computer must mark the centre.

    1. Over time I’ve come up with a few more of such ideas which make the computer almost invincible.

      If you are able to repeatedly defeat the computer using the same strategy, and know what can make the computer immune to it, please do tell me !

      I do plan to share the entire code, but since there are a whole-lot of codes better and simpler than mine on the internet, I’d have to clean my code to make more readable before sharing it to the internet.

      All in all, its fun making games and apps using Google’s legendary software- Android Studio. I'd love to get some feedback on the app, there's a comments box just below!😃



      Popular posts from this blog

      Distortion Pedal Electronics (Explained for beginners!)

      If you are into DIY guitar pedals and want to start designing your own effects, this article might help you open a few doors. I write this article as an EE student who earlier struggled with understanding these circuits and would often simply copy schematics off the internet. 

      This article is intended for-
      1. Absolute beginners who like tinkering with electronics
      2. Anyone who has been learning analog circuits and is looking for a jumpstart project.

      Also before I start I'd like to mention, for anyone who wants to get a rock-solid foundation in Analog electronics, I highly recommend reading the book, 'Electronic Principles' by AP Malvino and David Bates.

      Distortion Pedals come in all flavors and sizes, however, how the distortion effect is achieved in any of the pedals is more or less similar. Let's first see how the output of the pedal compares to its input.

      The raw signal coming from the guitar is first amplified a little, and then the peaks of the amplified signal are clip…

      5 Effective Online Tools that will Spice up your Arduino Projects!

      Arduino has made electronics projects easier than ever. The question now is- Can we make the process of building projects faster and more enjoyable? Let's have a look at some of the interesting softwares/online tools developed for the Maker Community to make tinkering more effective and documenting projects easier!

      1. TinkerCad

      TinkerCAD's recently created circuit simulator allows you to arrange your Arduino/Attiny circuits in an easy 'drag and drop' environment and test them virtually without having to make them. This can be really helpful, for testing projects that use components which you are yet to buy. And after all, who doesn't like tinkering?

      Try out Tinkercad-Circuits here!

      But that's not what Tinkercad is famous for. It offers an amazingly easy to use 3D design tool for Makers, once again in a simple 'Drag and Drop' interface! You can directly download the CAD file, once you're done designing. If you've ever thought of making your own uniqu…

      TV Remote Controlled Servo Motor-Using Arduino!

      We use our TV remotes to control the functions of the TV's, but when the TV is not in use, they're absolutely useless. Today, we are going to learn how to add more functionality to ordinary IR based remotes, in this one we shall see how to control servo motors. There are so many (SO MANY) different applications of this project that one can think of. Using the following tutorial, you can make one yourself!

      1. Watch the video tutorial-

      2. Things you will need-

      Note that you may use a different IR receiver other than TSOP1738, if it isn't available. Usually you can find this on websites like amazon and ebay.
      3. The circuit diagram!

      4. The IR Remote Library
      5. The Arduino Code- Just copy paste this code into your Arduino IDE

      // Written by Siddharth Kothari, Enjoy your journey Exploring Arduino!#include <IRremote.h>#include <IRremoteInt.h>#include <Servo.h>intRECV_PIN=11;//IR receiver pinintgndIR=10;/…