learning-python-team / chess Goto Github PK
View Code? Open in Web Editor NEW[WIP] A Chess game.
License: MIT License
[WIP] A Chess game.
License: MIT License
Worked on by - ZeroOne010101
Join the fun at: https://github.com/ZeroOne010101/Chess-1
the rows only, the columns are fine. youll likely see it if you run it and move a few pieces.
its either the array itself or the draw function.
if its the array, we need to change the inputparser and draw function, or the array itself
What specifically do we want here? On my system it looks nice (except for a slight padding issue, which I could fix)
Basically, your pieces are always shown at the bottom. So moving, say, a2 --> a3 should be valid when your pieces are actually at a2, but not when they're simply printed that way.
So what should we do? Keep the display of the board the same, no matter who's turn it is? Or have a function to translate a2 to g7 if needed?
Worked on by - Levi (Slack Name)
Right now each square is initialized to an empty piece in Board.__init__
. Then, in Board.setup
, each square is looped over and potentially replaced with another piece.
We can probably do that all in one go, and halve the work we need to do for setup. I'm thinking about moving the "which piece goes on this square?" logic to Square.__init__
, which already has access to its row & column
The current logging logs everything to the root logger, but it seems to be customary for each module to have its own logger and for root to control them but not be used.
I tried my hand at it a bit already, see the commented code at the start of main and board.
This should speak for itself:
>> chess
|
8 | ♜ ♞ ♝ ♛ ♚ ♝ ♞ ♜
|
7 | ♟ ♟ ♟ ♟ ♟ ♟ ♟ ♟
|
6 | ☐ ☐ ☐ ☐ ☐ ☐ ☐ ☐
|
5 | ☐ ☐ ☐ ☐ ☐ ☐ ☐ ☐
|
4 | ☐ ☐ ☐ ☐ ☐ ☐ ☐ ☐
|
3 | ☐ ☐ ☐ ☐ ☐ ☐ ☐ ☐
|
2 | ♙ ♙ ♙ ♙ ♙ ♙ ♙ ♙
|
1 | ♖ ♘ ♗ ♕ ♔ ♗ ♘ ♖
--+-------------------------------------------
| a b c d e f g h
white: a2 a3
|
1 | ♖ ♘ ♗ ♔ ♕ ♗ ♘ ♖
|
2 | ♙ ♙ ♙ ♙ ♙ ♙ ♙ ♙
|
3 | ☐ ☐ ☐ ☐ ☐ ☐ ☐ ☐
|
4 | ☐ ☐ ☐ ☐ ☐ ☐ ☐ ☐
|
5 | ☐ ☐ ☐ ☐ ☐ ☐ ☐ ☐
|
6 | ☐ ☐ ☐ ☐ ☐ ☐ ☐ ♟
|
7 | ♟ ♟ ♟ ♟ ♟ ♟ ♟ ☐
|
8 | ♜ ♞ ♝ ♚ ♛ ♝ ♞ ♜
--+-------------------------------------------
| a b c d e f g h
Black starts his turn with his pieces moved. This is caused by a2 a3
being translated internally to ( (1, 0), (2, 0) )
, which is at the top of the board from White's point of view. This needs to dynamically change.
I think it might be good to move main() to a seperate file to segment the project. Then put stage 2 in another file and so on, and the main file ties our files together.
error in question:
|
8 | ♜ ♞ ♝ ♛ ♚ ♝ ♞ ♜
|
7 | ♟ ♟ ♟ ♟ ♟ ♟ ♟ ♟
|
6 | ☐ ☐ ☐ ☐ ☐ ☐ ☐ ☐
|
5 | ☐ ☐ ☐ ☐ ☐ ☐ ☐ ☐
|
4 | ☐ ☐ ☐ ☐ ☐ ☐ ☐ ☐
|
3 | ☐ ☐ ☐ ☐ ☐ ☐ ☐ ☐
|
2 | ♙ ♙ ♙ ♙ ♙ ♙ ♙ ♙
|
1 | ♖ ♘ ♗ ♕ ♔ ♗ ♘ ♖
--+-------------------------------------------
| a b c d e f g h
White: a7 a6
Move from (1, 0) to (2, 0)
We can't rely on manually playing the game every single commit. We should be using pytest
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.