All Questions
55 questions
1
vote
0
answers
91
views
Find out how many possible chessboard piece configurations there are where a capture is not possible
Given an NxM "chess"board and Q,R,B,K where Q is the number of queens, R the number of rooks, B the number of bishops, and K the number of knights find out how many possible configurations ...
0
votes
1
answer
59
views
Developing mailbox chess engine 'GenerateAllMoves' not working as expected
GenerateAllMoves function does not seem to work.
I ran this code but the results were strange.
const BOARD_IDX = 120;
// black pieces
const W_P = 1;
const W_R = 2;
const W_B = 3;
const W_N = 4;
...
0
votes
1
answer
153
views
Understanding enum arrays in C++
I'm following along a book on teaching yourself C++, and there's a question about creating the layout of a chess board using enums and arrays.
Looking at their solution, they call an enum to declare ...
0
votes
0
answers
59
views
How to Create a List of Different Dimensioned Arrays C# - Minimax Algorithm
I'm trying to create a simple chess AI and I'm currently implementing the minimax algorithm. My goal is to have an array (or list, whatever datatype really) of Board objects, each row containing one ...
-1
votes
1
answer
54
views
How do i stop iterating tough this array at "pgn[46]"?
How do i stop iterating tough this array at "pgn[46]"?
I want to be unable to go to the next move when i click the button. because this array will start back from 0 and if a piece is on the ...
0
votes
3
answers
255
views
how can I represent tuple as a 2D array in python?
Imagine a NxN chess board, I have a tuple t = (0,3,2,1) which represents chess pieces location at each column (col = index), and each number represents the row, starting at 0 from bottom.
For this ...
2
votes
1
answer
784
views
How do i put the chess pieces in a python chessboard grid?
I am a begginer working on a college project and i need to make a chess game that works in the python console(can´t use the chess import), i just completed the board but now i have no idea how to put ...
1
vote
1
answer
171
views
Updating position of 2nd chess piece makes the piece disappear
I am teaching myself JS. I am able to move a piece to a new location but for the 2nd piece the chess piece disappears. It seems that the addEventListener is going into a loop and I am not ...
1
vote
1
answer
356
views
how to get the FEN out of unNested chess board list in JavaScript
I made a chess Program.js that is not working fine;
I want to generate the FEN out of the board list that looks like this
board1 = [
"R", "N", "B", "K", ...
0
votes
1
answer
449
views
How do you find possible x, y values for the Knight's Tour Problem?
I was looking into the Knight's Tour Problem, where the solution is obtained when a chess knight piece moves to every square on a grid exactly once. However, upon looking at different solutions for ...
1
vote
0
answers
59
views
finding path to all 3 corners on a chess board starting from 0,0 isn't working
#include <stdio.h>
#define SIDE 8
#define VISITED 1
#define NOT_VISITED 0
#define FALSE 0
#define TRUE !FALSE
void printBoard(int board[][SIDE]);
int goHorsie(int board[][SIDE], int x, int y,...
-1
votes
2
answers
2k
views
array bound is not an integer constant before ']' token
main:
#include <iostream>
#include "common.h"
#include "squares.h"
#include "board.h"
using namespace std;
int Board::board_length=8;
int main()
{
Board *tabla=...
0
votes
2
answers
137
views
how to mathematically have array border without actually increasing the array size?
So I have a game board represented by a 1d array of 64 squares and I wish to know when a piece is trying to escape the borders.
So for example:
Assume a king in the game of chess is on the X:
0 0 0 0 ...
0
votes
1
answer
74
views
Runtime error when counting the number of diagonals Queen can attack from a specific position on chessboard in java [closed]
I have an n*n chessboard, where 0<n<=100000.
The queen can be placed anywhere on the board.
Is there a method/formula to calculate the number of diagonals the queen can visit from the specified ...
1
vote
0
answers
68
views
Replacing element of a 2D object array
I'm currently attempting to implement chess in Java and I think I'm getting hung up on something rather trivial but I can't debug the issue for the life of me.
Say I have a two-dimensional array of '...
-1
votes
1
answer
1k
views
8 Queens brute force problem is not printing out the results, C++
The 8 queens puzzle is a problem of placing 8 chess queens in each column on a chessboard so that no two queens threaten each other; thus, a solution requires that no two queens share the same row or ...
0
votes
1
answer
36
views
JS returns only 3 elements from 32 element array
I am trying to get all the chess pieces present on the board. Array seems to be successfully filled up with 32 pieces(Which is valid for the starting position). But, in switch comparison, it finds ...
1
vote
2
answers
1k
views
How to restrict the pawn ♟️ movement in a chess board?
Please don't get aghast of TypeScript. It's just js with types.
I'm making a chess game and I've reached the part of validating the movements. My Tile class is as follows:
class Tile {
x: number;
...
0
votes
1
answer
186
views
chess game delete diagonal movements if pieces block for bishops/queens (java)
I'm making a Chess game in Java.
I did a JFrame that lets me create pieces that is why I have all possibles moves for anypiece (and I'm going to make more pieces than there are in normal chess).
But ...
1
vote
1
answer
398
views
Using ASCII for board co-ordinates in Java
I'm pretty new to Java and learning it as a hobby mainly after school to kill my free time productively. I find it really interesting and picking it up relatively pain free however I'm a bit stuck ...
0
votes
1
answer
49
views
Add elements of ArrayList into a 2d Array
I am reading a text file and saving its contents into an ArrayList, know I wanna populate an 8x8 array with the contents of the Arraylist. My goal is to read a file with chess pieces, color and ...
1
vote
1
answer
117
views
Passing array as parameter in a method
I am trying to make a simple Chess program in java. There is an ArrayList that stores all the moves the knight can do, with each move being an Integer[]. The first item in the array is the row, and ...
2
votes
1
answer
3k
views
How to create a program that check wheter the chess horse will be meet or not?
I have a question. How to make a program in c where the program will check whether the white horse and black horse on the chess board will meet or not, in this case it is recommended to use the ...
1
vote
4
answers
157
views
How would I write a statement that will loop continuously as long as an array contains a certain value in JAVA
How would I write a statement that will loop continuously as long as an array contains a certain value? I need it to continue to loop as long as an array contains a specific character, but stop ...
0
votes
3
answers
395
views
How to convert this method to a boolean
I'm currently trying to implement a game of chess. I've structured it so that possible moves are generated for each piece type and stored in an array list. My board is a 2d array. I wondered how to ...
0
votes
1
answer
318
views
How to convert array indices into possible moves for a rook and bishop chess piece
I'm struggling to work out how to convert index numbers in a 2D array into possible moves for a rook and bishop to move. I want to get a boolean expression to see if a move is legal. Sorry, I'm new to ...
1
vote
2
answers
108
views
Passing an array as a parameter- chess board
I can't see what is wrong, I am trying to pass the gameBoard array (is this not an array?- see constructor) into the findPiece method, but it says it
isn't an array, what should I be passing here to ...
0
votes
3
answers
1k
views
How to convert a chess co-ordinate into row, column for 2D array [closed]
I'm totally stumped, and wondered if anyone knew a way to convert a user input of "a1" in chess to [][] in a 2D array?
1
vote
1
answer
1k
views
Placing numbers in a 2D array by a chess knight move pattern in Java using recursion
public class ChessComplete
{
private int size;
private int[][] board;
private long callNum;
public ChessComplete(int size)//constructor with 2D array size as a parameter
{
...
2
votes
2
answers
4k
views
Using 2 input coordinates of the chess board, identify whether or not they crossed each other's path (using queen moves of the chess game)
class Board
{
public static void main(String args[])
{
int i, j;
int x1 = 0, y1 = 0;
int x2 = 0, y2 = 0;
int[][] board = new int[8][8];
x1 = ...
2
votes
1
answer
120
views
C++ | Matrix adds weird values
I'm trying to simulate chess movements, but somehow values out of array size appears inside array.
I'm trying to figure out what is wrong but I cant find a solution.
I have this example code:
#...
1
vote
2
answers
107
views
Java - 2D Array manipulation is affecting the inverse of the index
I am trying to learn Java by applying my knowledge and making a Java Chess Game. For the moment it is strictly text. In my program I have a function which allows me to move a piece. All the pieces are ...
-1
votes
1
answer
100
views
Recursive Knight Positions Given Number of Moves String Array Java
I'm trying to print a board that given the knights initial position, it show all the places on an 8x8 board that it can reach within a specified number of moves.A sample input and output I have in ...
0
votes
2
answers
5k
views
Simple Console Chess Game
I'm currently working on a small C++ console game. The first problem which I encountered, is a bad display of chess board (string 8x8 array). But first of all, let me give you a short briefing.
My ...
-4
votes
1
answer
789
views
I tried to make c array that draw 8x8 chesstable.Help me please?
#include<stdio.h>
#include<stdlib.h>
int main()
{
const char *chess[8][8]; //using 2 dimensional array
chess[0][0] = "X";
chess[0][2] = "X";
chess[0][4] = "X"; //...
2
votes
1
answer
10k
views
Java 2D Array for chess board not working
i'm trying to make a simple chess board with Strings as my chess pieces in a 8x8 2D Array. But the output is not what I want, as the Array just goes down. (Sorry for my language. I'm not so good at ...
0
votes
1
answer
92
views
How to change size of an array during runtime in java Netbeans?
I am creating a 2-player chess game in java Netbeans (at beginner level), I wish to store the squares which can accept a piece in a JLabel Array. How can I change size of the array during runtime, ...
1
vote
2
answers
147
views
C# When using foreach on a list of arrays, the foreach only iterates 5 times even though the list has length 86
I'm writing a chess engine in C#, and I'm trying to debug move generation. I've been using breakpoints so far to check variables, but I need a better way to debug. Despite the fact that a breakpoint ...
1
vote
2
answers
1k
views
C++ Print diagonal in two dimensional array using one point as reference
I have a two dimensional array which represents a chess board - t[8][8]
Now let's say we have a queen on that game at t[4][7]
How to draw the diagonals using this queen reference's coordinate ?
What ...
0
votes
2
answers
94
views
Java Array of references / several different classes?
I'm new here and although I've found a lot of information here many times, this is my first question, so let me now if I should change my way of asking or something.
Well, I am trying to create a ...
0
votes
2
answers
330
views
Flip one dimensional array board representation about the x axis
I am in the midst of programming a chess AI, and have encountered an issue with my implementation of piece-square tables. Since I only want to have one piece-square table per side, I need a function ...
1
vote
1
answer
2k
views
Initializing 2D Array
I'm trying to create an array whereby a 2 character code in each element corresponds to what pieces are where on a chessboard.However, I can't work out how do use the 2D arrays. I have the pieceArray ...
0
votes
1
answer
893
views
Get enemy's possible moves in chess to a 2D array - Python
I have three arrays,
chess = [["c","d","e","f","g","e","d","c"],
["b","b","b","b","b","b","b","b"],
["a","a","a","a","a","a","a","a"],
["a","a","a","a","a","a","a","a"],
...
-3
votes
1
answer
445
views
What is the maximum strength of a chess engine with a board representation using an 8 by 8 array?
I am trying to program my first chess engine, and I am using chessprogramming.wikispaces.com as a resource. My first attempt was to use bitboards considering their performance perks and for the fact ...
2
votes
1
answer
717
views
Java Code for AI Game
I am currently in the process of developing a Java game which is similiar to checkers.
There are two players, player X and player Y. I do not want a GUI for this game, just an output below. In the ...
2
votes
2
answers
445
views
Adding ActionListeners to array of buttons
I'm trying to write my first Swing app, it is a simple chess engine in Java. I've made a grid of JButtons to represent squares. Looks ok, but I've come across a problem when trying to add ...
0
votes
0
answers
475
views
Overloading assignment operator for 2d pointer array
EDIT: We aren't using vectors for this, the piece class right now is just stubbed out. Different pieces don't exist yet, and valid moves aren't being considered. The board displays a 'P' in the square ...
2
votes
1
answer
633
views
ActionScript 3 - 2D array for a chessboard
I'm designing a chess game in ActionScript 3 using Flash Professional CC. I've created a chessboard using the IDE and placed pieces in their initial positions. Each tile has its own instance and is ...
0
votes
1
answer
169
views
Scheme: Mutating elements in an array for chess
I have been working on a simple chess program in Scheme, and one of the helper functions that I have defined consumes a piece, and its coordinates (current-location) and places it at specified ...
1
vote
1
answer
1k
views
Get all fields influenced by horse as point array
I just can't figure this thing out. I'm making a chess game and I need to get figures influences...
I started with a horse and got quite stuck, even after drawing it on a paper. I want that as an ...