Questions tagged [chess]

This tag is for concepts involving the game of Chess.

Filter by
Sorted by
Tagged with
4
votes
1answer
47 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
96 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 ...
1
vote
0answers
57 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 ...
30
votes
4answers
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
83 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
28 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
45 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
245 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
796 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
76 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
144 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
105 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
147 views

N queens problem in python

I just tried to create a program for the N queens problem. ...
8
votes
1answer
73 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
2k 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
216 views

Chess game in JavaScript

I have created a chess game in JavaScript. Right now you can only play against another human. ...
0
votes
0answers
49 views

BitBoard Class in TypeScript for Chess Logic Follow Up

I am working on a BitBoard implementation in TypeScript for a Chess Logic library I am building for educational purposes. This is an updated version based on feedback I received in my previous ...
5
votes
1answer
119 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
1k 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
66 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
55 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
87 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
358 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
180 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
98 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 ...
13
votes
0answers
228 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
482 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
701 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
141 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
44 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
133 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
2k 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
206 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
207 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
109 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
2k 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 ...
5
votes
2answers
326 views

Chess Simulation

Part of the program I wrote simulates a Chess game choosing random moves for each player until it's a draw or win for either player. It takes 3 seconds to complete 1 simulation and since it trains ...
3
votes
1answer
71 views

Mark positions attacked by a queen on a chess board

Problem - Given a chess board and the position of only one queen piece in it, mark all the position where the queen can move with X. Kindly review this Scala code and suggest improvements. ...
10
votes
2answers
470 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
0answers
288 views

PHP Chess Part 1 - ASCII Board & Import Position

I have been really into chess lately so I decided to program the game in PHP for practice. I want to get more comfortable with classes. Part 1 of the project is complete. I have a working ASCII board ...
0
votes
1answer
2k views

Object oriented design of chess game [closed]

I was trying to design a chess game in Java. I have just started learning design patterns and am not sure if my approach here is right. Could you please suggest ways to better this design ? Below is ...
3
votes
2answers
375 views

Demonstration of ChessBoard Traveling (CoderByte)

Problem Have the function ChessboardTraveling(str) read str which will be a string consisting of the location of a space ...
4
votes
1answer
264 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 ...
14
votes
2answers
9k views

Chess application in Java

This is my very first project in java. I would love some feedback on my design. How the same implementation can be better written. Idioms, conventions, anything that comes to your mind. I hope I have ...
5
votes
0answers
382 views

Backtracking solver for n queens problem and knight's tour

Playing with https://ocaml.org/learn/tutorials/99problems.html#Miscellaneous-Problems I wrote a backtracking solver for the n queens problem, then the knight's tour, and realised I could generalise ...
2
votes
1answer
75 views

Determine if 1 Queen can take King

This challenge was pretty simple - be given the coordinates of a king and a queen on a chess board and determine if the king is in check. Input is the number of test cases with each test case on a ...
3
votes
1answer
111 views

Solving Knight's Travails Problem without using vector for position

I'm trying to implement a solution to the The Odin Project - Project 2: Knight’s Travails in Clojure (Functional Programming) based on the solution posted by benjdelt. I would like to know your ...
4
votes
1answer
206 views

Generating and printing chess board in Rust

This is the beginning of a chess program I'm writing in Rust. I'm new to Rust, so while this program works, I'm sure there are many improvements that could be made. For instance, I wanted to declare ...