Share your repls and programming experiences

← Back to all posts
⭕❌ Noughts And Crosses ONLINE ❌⭕
CoolJames1610 (775)

⭕❌ Noughts And Crosses ONLINE ❌⭕

An offline and online game created using Python and Pymongo

What is this?

This is a noughts and crosses game made using Python.
There are 3 gamemodes:

  • Play against the computer (offline)
  • Play against a friend (offline)
  • Play against someone online (online)

More information about each of these gamemodes will be explained later in this post.

Note that noughts are always first

How do I play Noughts And Crosses?

Have you been living under a rock? xD

The definition from Google is this:
Tic-tac-toe, noughts and crosses, or Xs and Os, is a paper-and-pencil game for two players, X and O, who take turns marking the spaces in a 3×3 grid. The player who succeeds in placing three of their marks in a horizontal, vertical, or diagonal row is the winner.

In other terms, you and another person take alternate goes to place either a naught or a cross. Once you have placed your counter, it cannot be changed until the end of the game where the board is wiped clean.
The winner is the first person who places three of their counters in a row either horizontally, vertically or diagonally.

What does "Play against the computer" mean?

This gamemode is a human vs a computer.
You will choose where you go and then the computer will decide where to go.

🙏 At the moment, the computer takes a random guess and so it's moves aren't calculated. If you would like to have an easy, medium, hard etc mode then please upvote and comment 😄 🙏

What does "Play against a friend" mean?

This gamemode is a human vs a human.
So it doesn't have to be a friend 🔥🔥🔥 if you don't have any 🔥🔥🔥

🙏 Please comment any features that you would like to see in this gamemode! 🙏

What does "Play against someone online" mean?

This gamemode is a human vs a human but they don't have to be at the same computer.
This was only made possible using MongoDB which I love 🥰🥰🥰

🙏 Again, please comment any features that should be in this gamemode! 🙏

Planned features

  • Global leaderboard
  • See anybody else's stats
  • Background timer so that you don't wait forever for someone to join that game xD
  • Ability to see and change account settings

That's all for now, I can make a tutorial if you would like to know how to make "online" games using Pymongo.
I use Pymongo to stimulate an online presence but all that happens is that it makes several calls to an online database and trades data.

I have been working on this online mode for a while now, so an upvote would be awesome!

Please inform me of any errors that you find, I've spent a few hours trying to eradicate them 😅


Ping me on repl discord @Zeliktric and if I respond then I will play with you 🙃

GG @SwaroopBappanad for beating me xD

SwaroopBappanad (240)

idk WHAT you guys are talking about, for where I come from we call it Donuts and Boomerangs.

OldWizard209 (1638)

From where I came from they call it X - O XD

DynamicSquid (5027)

Noughts And Crosses

From where I come from, we call it Circles and O's

CoolJames1610 (775)

@DynamicSquid 😂 circles and O's are the same thing

DynamicSquid (5027)

@CoolJames1610 Wait what do you mean? Like on a piece of paper, you have a 3 by 3 grid, just like the one you made, and with the same rules too, just a different name

fuzzyastrocat (1867)

@DynamicSquid Where I come from, we call it x^2+y^2=1's and x^2/y^2=1's

Leroy01010 (408)


From where I come from, we call it Circles and O's


Leroy01010 (408)


Where I come from, we call it x^2+y^2=1's and x^2/y^2=1's


firefish (950)

Circle: O
O: O
guys the SQUOD is insane

Kirit0 (34)

Hello, i am currently working on a project that has similar interface with it. Mainly being the login and attempted online communication. I was wondering if you would like to join my team for a little bit, and help me out? I was just wondering cause you have managed to do it successfully but i am still struggling. There is the link. ^-^

SwaroopBappanad (240)

I feel like there's just not enough people playing this for online play though. (By that I mean like to join your public game in a few seconds, or even a few minutes. The online play thing is still really cool though, great job!)

CoolJames1610 (775)

@SwaroopBappanad yeah online is better for private gamed


Cant join a public room :(
Its a nice repl though!

Viper2211 (85)

Nice job! If you'd like, I could help make the computer unbeatable, using the dark craft known as MINIMAX

NISHoriginal (8)

Elizurfk! Pls make ur move lol.
Great code though!

CoolJames1610 (775)

@NISHoriginal LOL xD i need to introduce a timer or something xD

Henslo (25)

I made a tic tac toe game with pygame

NoNameByProgram (198)

really, we called this x's and o's usually

Bookie0 (6407)

also, Tic Tac Toe? More like 1 0 1; we play binary lol

Bookie0 (6407)

pretty cool!

you might want to change the computer mode tho; sometimes the computer selects a position that isn't blank, this randomness, instead of strategy makes the player almost always win lol

for example why did the computer choose position B2 lol?

but other than that pretty cool! :)

CoolJames1610 (775)

@Bookie0 Yeah there isn't an algorithm at the moment :)

EpicRaisin (265)

Where I live its called sugary mints in a container + the stinky things on your feet

Leroy01010 (408)

I would like to ask for a friend in this gamemode

Leroy01010 (408)


NoNameByProgram (198)


[a] Play with a Computer
[b] Play with a Computer
[c] Play with yourself
EpicGamer007 (1755)

tic tac toe for me lol

OwenAblett (0)


Dobrinia (0)

Cool project, but when i try to play online it gives me a big error:

  File "", line 54, in <module>
  File "", line 51, in main
  File "/home/runner/jbAp2lep4py/gamemodes/", line 969, in olttt
  File "/home/runner/jbAp2lep4py/gamemodes/", line 847, in main_menu
  File "/home/runner/jbAp2lep4py/gamemodes/", line 824, in my_stats
  File "/home/runner/jbAp2lep4py/gamemodes/", line 844, in main_menu
  File "/home/runner/jbAp2lep4py/gamemodes/", line 663, in join_room
    status = x[3]
IndexError: list index out of range```