How To



WhyCanInotThinkOfAName? 2021-03-18 01:02 (Edited)

hey! :) I'm working on a tic-tac-toe program and I was wondering about a computer opponent.
I know there are four types of AI:

learning: self-explanatory, takes its past games and figures out its mistakes and good moves, then remembers them and learns from them.

minimax: makes a tree of possible outcomes, then evaluates each one, then picks the best

rule-based: based on strategical rules like "if center not full, take it"

brutal ai: has a "dictionary" of every possible layout, followed by the best move. in tictactoe, it takes around 300 entries. A game like chess would take more entries than the number of entries in every dictionary on earth times itself one-billion times. Does that sound feasible? The only upside to this is the computer will play "perfectly."

Any ideas on how to implement them with lowres?

was8bit 2021-03-18 02:59

Actually, tictactoe ai is very simple...

1st play, take center
2nd play, take corner
Remaining plays, block if needed, else take a corner

Regardless of who goes first, this AI will always lead to a stale-mate... no win...

was8bit 2021-03-18 03:00

You can create easy to hard opponents by making easier opponents occasionally make random plays rather than ai plays...

Timo 2021-03-18 07:17

I would also go rule based, seems to be the easiest.

WhyCanInotThinkOfAName? 2021-03-18 11:58

ok, timo!
acctually was8bit, what your desribing is a form of rule based ai, so thats what im going with!

was8bit 2021-03-18 14:44 (Edited)


Also, to spice it up, you can make the player EARN the square they want... the idea comes from an old show

I made a couple games based on that concept...

Or you can make your own variation that isn't the norm...

But my best recommendation is to keep your games as simple as possible... you can always add to them or make a bigger one later once you get a working version done :)

WhyCanInotThinkOfAName? 2021-03-18 20:18

oh cool! maybe i'll do that when I learn graphics.

was8bit 2021-03-19 05:02 (Edited)


... remember, you may play around with any of my stuff, and experiment with it... even if you totally wreak the code you can always delete and reload the original code again, and experiment so more ;)

... and if you happen make something new and cool with anything of mine, go ahead and post it as a remix... you will note I occasionally post remixes of other people... it's best to get their permission first, but since you already have mine so have fun with anything that is mine if you wanna :) (just not any I have posted as remixes, as those were not mine originally, you will know because I try to give the original author clear credit)

WhyCanInotThinkOfAName? 2021-03-19 22:14

thank you!

was8bit 2021-03-20 06:13


Log in to reply.