Share your repls and programming experiences

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

⭕❌ 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 😅

@CoolJames1610

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

GG @SwaroopBappanad for beating me xD

Commentshotnewtop
SwaroopBappanad (45)

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

DynamicSquid (4377)

Noughts And Crosses

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

CoolJames1610 (645)

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

DynamicSquid (4377)

@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 (1270)

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

Leroy01010 (382)

LOL 😂

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

@DynamicSquid

Leroy01010 (382)

LOL

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

@fuzzyastrocat

firefish (779)

@DynamicSquid
Circle: O
O: O
guys the SQUOD is insane

Kirit0 (23)

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. https://repl.it/teams/join/yldpasaoeixeoadyxdtoeuixjkiwyufh-DreamVTechno There is the link. ^-^

SwaroopBappanad (45)

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 (645)

@SwaroopBappanad yeah online is better for private gamed

[deleted]

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

Viper2211 (83)

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

CoolJames1610 (645)

@brooc210 thanks but why scratch pfp? XD

NISHoriginal (7)


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

CoolJames1610 (645)

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

hello1964 (26)

I made a tic tac toe game with pygame

NoNameByProgram (168)

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

Bookie0 (4544)

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

Bookie0 (4544)

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 (645)

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

EpicRaisin (194)

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

abdullahrajput9 (238)

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

Leroy01010 (382)

I would like to ask for a friend in this gamemode

Leroy01010 (382)

:,( NO NEED TO SAY A THING...

NoNameByProgram (168)

@Leroy01010

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

tic tac toe for me lol