Share your repls and programming experiences

← Back to all posts
AI Tic Tac Toe
MerlinKnight (132)

This is a tic tac toe program where you can play against a friend or an AI.

Commentshotnewtop
Warhawk947 (183)

very good for a first project, i suggest learning more python so you can significantly shorten your lines of code

MerlinKnight (132)

@Warhawk947 Most of it is if statements how can I shorten it?

druceb (11)

@Warhawk947 bruh it’s not even his first project. You just ended his whole career!!

Warhawk947 (183)

@druceb oh sorry i didn't know

Warhawk947 (183)

@MerlinKnight you could put most things into function and then reuse the code when necessary

PH1 (141)

@MerlinKnight "first project" 🤡🤡🤡🤡🤡

CoolestDoggo (24)

The ai basically lets you setup a 2 way win condition since it's just random at first.
Still pretty neat, but I personally think a self learning ai would be much more impressive (though it would be a lot more difficult).

TaylorLiang (315)

bruh this isnt AI. Its just picking random numbers. Its not learning anything

CoolestDoggo (24)

@TaylorLiang Something that learns would be a form of neural network. While yes it wouldn't be an ai if it was just random, an ai doesn't have to "learn" anything. It can just be hard coded rules.
edit: Also it does seem that it has hard coded rules, therefore it is an ai.

TaylorLiang (315)

@CoolestDoggo bruh, no, it has to learn. Thats the whole point of an ai.

CoolestDoggo (24)

@TaylorLiang An ai is an artificial intelligence, it has nothing to do with learning on its own. As I said you are thinking of a neural network (or machine learning in general), a form of ai.

PrivateGER (1)

This isn't AI, lol

MerlinKnight (132)

@PrivateGER I have updated it now. it is now AI

PrivateGER (1)

@MerlinKnight You should remove the gigantic if clause on line 168 and replace it with an isnumeric() check. Checking nine conditions is a bad idea.

MerlinKnight (132)

@PrivateGER I have searched up isnumeric() and it says that it replies with False if at least one character is not a number. I would need it to reply False if all the characters weren't numbers.