Questions tagged [chess]
This tag is for concepts involving the game of Chess.
163
questions
15
votes
4answers
3k 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
0answers
36 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
1answer
151 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
1answer
66 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.
...
4
votes
2answers
492 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 ...
10
votes
2answers
390 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 ...
7
votes
2answers
128 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 ...
6
votes
2answers
266 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
...
3
votes
0answers
98 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 ...
16
votes
2answers
3k 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
1answer
272 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
1answer
75 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
1answer
48 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
...
4
votes
1answer
79 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
1answer
172 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
0answers
63 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
5answers
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 ...
5
votes
0answers
454 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
1answer
35 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
0answers
50 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 ...
6
votes
4answers
264 views
Finding legal knight moves in a chessboard in APL (follow-up)
This question is a follow-up to this previous question of mine. Assuming I understood correctly what is outlined in this meta post.
I wrote (and now, re-wrote) a function that takes as input a vector ...
18
votes
2answers
836 views
Finding legal knight moves in a chessboard in APL
I wrote a function that takes as input a vector with two integers between 1 and 8 representing a position in a chessboard and ...
6
votes
1answer
92 views
Design that avoids undesired dependencies in Kotlin for a chess engine
I'm trying to come up with a design for a chess engine in Kotlin that hides implementation details, and that ensures that such an implementation cannot accidentally become spaghetti.
Client side ...
1
vote
2answers
84 views
Cleaning up complex if statements for Chess game
Shown below is a function I wrote for pawn move generation, I find it difficult to understand what the code does in a glance due to the cumbersome if statements, so any changes I make are done ...
3
votes
1answer
340 views
Object-Oriented JavaScript Chess game
I am currently creating a chess game in JavaScript, some aspects are yet to be done such as the computer player and turns, but before I get into writing these features I would like to know how to ...
5
votes
1answer
136 views
Chess game: Part 1 - Creating the layout
After working on the project for 15 hours of I had my layout set 1 row and 1 column per square, no problem. Then I decided that I needed each square to have multiple rows. I would have never guessed ...
4
votes
1answer
192 views
8
votes
1answer
107 views
Printing Colored, CLId Unicode Chess Board - follow-up
Follow up to: Printing Command Line Unicode Chess Board
A couple people from the previous question mentioned looking into coloring the command line with ANSI escape sequences. In Python, ...
12
votes
3answers
3k views
Printing Command Line Unicode Chess Board
Let me preface this by detailing some of my design philosophy. The intent is to view the board from the perspective of the active player. Player moves are also factored into the design. When ...
3
votes
1answer
429 views
Chess game in JavaScript
I have created a chess game in JavaScript. Right now you can only play against another human.
...
5
votes
1answer
179 views
BitBoard class In TypeScript for chess logic
I'm working on writing a Chess Logic Library in JavaScript for learning purposes and was wondering how good these two slightly different implementations of a BitBoard are.
The first stores the board ...
7
votes
1answer
2k views
Generating a chess board with JavaScript
In another attempt to further my knowledge in the JavaScript language, I've written a chess board generator that will essentially create a chess board with any initial state supplied. This supports ...
2
votes
1answer
71 views
Functional n-queens
Following the book "Structure and interpretation of computer programs" I have tried to implement a functional solution to the problem of N-queens (implemented by the function ...
3
votes
1answer
61 views
Finding possible moves in a chess game [closed]
Recently I've been developing a chess game in Python - using pygame - just as a project for myself. I have a class for each piece type, and in each class, I have a method called ...
4
votes
1answer
120 views
Find the number of pawns available for a rook to capture
I find that very very often with matrix questions, the traversal and comparison part of the solution is very verbose and repetitive.
For example, this code (written for a coding challenge) to find ...
10
votes
2answers
1k views
Piece of chess engine, which accomplishes move generation
This is a piece of a chess - engine which accomplishes the generation of all (yet unvalidated) moves given a legal board. However, I have the strong doubt this is well written.
The following action ...
6
votes
2answers
394 views
Bishop game - python
A bishop can capture any other bishop if it lies along the same
diagonal line, so long as no other bishop is in its path.
Given a list of coordinates of the bishops locations, and a board size, ...
3
votes
0answers
532 views
Object Oriented Chess Design In Kotlin
I know there's a similar question to this: See here.
And I have taken the points mentioned there into consideration. However, I wanted to learn Kotlin and thought of writing OOP based Chess myself.
...
3
votes
2answers
177 views
Knight's Tour - Python
Below is my recursive solution for the Knights Tour. The user can set the board size and the program will print the first legal knight's tour it finds.
As there are potentially millions of correct ...
14
votes
0answers
291 views
Ruby chess engine gem
This is my first Ruby gem that claims to provide all the rules of the chess game. My goal was to keep this library as simple as possible via OOP principles, and I'd be glad to hear any feedback from ...
8
votes
3answers
520 views
Python program to calculate what pawns are safe
In chess there are eight rows numbered from 1 to 8 and 8 columns a-h. Pawns which are on the lowest row are always in danger to be captured. The objective of the program is to calculate which pawns ...
11
votes
2answers
1k views
Python Chess Game
I'm developing chess in python, and I've decided to make everything text-based before creating a GUI because it'd be my first time doing the latter. I haven't got around to the actual gameplay, but I'...
4
votes
0answers
222 views
Chess AI Using Minimax and Alpha-Beta Pruning
I am working on a Chess AI using chess.js, and currently, it can run 3 layers in under 10 seconds, but 4 or more takes minutes. How can I optimize my current code to be able to run 4 or 5 layers, or ...
3
votes
0answers
48 views
N-Queens problem using other pieces using Go
I wrote a solution to a problem based on the N-Queens problem which should use more pieces than just queens. Problem is it's very slow, it probably has to do with how I modeled data and my lack of ...
1
vote
0answers
151 views
Chess Agent using reinforcement learning with monte carlo tree search
I wanted to ask if this project is valid to state on a resume for entry-level python developer and if the code is presentable to say a job interviewer.
github link: full project
(If this is not the ...
5
votes
3answers
3k views
Chess move validator
I have written code for making a Chess Validator, which will validate the moves of a chess game.
There is a Main class which is taking the input from the user, about the move.
Problem Description
...
6
votes
1answer
311 views
Chess engine programmed in Python
I programmed a chess AI in Python. It uses the alpha-beta algorithm with move ordering. I want it to be able to look further than depth 4, without increasing calculation time. I am wondering how I ...
4
votes
0answers
282 views
Move-generation for chess in rust
In the last couple of days I have been programming a chess move generator in Rust from scratch. While it's intent is to be later used in a fully functional engine, where the speed of the move-...
1
vote
1answer
161 views
Minimum steps to reach target by a Knight In Scala
Given a chessboard of N size (square matrix), the position of Knight and position of a target, find out minimum steps (both count and exact steps) from start to target for a Knight.
If it is not ...
6
votes
4answers
4k views
Chess game design in C++
I built a chess game in C++. My main concern is the design. For example, in the board class it has a 2D array of pieces. This array represents the positions of the pieces, but the piece class also has ...