Project Information


Tic-Tac-Toe

This is just your good old Tic-Tac-Toe, you get three in the same row (horizontal, vertical or diagonal) and you win. This was just kind of a test for myself to see what I could with a time limit of 3 hours and I completed this in only 2 hours.

So jumping into this I didn't know what the result would be. Would I fail or have succes, I didn't know for sure, so I jumped in there with no hesitation and started setting up my scene and prefabs. I made the slots and kept applying changes to them so the other slots would be the same and I didn't have to do it 9 times.

Then I thought as basic as I could and I knew I first had to be able to give it a value. Okay button press and it's done, then I would need to switch turns, so the value should change with the turn. After that it was just fixing things like overriding the other value, make it noticeable that you had won and not being able to play anymore after winning.

I do admit that this wasn't a big challenge, but doing mini gamejams for myself is a way I can improve and show something on my portfolio.

Pictures


So I made a picture of it, while I was playing.

A gif of it being played.

There is also a reset button and you can play just fine after pressing it.

Code


Click the button to see my code in Git Gist!

My Git Gist

The board manager is supposed to be the big brother of code, it just starts, checks for the winning conditions and resets, and that is all it needs to do. One of the first problems I had was that I didn't know how I would identify the slots. A bit later I realized I could just make a list and make it identifiable that way. Later I caught myself thinking how am I going to make it know someone won. I fixed that with the, list because now it was identifiable.

I had planned for the boardmanager to be the one deciding what turn it was, but what if all slots already knew what kind of string they themselves would receive and just change that in a button press, so I did that in their own script and that way, when you click on a button, it gets activated and does its job.