c2vi / fsst-battleships Goto Github PK
View Code? Open in Web Editor NEWA battleships game implementation as part of a school project.
License: MIT License
A battleships game implementation as part of a school project.
License: MIT License
this task no longer includes any message handling
make a class Player, of which an object is created, when ever a player connects. and added to the player Dict
this Player class holds things like the player_id, the connection obj, player_name.....
it gets all those things passed to the constructor
has a method: set_name(name), to set the name of the player
the handle_socket() is a function outside of the Server Class.
gets the following params: handle_socket(server_obj, player_obj)
and is run in another thread (which it already is)
the handle_message(server_obj, player_obj, message) gets those params
branch: prototype-client
branch: server-start
store each client-socket, the name in a dict and give them an id
the client message handling
make a Client class (name: Client, file: client/main.py)
that listens for messages from the server and calls methods from the Gui Main Window class
and exposes methods, to interact with the game, for the Gui class to call
run the window (main gui class) in another thread
in server/main.py every conn gets set as self.conn, so when a new client connects, his connections overwrites the one from the old client.
branch: handle-msg
add the switch over all message types in handle_message()
When the server receives a message that is not valid json, then send back an error msg with the message: "what you sent was not valid JSON", and print "received a message that was not valid JSON"
branch: client-gui
file: gui/matchmaking.py, gui/main.py
add a game class in a file server/game.py which stores the state of a game, and has methods to get this game-state and do things to the game.
improve (or add a way) the way code from the handle_message accesses game state (like the list of players)
make a method for all the things the handle_message function has to do (for that go through the proto.md file)
eg: a method for getting the list of players: get_player_list()
and dfinetly one to send a message to another player: send_to_player(player_id, msg)
parse the config.toml file into a python dictionary
branch: parse-toml
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.