Questions tagged [chess]
This tag is for concepts involving the game of Chess.
193
questions
2
votes
1
answer
71
views
C++ Chess Engine - Initialization of Magic Bitboard Attack Tables
I've just completed the generation of magic bitboard attack tables for bishops and rooks in my C++ chess engine.
Main Questions
The functions generateMagicNumbers()...
2
votes
0
answers
79
views
Minimal Chess Web GUI with Flask
Being a big chess fan, I finally started developing my own chess tool, however I'm already quite dissatisfied with where it's going...
folder structure:
...
8
votes
2
answers
1k
views
Checking if a chessboard presented as a dictionary, is a valid chessboard
Here's my solution to the Chess Dictionary Validator project in Automate the boring stuff by Al Sweigart. I'd love to know how I can improve this code so that it's more efficient. Thank you
Function ...
6
votes
4
answers
202
views
2-Player Chess in WinForms V.2 (With Separation of Concerns)
Introduction
After getting initial feedback on my first working version of this Chess WinForms game here, I have used the suggestions and comments from there to come up with this new version, trying ...
4
votes
3
answers
251
views
Fully-functioning chess game in Python
This post is in succession to this question. I have implemented all functionalities like castling, en-passant, pawn promotion etc. 50 move rule and 3-move repetition is pending.
I would like my code ...
3
votes
2
answers
270
views
2-Player Chess in WinForms
Introduction
I decided to program a two player Chess game in C# windows forms to help me to improve my programming skills and OOP skills.
I have come to a working finished program (as far as I can ...
7
votes
2
answers
995
views
Chess Game with GUI in C++ using SDL2
Introduction
So, I recently completed a chess game with a GUI in Python, using Pygame. Upon research, I learned that Pygame is built on SDL, and since I wanted to practice C++ more, I decided to code ...
8
votes
2
answers
989
views
Text based chess game in Python
I have reached a significant milestone since the start of my chess game project. I have implemented all basic functionality. There is no castling, en passant and pawn promotion yet but I have ...
7
votes
1
answer
201
views
Chess position representation with FEN parser
I'm developing a UCI chess engine and as part of my engine I need a position representation that stores the position of every piece on the board and all the information about the game, like castling ...
2
votes
0
answers
182
views
Checkers move validator in Python 3
I have 3 classes to create a simple checkers move validator. The entry point is checkers.py and is mostly complete with a few things hard-coded. For example, the auto-generated board (if none is given)...
4
votes
1
answer
869
views
Java 2 Player Object Oriented CLI Chess Game
I just finished implementing a Java 2 player CLI chess game, it involves player putting in commands (i.e "move e2 e4" to move or "attack d1 d5" to capture.).
I am trying to follow ...
2
votes
0
answers
194
views
Is MVC an overkill for a chess CLI game?
I am working on a CLI chess game that only involves 2 human players, I decided to make it follow the MVC architecture to ensure separation of concern and to make the possibility of a GUI/web ...
2
votes
1
answer
365
views
Chess game setup: Initial board state
This app only creates a chess board set to the start-of-game state. It does nothing else. I'd appreciate feedback on the files that are relevant to this board setup (all shown below: board.cpp, pieces....
3
votes
1
answer
456
views
Can two knights pieces attack one another from current positions?
I am working on my Python skills and would like some feedback on this problem I have tried to solve. I would like to return a boolean if two knights at their current position can attack each other ...
2
votes
1
answer
200
views
Automate the Boring Stuff Chapter 5 Project - Chess Dictionary Validator
First post, very new to programming. This is my solution for the chapter 5 project of Automate the Boring Stuff and I wondered if I am making any mistakes and is there a way to make it more efficient ...
8
votes
1
answer
578
views
Making this python chess engine faster
I've implemented a chess engine using the python chess move generation library (which I assumed to be reasonably fast), and have implemented various optimisation techniques for search and move ...
1
vote
1
answer
233
views
C++ Chess Engine - (Magic)Bitboard-based move generation
I am currently writing a bitboard-based Chess Engine in C++, and I recently finished the move generation. I am using move-lookup-tables that get pre-calculated at application startup for sliding and ...
6
votes
1
answer
146
views
Chess game for two human players
I'm relatively new to programming, as in my second semester of college. To practice C, I started work on a chess game. I'm wondering if there are ways I could improve my code, make it look more ...
2
votes
2
answers
130
views
Basic chess engine
I'm playing around with a chess engine that I wanted it to know all the rules such as pawn promotion, en-passant, and castling. Currently, I'm using a basic Negamax for the AI but I plan to improve at ...
7
votes
1
answer
395
views
Find all possible ways a rook can move to a diagonally opposite corner without going back to an already visited square
This question seems similar to this one: Find number of unique paths to reach opposite grid corner but is entirely not. For moving from upper-left corner to lower-right corner we are not restricted to ...
2
votes
0
answers
61
views
Chess quiz web site
I'm working on a personal project to build a website that quizzes users on chess opening theory moves. I know my code is not very object-oriented but I am working on refactoring it right now. I just ...
1
vote
0
answers
91
views
First attempt at chess in Python #2
Almost a month ago I asked for some review of my first attempt at Chess in Python, with the main goal being to start learning inheritance in Python. It can be found here: First attempt at chess in ...
4
votes
3
answers
554
views
Clean up Knight Movement method in a chess project with duplicate code
I am writing a chess project using C++ and SDL. In this method I calculate all available moves a Knight can make and I want to refactor it. I basically move the knight Up/Down 2 squares and then Left/...
15
votes
5
answers
3k
views
First attempt at chess in Python
Since I have barely used inheritance in Python, I wanted to make something that would make use of it so I have attempted to create a game of chess, where each piece uses inheritance. I also did this ...
5
votes
1
answer
75
views
I'm writing a python chess UI+backend and I would like feedback on where there are issues before I continue to expand it
Firstly, the code relies on importing images, so I'll link to the repository as well as including the code here. If it's an issue that images need to be downloaded OR there is another solution please ...
1
vote
2
answers
213
views
Chess engine generates moves
I am currently writing a chess engine to improve my C++. I was able to improve my first results in terms of performance. (It is still really weak, but it does not lose a queen in one move)
I ended up ...
18
votes
2
answers
3k
views
Chess engine for C++
Basic Description
What is the program for?
This is just a hobby project for me to improve at coding, not a serious one.
What does the program do?
It can take a chess position (not including variations ...
3
votes
2
answers
376
views
Chess in Kotlin
This is an updated version of my first question:
Chess game in Kotlin
I wrote the following Chess logic in Kotlin and am looking for feedback to make the code cleaner and follow good software design ...
2
votes
1
answer
595
views
Chess game in Kotlin
I wrote the following Chess logic in Kotlin and am looking for feedback to make the code cleaner and follow good software design principles. I tried to adhere to object-oriented design.
Some notes:
• ...
15
votes
4
answers
4k
views
Chess engine for chess without checks in C++
Project Description:
Chess without checks: A chess variant where you can take the enemy king.
This engine implementation is for chess without checks. Since checks don't exist, expect the code to not ...
2
votes
0
answers
62
views
minmax evaluation with alpha beta pruning [closed]
I'm making some small board game and wanted to code a very simple greed AI with this algorithm. It turns out it doesn't play the most greedy moves, it is simply not working. I'd appreciate any ...
1
vote
1
answer
2k
views
Simple console chess game C++
So I implemented a simple console-based, offline player vs. player chess game in C++17. I am aware that there are multiple chess-specific features I have not yet added, but the core gameplay works ...
1
vote
1
answer
229
views
Little chess game with python
I am pretty sure my code does not follow PEP 8 and would definitely want someone to point out my errors specifically. I am open any form of criticism or suggestions.
...
5
votes
2
answers
623
views
Chess Dictionary Validator (Python) (Automate The Boring Stuff)
This is an exercise in the Automate The Boring Stuff book. I am supposed to create a function that takes a dictionary argument that represents a chess board (ex: {'1h': 'bking', '6c': 'wqueen', '2g': ...
3
votes
2
answers
1k
views
Chess game object-oriented
This is an object-oriented Chess game. So far, I have implemented the pawn and board functionalities and I would love to get a ...
11
votes
2
answers
3k
views
Parsing a Chess FEN
What is an FEN?
Link to the Wikipedia page: Forsyth–Edwards Notation
An FEN is a very simple way of representing a chess position in a single line string. It contains the following data
Which piece ...
6
votes
2
answers
907
views
Hackerrank's Queen's Attack II
https://www.hackerrank.com/challenges/queens-attack-2/problem
A queen is standing on an nxn chessboard. The chessboard's rows are numbered from 1 to n, going from bottom to top; its columns are ...
5
votes
2
answers
356
views
Finding the number of moves a knight can perform while standing on a given square
This is a problem from CodeSignal which can be founded over here
Here is an image on what we have to do:
Code
...
4
votes
0
answers
419
views
Simple chess engine in Python
I have programmed a chess AI in python as a first project to learn both Python and the inner workings of a chess engine and wanted to have some input on syntax, code efficiency and any tips in general ...
17
votes
2
answers
5k
views
C++ chess game engine using Minimax and alpha-beta pruning;
My chess game is over, everything has been finished, except for some special (like en passant)moves.
The main part of the game is its engine which I have coded using the Minimax algorithm with alpha-...
4
votes
1
answer
1k
views
C++ generator function for a Chess game
Here is my code for a move generator function for a chess engine. It's currently working perfectly and returning fully legal moves. How can i improve it.
I am looking to improve this generator ...
0
votes
1
answer
129
views
Move generation n c++ for Knight [closed]
So I have been working on this Chess project and for that I need a move generator. I wish to know if I can improve my code for the move generation for the Knight. Here is my current code;
Let me tell ...
4
votes
1
answer
145
views
Transforming UCI-move into bitboard, chess
I want to transform a UCI-move into bitboard.
for example a2a3 -> 32768, 8388608
I need to assign [7,6,...,0] to [a,b,...,h] so that for each letter i have the assigned number(n) to calculate 2^n
...
5
votes
1
answer
388
views
Decode FEN string into separate variables for the 6 categories
FEN strings are compact representations of chess board positions which allows you to derive the necessary information to start playing a chess game from that position. This includes things like the ...
7
votes
1
answer
1k
views
Chess application with GUI and AI in Java
I've included the files that I felt were relevant (i.e I haven't included the individual pieces in the inheritance hierarchy). I'm particularly curious as to whether the system as a whole is ...
2
votes
0
answers
117
views
Find the available squares for rooks in empty board using boolean arrays
I will describe two techniques, then the question will be how I can make an algorithm that is more efficient, if possible.
I want to find an efficient way to determine the squares where the pieces on ...
32
votes
5
answers
5k
views
Chess game for my students
I teach programming, and I currently teach my class about inheritance, abstract classes, and mixins.
I wrote this code as an example, and I want to be sure it is as good as possible before I release ...
4
votes
0
answers
1k
views
A simple chess engine in Haskell
This is my first Haskell project so I don't really have a good feel for what makes Haskell code clean, so they'll be lots of things that can be improved.
Things I have a gut feeling are bad design:
...
0
votes
1
answer
56
views
Cleaning up Javascript event listener that manages game-loop
As I added more features to my chess game, such as an endgame screen. I eventually ended up having a lot of duplicate code, and complex logic with lots of nested if statements in loops. The usual ...
1
vote
0
answers
61
views
Design to separate client API from internal API in Kotlin for a chess engine
This is a follow-up from my previous review on this site. To be clear, the code is stand-alone, and does not depend on the previous review.
As before my goal is to come up with a design for a chess ...