guyver2 / battlechess Goto Github PK
View Code? Open in Web Editor NEWChess with Battleship modification. You can only see around your pieces.
Chess with Battleship modification. You can only see around your pieces.
No game is not an error. The server should return code 200 and an empty array.
File "./server/btchApi.py", line 317, in post_move
snap = crud.create_snap_by_move(db, current_user, game, gameMove)
File "./server/crud.py", line 175, in create_snap_by_move
snapOptions = game.moveGame(gameMove.move)
File "./server/models.py", line 117, in moveGame
new_snap_options = current_snap.moveSnap(move)
File "./server/models.py", line 178, in moveSnap
board = self.toBoard()
File "./server/models.py", line 205, in toBoard
board.updateFromElements(self.board, self.taken, self.castelable, enpassant, winner)
File "./core/Board.py", line 550, in updateFromElements
self.taken = [self.dbpiece2board(c) for c in taken]
File "./core/Board.py", line 550, in <listcomp>
self.taken = [self.dbpiece2board(c) for c in taken]
AttributeError: 'Board' object has no attribute 'dbpiece2board'
The following internal server error happens when the user issuing the query has finished games
INFO: 31.10.154.26:52836 - "GET /users/me/games/ HTTP/1.1" 500 Internal Server Error
2021-05-26 20:22:27,521 INFO sqlalchemy.engine.Engine ROLLBACK
ERROR: Exception in ASGI application
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/uvicorn/protocols/http/h11_impl.py", line 396, in run_asgi
result = await app(self.scope, self.receive, self.send)
File "/usr/local/lib/python3.6/site-packages/uvicorn/middleware/proxy_headers.py", line 45, in __call__
return await self.app(scope, receive, send)
File "/usr/local/lib/python3.6/site-packages/fastapi/applications.py", line 199, in __call__
await super().__call__(scope, receive, send)
File "/usr/local/lib/python3.6/site-packages/starlette/applications.py", line 111, in __call__
await self.middleware_stack(scope, receive, send)
File "/usr/local/lib/python3.6/site-packages/starlette/middleware/errors.py", line 181, in __call__
raise exc from None
File "/usr/local/lib/python3.6/site-packages/starlette/middleware/errors.py", line 159, in __call__
await self.app(scope, receive, _send)
File "/usr/local/lib/python3.6/site-packages/starlette/middleware/cors.py", line 78, in __call__
await self.app(scope, receive, send)
File "/usr/local/lib/python3.6/site-packages/starlette/exceptions.py", line 82, in __call__
raise exc from None
File "/usr/local/lib/python3.6/site-packages/starlette/exceptions.py", line 71, in __call__
await self.app(scope, receive, sender)
File "/usr/local/lib/python3.6/site-packages/starlette/routing.py", line 566, in __call__
await route.handle(scope, receive, send)
File "/usr/local/lib/python3.6/site-packages/starlette/routing.py", line 227, in handle
await self.app(scope, receive, send)
File "/usr/local/lib/python3.6/site-packages/starlette/routing.py", line 41, in app
response = await func(request)
File "/usr/local/lib/python3.6/site-packages/fastapi/routing.py", line 218, in app
is_coroutine=is_coroutine,
File "/usr/local/lib/python3.6/site-packages/fastapi/routing.py", line 126, in serialize_response
raise ValidationError(errors, field.type_)
pydantic.error_wrappers.ValidationError: 1 validation error for Game
response -> 0 -> turn
none is not an allowed value (type=type_error.none.not_allowed)
ATM Board gives different error messages if one player tries to move and is blocked, the piece isn't his etc.
Potentially, a player could send a move on an enemy square and know wether there's a piece there or not.
These messages are very nice for debugging, but should be silenced/uniformized in "production" mode.
A player should be able to go back in time for an ongoing game and see previous board state.
When a player is black, the board should be flipped upside-down so that he also sees his pieces at the bottom of the screen
@quimnuss @Geniedesalpages opinion ?
test__integrationTest__foolscheckmate fails 1/2 of the time because it expects the game owner to be white.
Right now possiblemoves and moves are split into three classes. Unify the three.
Today the API accepts user creation with empty username or password.
we should limit that with the following rules for user creation
When currently accepting a public game, the game disappears from the list. Either move to the live tab or even better, open the game directly.
Can only be run with python 2.7.
python 2.7 is medieval.
We need a endpoint that returns only a single user based on its uuid.
So far if we want a user info we need to query all users :/
the current content-length in image header is exploitable, see:
A user should be able to remove open games that have been create (public and private) if they have not been started yet.
Starting a new game and requesting the possible moves for the king returns an error
INFO: 194.230.158.218:49692 - "GET /games/hxjktq/moves/e1 HTTP/1.1" 500 Internal Server Error
2021-05-22 17:18:03,818 INFO sqlalchemy.engine.Engine ROLLBACK
ERROR: Exception in ASGI application
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/uvicorn/protocols/http/h11_impl.py", line 396, in run_asgi
result = await app(self.scope, self.receive, self.send)
File "/usr/local/lib/python3.6/site-packages/uvicorn/middleware/proxy_headers.py", line 45, in __call__
return await self.app(scope, receive, send)
File "/usr/local/lib/python3.6/site-packages/fastapi/applications.py", line 199, in __call__
await super().__call__(scope, receive, send)
File "/usr/local/lib/python3.6/site-packages/starlette/applications.py", line 111, in __call__
await self.middleware_stack(scope, receive, send)
File "/usr/local/lib/python3.6/site-packages/starlette/middleware/errors.py", line 181, in __call__
raise exc from None
File "/usr/local/lib/python3.6/site-packages/starlette/middleware/errors.py", line 159, in __call__
await self.app(scope, receive, _send)
File "/usr/local/lib/python3.6/site-packages/starlette/middleware/cors.py", line 86, in __call__
await self.simple_response(scope, receive, send, request_headers=headers)
File "/usr/local/lib/python3.6/site-packages/starlette/middleware/cors.py", line 142, in simple_response
await self.app(scope, receive, send)
File "/usr/local/lib/python3.6/site-packages/starlette/exceptions.py", line 82, in __call__
raise exc from None
File "/usr/local/lib/python3.6/site-packages/starlette/exceptions.py", line 71, in __call__
await self.app(scope, receive, sender)
File "/usr/local/lib/python3.6/site-packages/starlette/routing.py", line 566, in __call__
await route.handle(scope, receive, send)
File "/usr/local/lib/python3.6/site-packages/starlette/routing.py", line 227, in handle
await self.app(scope, receive, send)
File "/usr/local/lib/python3.6/site-packages/starlette/routing.py", line 41, in app
response = await func(request)
File "/usr/local/lib/python3.6/site-packages/fastapi/routing.py", line 202, in app
dependant=dependant, values=values, is_coroutine=is_coroutine
File "/usr/local/lib/python3.6/site-packages/fastapi/routing.py", line 150, in run_endpoint_function
return await run_in_threadpool(dependant.call, **values)
File "/usr/local/lib/python3.6/site-packages/starlette/concurrency.py", line 34, in run_in_threadpool
return await loop.run_in_executor(None, func, *args)
File "/usr/lib64/python3.6/concurrent/futures/thread.py", line 56, in run
result = self.fn(*self.args, **self.kwargs)
File "./server/btchApi.py", line 355, in get_moves
moves = snap.getPossibleMoves(square, color)
File "./server/models.py", line 228, in getPossibleMoves
ijmoves = board.possibleMoves(color, i, j)
File "./core/btchBoard.py", line 211, in possibleMoves
moves = list(self.kingMoves(color, i, j))
File "./core/btchBoard.py", line 270, in kingMoves
if k in self.castelable:
AttributeError: 'BtchBoard' object has no attribute 'castelable'
When a player select a piece, the UI should show the list of possible moves.
Provide a way to upload avatars (png, jpeg, resize everything to 200x200 px). It should return the URL of the newly created avatar.
Create a database to handle users, games and invites
Currently the default login is currently Antoine, it would be nice if it was empty and it's prefilled by the browser.
You can currently not see the pieces that you have taken. While this is an interesting variant of the game, it's probably better to have the taken pieces shown in the default game.
I think it only checks that the chosen piece matches the color of the turn, but not that the player sending it is the right color.
Once #48 is accepted there'll still be an integration issue: it doesn't use avatar column in User. Should it?
There's also the 200x200 resizing and image verify missing, for that we need Pillow python module to process images.
Create a full definition of the REST API to be used for Battlechess
GET /games/{gameUUID}/moves/{starting position}
Kind of like the create user endpoint, but for modification. All values should be editable except for the username.
/games/{gameUUID}/snap
/games/{gameUUID}/snap
/games/{gameUUID}/snap/{moveNum}
/games
/games/{gameuuid}
Replay mode for game that are finished.
Should include:
Pawns are automatically promoted to queens.
Add support for promotion move specifying which piece does the player want.
Today someone posting a new game doesn't end-up being part of the game. This is odd.
Here is how I think it should work initially:
This way we don't end up with new games with 0 player in it and a player creating a game doesn't have to join it.
Define what technology to use on server side (flask, django, node.js, ...) Ideally in python because of the existing codebase.
Today a query on /users returns a list of users that includes too much information. We should remove the lists games
, whites
and blacks
[
{
"username": "string",
"full_name": "string",
"email": "string",
"id": 0,
"status": "string",
"games": [],
"whites": [],
"blacks": []
}
]
When I try to select the handle text it seems to refresh the element and deselects it.
Since there also isn't a link to the game, the handle has to be copied by hand to share
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.