not done yet, but can make 1 mode, keyboard and mouse can be added.
gamepad, it might work like arrows keys as input. but cannot test that.
this can take a few days (this does freeze the player till the game is over or closed).
there is a plugin of tictactoe too, but I think htmlTicTacToe is can be smoother.
same for Tetris which I could try.
but else eventing like JohnDoeNews said or by simply images.
which might is easy to track down.
Sorry for the late reply. Something came up yesterday, so I wasn't able to write that tutorial completely.
I am in the bus home now. I plan to stream some jam entrees for a while. I'll try to finish it later today, otherwise it will be Monday, cause tomorrow I visit my parent. And Monday I have the day off.
I have a set up made both with and without AI (a.k.a. random).
I even have an idea for a self-learning AI. At first it will be as stupid as a rock, but it will never make the same mistake twice. This might require some javascript and might be way to complicated for me to explain in a simple tutorial... but I think I can create it.
To answer your question how you know which players turn it is....
You have 1 event that first let's you place your X, then let's the AI place an O.
Halfway that event, after the X is placed and before the O is placed, you do the check. If this says true, the player wins.
At the end of the event you do it again, that check. If it is true now, the player loses.
I try to make the tictactoe in html form for you, so wait patiently,
about a week if possible for a hopefully working version.
while keyboard is possible, it needs to placed it, the window on its own
is an overlay (stops player movement while this game is running.
so always center (this can be styled inside the CSS on any position.
if more dynamically, it require more work.
AI is simple basic, but can make it advanced, but doing so, you might never win.
but I can try 3 levels to choose at start (level 1, 2 3) (easy, normal, hard)
so I can certainly add them.
for now, its basic AI function (remove them, which I can do as well) require
option like:
htmlTTT.open(useAI, difficulty) where difficult is easy on base, and AI on false.
so the following would count if implemented
htmlTTT.open() player vs player (difficult would be easy/none) as it has no impact
htmlTTT.open(true) player vs AI (easy mode)
htmlTTT.open(true, "hard") player vs AI (hard mode).
this takes a few days as debugging the AI mind can be tricky, and
keyboard wouldnt hopefully to be hard. so I do that first, than you can test
around (as css styling is a bit responsive build and a total mess atm.
will fix that too and clean things up.
the animation is optional, but it gives a cool effect. and is totally optional though 🙂
Keyboard wont work, but got a work around which works better.
using a fake mouse controller to select them.
only there arise more causes at the moment, once fixed, you get
a prototype to test it out before I set it on my own thread.
this is what you get in your DM once ready. (1-2 days probably).