Noughts n' Crosses - A simple tic-tac-toe game [1.1]

Changelog 1.1

  • Rewrote game, saved 500 bytes
  • Hex added
  • Changed “Cats Game” to “Draw” for all the euroland folks

Behold, my first work for the arduboy! Noughts n’ Crosses!

With all these 4-part game sets and games that take up every last byte of memory, how about we sit down and have a wholesome game of tic-tac-toe?


Its an very simple two-player tic-tac-toe game mostly written by me but with the help of Pharap in a 200 post help thread.


I tried to make the graphics as clean and large as possible here while still being able to work around the small screen size.




In the entirety the game takes ~11500 bytes, and supports screen mirroring with arduboy manager!


To get the game visit my github release:


Nice job and a perfect game to learn the basics on.

I had a sneak peek at the code and can see @Pharap’s influence all over it. If you kept up with him, you would have learnt a lot - forward declarations, default constructors (using the keyword default and void parameters) and so on. I bet he didn’t use the keyword ‘and’ or ‘or’ and I bet he nagged you about enumerating the gscreen and gstate values :slight_smile:

I have never heard of ‘Cat’s Game’ in Noughts and Crosses.


Anyone remember the film wargames?


What I remember from War Games was they used a 1200 baud acoustic coupler to dial into the mainframe, So 1980 …


Shall we play a game?


I like the titlescreen graphic the most, it’s very polished.
I think the last version I tried was before sound was added, the sounds are pretty neat.

One small thing that I didn’t notice before: forces the sound on and ignores the Arduboy’s settings.
You might want to change that to an so that kids can play late at night without waking their parents. :P

I bet you’ve been following the thread you cheat :P

Seriously though, I forgot to mention gstate and gscreen.
I think @Pygasm is planning to move on to his next game now though, so I don’t know if it’s worth brining it up.

Nor had I.

I’d never heard of it, but I just read the plot on Wikipedia.
Looks interesting.
Reminds me of Short Circuit and Short Circuit 2 (also from the 80s).

While I think of it: I like that more and more people are making their own splash screens, I think it gives games character.

1 Like

Not that closely … but I know you!

Games are never finished … they can always be improved.

Its like the book’s cover. Everyone judges the game on it.

1 Like

Since the game is only ~12000 bytes, why not call arduboy.begin() instead of arduboy.boot() and boot() and audio.begin() will be called by arduboy.begin().

What about doing:


Would that be satisfactory?

Games are never finished … they can always be improved.

Im going to add board saving and for the hell of it change gstate and gscreen to enums

I have never heard of ‘Cat’s Game’ in Noughts and Crosses.

I learned it when I was young and it stuck with me. Not sure if it just an american thing or not but it what you called a draw in tic-tac-toe.

Since the game is only ~12000 bytes, why not call arduboy.begin() instead of arduboy.boot() and boot() and audio.begin() will be called by arduboy.begin().

I have my own custom splash that arduboy.begin overrides so i used boot in order to have my own splash.


Yay :D

The reasons for using enum class for state are pretty much the same as why I suggested it for Cell.
It makes it harder to shoot yourself in the foot.

It probably is. The name “Tic tac toe” generally is.

The only thing missing from what begin() does is the boot logo and the wait for no buttons being pressed. Since there’s plenty of code space available, what’s wrong with just doing arduboy.begin()?

I presume at least part of the reason @Pygasm chose boot was to miss out the boot logo.

I know you’re going to say “it can now be disabled by the EEPROM flag, so why not leave it in and let the players decide”.
But some people prefer leaving out the logo even on the final version, whether they need the space or not.

Maybe it’s time we all sat down and had a discussion about it?
Perhaps with a poll to gather opinions?

Normally I would have included it but in this case I left out the buttons thing because @Pygasm is using a delay at the start.
I was assuming the button waiting was just to prevent someone accidentally skipping the titlescreen, but perhaps they serve some purpose I’m unaware of?

While I think of it, perhaps the splash screen should have been a state and used a time/frame counter instead of a delay, but frankly @Pygasm 's put a lot of work into get it going and patiently listened to my ramblings so I’m happy to let him off on that one if he just wants to add the EEPROM saving and call this project done.

Yes, it was if someone used RIGHT to skip the logo. RIGHT would still be pressed when the actual sketch was entered and might trigger something that the sketch used RIGHT for when it started. The flashlight feature used to need it, as well, but it no longer exits.

It’s also there for any future features that might have the same problem. I decided that it would be good to guarantee that no buttons were pressed when the actual sketch was entered. It’s easier to do this globally at the end, instead of in each function.

I want to suggest something: a function called beginNoLogo(). This function will do every function in begin, but will exclude the boot logo. Even better is a function called beginCustomLogo() which you could pass your own image and coords to be drawn.

1 Like

The original Arduboy library had beginNoLogo(). It was replaced by using boot() and then following it with the desired functions, so you could pick and choose what you desired, based on how much code space you wanted to recover. Otherwise we would need:


Ah, well that makes alot more sense

You can call bootLogoShell(), after boot(), and pass it a reference to a function that draws whatever logo you like.

So in this case it doesn’t make much difference because of the enforced delay. If it were to do anything like that it would have to be used after the delay.

I’d somewhat disagree there.

I’ve seen plenty of people who want to exclude the logo, but far fewer want to exclude the other stuff. Often discluding the other functions is unintentional.

Again, we could do a poll or turn this into its own topic.

I call spinning this off into a different topic with a poll. Let the community decide.