Questions tagged [chess]

This tag is for concepts involving the game of Chess.

Filter by
Sorted by
Tagged with
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 ...
9
votes
4answers
414 views

Checking if a Chess space has been attacked

I have this list of at least seven else-if. When their condition is met, I change the same boolean is_attacked to ...
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. ...
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 ...
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 ...
5
votes
2answers
603 views

Diagonal Movement Code for Python Chess Engine

I'm currently in the process of building my own Chess game engine and could really use some suggestions on how to make this segment of code for calculating diagonal moves more efficient. (This is ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
10
votes
2answers
1k views

PHP Chess Version 2

For programming practice, I created a chess program in PHP (my most comfortable language). The program reads a FEN (a string with the location of all the pieces on the board) from the URL, generates ...
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

N queens problem in python

I just tried to create a program for the N queens problem. ...
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. ...
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 ...
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 ...
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 ...
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'...
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 ...
18
votes
4answers
73k views

Chess game in Python

I have programmed for 2 months, and I began writing a Chess game. I am a beginner programmer in Python, so please assess my code. ...
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 ...