Questions tagged [chess]

This tag is for concepts involving the game of Chess.

Filter by
Sorted by
Tagged with
1
vote
0answers
21 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 ...
4
votes
4answers
217 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 ...
15
votes
2answers
691 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
68 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
79 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
96 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
78 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
124 views

N queens problem in python

I just tried to create a program for the N queens problem. ...
8
votes
1answer
65 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 ...
1
vote
1answer
96 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
36 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
88 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
729 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
63 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
52 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
82 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
343 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
121 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
80 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 ...
12
votes
0answers
185 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
467 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
529 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
111 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
43 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
123 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
1k 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
184 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
181 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
94 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
300 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
367 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
249 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
1k 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
357 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
204 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
8k 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
368 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
74 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
99 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
188 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 ...
2
votes
2answers
914 views

HackerRank - Queens Attack II - Java

The problem definition can already be found here. Given a chess board with dimensions n × n (where n is up to 100000) and the (r, c) positions of various obstacles, how many squares can a queen at a ...
3
votes
3answers
228 views

Counting possible moves for a queen

The challenge is this: You have a function that is passed a board length (8x8 chess board), with the coordinates of the queen's location, along with an array of obstructions (opponents). Given the ...
-3
votes
1answer
2k views

Python class for chess pieces [closed]

Please review my current try of creating a class for chess pieces. I not only want to be able to play a game of chess with this but also solve chess puzzles, thats why I want a flexible board size and ...
8
votes
1answer
549 views

Beginner's Knight's tour in Python (BFS)

I wanted to implement this as short and effective as I could without using anything that is not basics, in order to improve my skills. I would appreciate input about things like memory leaks I missed,...
6
votes
1answer
258 views

Find total of non-attacked positions in a Chess board - UVA 10284

The input is until EOF, give in the FEN notation. The output should be the count of non-attacked positions. My code passes in all test cases in uDebug, but it doesn't pass on the hidden cases. All ...
6
votes
1answer
3k views

Calculate knight moves

This is my first little python project. I want to get to a point where i can solve chess puzzles like this one from puzzling.stackexchange. I want to be able to change the board size to something like ...