There is one game in the terminal written in Python - tic-tac-toe. It is implemented in such a way that after each command a symbol is displayed - a cross or a toe. The game is made "for two", that is, team 1 is zero, team 2 is a cross and so on, until victory. All the conditions are written down, but you need to screw the network part there, but I don’t understand how to do it at all. Articles from the network only helped to figure out what it is, but I don’t understand how to fasten it to my application or any action at all.

The interaction should be as follows:

  • player connects to another player
  • player1 enters a command, sending all its files (or their state) to player2 and player1 locks the keyboard to enter commands
  • player2 does the same
  • after some condition the interaction should be interrupted

1 answer 1

I propose to implement as a REST API. Thus, you can play either through a browser or through a terminal with console browsers or even download a page with the curl command.

 from flask import Flask app = Flask(__name__) @app.route("/") def hello(): return "Hello World!" if __name__ == "__main__": app.run()