Skip to content
Sign upLog in
← Back to Community

⭕❌ Noughts And Crosses ONLINE ❌⭕

Profile icon
CoolJames1610

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

Voters
Profile icon
CodyRigby
Profile icon
LandonCode
Profile icon
TylerArmstrong2
Profile icon
DexterAves
Profile icon
cheesewiddaman
Profile icon
k9chelsea2
Profile icon
PureAspiration
Profile icon
jabami
Profile icon
Kirit0
Profile icon
conspicous
Comments
hotnewtop
Profile icon
OwenAblett

11
1
1
1
1
11111111111111

Profile icon
Dobrinia

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

File "main.py", line 54, in <module> main() File "main.py", line 51, in main olttt() File "/home/runner/jbAp2lep4py/gamemodes/onlinettt.py", line 969, in olttt main_menu(dbusername) File "/home/runner/jbAp2lep4py/gamemodes/onlinettt.py", line 847, in main_menu my_stats(username) File "/home/runner/jbAp2lep4py/gamemodes/onlinettt.py", line 824, in my_stats main_menu(username) File "/home/runner/jbAp2lep4py/gamemodes/onlinettt.py", line 844, in main_menu join_room(username) File "/home/runner/jbAp2lep4py/gamemodes/onlinettt.py", line 663, in join_room status = x[3] IndexError: list index out of range```
Profile icon
Kirit0

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. ^-^

Profile icon
SwaroopBappanad

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!)

Profile icon
CoolJames1610

@SwaroopBappanad
yeah online is better for private gamed

Profile icon
[deleted]

Screenshot 2020-10-12 at 1.11.50 PM

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

Profile icon
CoolJames1610

@CarlosRosiles
sorry bout that :)

Profile icon
Viper2211

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

Profile icon
CoolJames1610
Profile icon
Viper2211
Profile icon
brooc210

Cool

Profile icon
CoolJames1610

@brooc210
thanks but why scratch pfp? XD

Profile icon
brooc210

code in a header

Profile icon
CoolJames1610
Profile icon
zplusfour

Cool!

Profile icon
CoolJames1610

@ZDev1
Thanks

Profile icon
zplusfour
Profile icon
NISHoriginal

image


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

Profile icon
CoolJames1610

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

Profile icon
brooc210

@NISHoriginal
LoL again

Profile icon
Henslo

I made a tic tac toe game with pygame

Profile icon
CoolJames1610
Profile icon
NoNameByProgram

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

Profile icon
Bookie0

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

Profile icon
Bookie0

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?

Screen Shot 2020-10-10 at 6.41.22 PM

but other than that pretty cool! :)

Profile icon
CoolJames1610

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

Profile icon
Bookie0

oh ok lol, good luck! :)

@CoolJames1610

Profile icon
EpicRaisin

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

Profile icon
OldWizard209

No offence

@CoolJames1610
but the computer is a big noob

Profile icon
CoolJames1610
Profile icon
OldWizard209

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

Profile icon
Leroy01010

Screen Shot 2020-10-10 at 21.39.36

I would like to ask for a friend in this gamemode

Profile icon
Leroy01010

I have been living under a rock

@Leroy01010

Profile icon
CoolJames1610
Profile icon
Leroy01010

Screen Shot 2020-10-10 at 21.37.38

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

Profile icon
NoNameByProgram

@Leroy01010

[a] Play with a Computer [b] Play with a Computer [c] Play with yourself
Profile icon
Leroy01010
Profile icon
CoolJames1610
Profile icon
SwaroopBappanad

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

Profile icon
CoolJames1610
Profile icon
NoNameByProgram

in my land we call it sudoku

Profile icon
Leroy01010
Profile icon
EpicGamer007

tic tac toe for me lol

Profile icon
DynamicSquid

Noughts And Crosses

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

Profile icon
CoolJames1610

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

Profile icon
DynamicSquid

@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

Profile icon
CoolJames1610

@DynamicSquid
oh okay 😅

Profile icon
fuzzyastrocat

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

Profile icon
SwaroopBappanad
Profile icon
Leroy01010

LOL 😂

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

@DynamicSquid

Profile icon
DynamicSquid
Profile icon
Leroy01010

LOL

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

@fuzzyastrocat

Profile icon
Leroy01010

XD

@DynamicSquid

Profile icon
firefish

@DynamicSquid

Circle: O
O: O
guys the SQUOD is insane

Profile icon
DynamicSquid

@firefish
lol xD!

Profile icon
Leroy01010