sub's People
sub's Issues
Rename GameLocalPlayerAdapter to LocalPlayerAdapter
Important: check the doc for possible modification after the renaming.
Change EventEngine 'connect_adapter' method name to 'add_ui'
To be consistant with the main logic of the project, the adapter should not be a notion known by the EventEngine
.
Add get_available_pids method in GameEngine
Write a method to get the list of pids corresponding to removable players. This method could be used by a player that wants to join the game.
Write documentation about this method in doc/game.md:removable players
Connect players to game
Change the way players connect to the game, to be consistant with the documentation (doc/general_architecture.md). More precisely, it should be:
game = GameEngine()
player = AIPlayer(0) # 0 is the player ID
padapt = LocalPlayerAdapter(player)
game.add_player(padapt)
Set cards of hands manually
Add the possibility to set cards manually for controlled players, in order to interface Players (AI or UI) with another instance of the game (for instance belote-en-ligne.fr).
Create SeatAlreadyTaken exception
When a player try to join a game with an id that is already taken by a non-removable user, the GameEngine
should raise an explicit exception (and not IndexError
).
Relative code:
https://github.com/BobCitron/Sub/blob/refactoring_2/src/game/game_engine.py#L58-L59
https://github.com/BobCitron/Sub/blob/refactoring_2/main.py#L37
https://github.com/BobCitron/Sub/blob/refactoring_2/src/ui/ui_table.py#L344-L345
Socket communication
Create a client and a server to dialog through sockets. The two main aims are:
- Connect remotely players to a game
- Connect remotely UI to a game
The general idea is described in doc/general_architecture.md
.
A documentation should also be provided with implementation.
Create IUIAdapter
- Create an adapter interface to define correctly the methods that a UIAdapter should implement.
- UIAdapter should inherit from this interface.
Explicit imports
Add all imports needed in code snippets in the doc. For instance (from doc/general_architecture.md
):
game = GameEngine()
evt = EventEngine()
game.connect_event_manager(evt)
should be:
from src.game.game_engine import GameEngine
from src.event.event_engine import EventEngine
game = GameEngine()
evt = EventEngine()
game.connect_event_manager(evt)
Player adding in GameEngine
Use the add_player
method in the GameEngine
constructor to add default players instead of putting them in the list directly.
Change UIAdapter into LocalUIAdapter
The UIAdapter should be more specific, as we can imagine different UI adapters in the future, and more precisely RemoteUIAdapter.
Set `is_removable` in kwargs to be explicit
The parameter ìs_removablein
Playerconstructor should be passed through kwargs for more clarity. Also add a default value to
False`.
Example:
Player(0, is_removable=True
) is clearer than Player(0, True)
.
Review interfaces
Some interfaces does not have the correct prefix (i_
), e.g. console.py should be i_console.py
.
- Check that every interface has the correct prefix
- Check that every method defined by an interface is decorated with
@abstractmethod
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.