How to create tic-tac-toe games based on HMI by using Arduino?

I have a stone touch display as well as an Arduino and I want to use this touch display to make a simple tic-tac-toe game.

I’m a newbie in this issue of programming, I’ve been using the code shared by others for my projects, and this time I want to finish an independent project by myself. Can anyone provide me with some help or ideas, please?

1 Like

Hi,

If you are entirely new to programming, then I think programming a game from scratch is a daunting task, especially in C/C++. You need good C/C++ skills, an algorithm for the Tic-Tac-Toe game and a device driver for interfacing Stoneitech LCD with Arduino to begin with. If you are a beginner in C/C++, It’s too early to start programming games and device drivers. I think you start with learning the basics.

1 Like

Yes, I think what you say makes sense, and I am now learning Arduino and c myself by following the tutorials on the web.
Occasionally, I learn how to use the new LCD.
I’ve studied elementary programming for a while before, and I’m not completely ignorant.
But I think I need to catch up on the basics in the near future.
Do you have a good idea for this project that you can offer me?

I think I have already mentioned this in my previous post. You need mainly four things, to begin with.

  • C/C++ skills
  • LCD device driver
  • Tic Tac Toe algorithm
  • Hardware and circuits

Even for an experienced developer, designing an optimised algorithm and writing an almost bug-free code is a herculean task. Take your time and learn the basics first. After that learn about different types of communication protocols, then write your own device driver. Take small steps instead of big leaps.

1 Like

Oh thanks so much! Maybe you’re right, maybe I need to start slowly from the very basics, I’ll update this post when I finish the project sometime.

2 Likes

I would suggest you try something way simpler at first:

Programming it on a screen of any sort will require you to learn how to “render” your graphics. As a starting point I would start with 3x3 RGB LEDs, each with 2 buttons (One for X one for O) (Or just one button per LED which will swap the colors from WHITE>RED>GREEN, or whichever color you designate for your Xs and Os). That way you can have a “multiplayer” game set up for you where only thing you have to do is check if there is 3 LEDs with the same color in a line or diagonal.
If you go with a one button approach you might have to determine a turn so that it wouldn’t automatically game over when someone tries to change the colors. But that’s something for you to work out, I guess.
Given that you’re just beginning with the programming I think this will help you understand the Arduino environment and help you familiarize yourself with the code. It shouldn’t be too complicated of a task to do, and one Arduino UNO should be able to support your project.

Once you have this done you can look into LCDs (Most common would be 128x64, I guess) and how to draw stuff on them and try and replace your rudimentary 3x3 with a better one. When that’s done, maybe you can look into adding “AI” to play against, but that’s a whole different task, especially with limited memory that Arduino has.
Like mentioned in some of the previous replies, it might be an issue developing an optimized solution, or a “smart” one.

But good luck with the project, if you get stuck on something specific you can always feel free to make another post if you need help with code or circuit.

Have fun!

1 Like

Thank you so much for your reply, your words make me feel warm and confident and I will ask for help when I have a problem!