Coder Social home page Coder Social logo

chess-challenge's People

Contributors

an-inconspicuous-semicolon avatar ernestoyaquello avatar gamma-delta avatar joshuajeschek avatar laurirasanen avatar seblague avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

chess-challenge's Issues

Constructing a Board

It may be useful to have a documented method for constructing an arbitrary board, perhaps from a string where each character represents a square and each rank is represented by a line. Is this in the cards?

Chess board not working


image_2023-07-21_170319493

my chess board looks like this for some reason and i dont think its suppose to be like that

Error cs0568 is making me unable to build the project

As i said in the title the error is making me unable to build due to the "public Move()" not allowing itself to be null or something to quote exactly its "structs cannot contain explicit parameterless constructors". im not entirely sure as im not used to developing in c# except some basics in unity so im unsure of what to do. i read that i might have to update to c# 10+ but i want to make sure first.

How do I use the TargetsSquare?

targetsquare.TargetSquare();

It gives me Non-invocable member 'name' cannot be used like a method.
So how do I use it then

(I am sorry if this is a really simple question, but I have never programed anything in C#)

Does GetLegalMoves() check for checks?

Does the GetLegalMoves() method check if the king is in check? Because my Bot only picks moves out of the GetLegalMoves() array and made an illegal move, because it tried to move something else while to king was in check. (And no the move did not resolve the check)

What is meant by "tokens"?

I find it weird that the term "token", being the core of the whole challenge, was almost not explained in the description or the video.
It is not a sort of a widely-accepted term, is it? What does it include except for the names of variables/functions/classes?

  • colons and semicolons
  • commas and points
  • brackets and braces
  • mathematical operators (+, -, *, /, =, +=, -=, *=, /=, etc)
  • bitwise operators (&, |, >>, <<, etc.)
  • logical operators (&&, ||, !)
  • declarations of types that include several "names" such as: List, int[], List< List < float > >, etc.
  • keywords (for, foreach, if-else if-else, return, private/public, static, class/struct etc.)
  • and so on...

I think it would be correct to state explicitly what is considered a "token", or at least provide a link to the definition that is used.

Lambdas Reduce Brain Capacity by 1 vs Return Statements

public Move Think(Board board, Timer timer) => board.GetLegalMoves()[0];
results in 24 Bot Brain Capacity
public Move Think(Board board, Timer timer) { return board.GetLegalMoves()[0]; }
results in 25 Bot Brain Capacity

Both return a value and have the same content, but using a return statement is penalized.

System.NullReferenceException: 'Object reference not set to an instance of an object.' PieceLists is missing some entries

Hi, just got System.NullReferenceException: 'Object reference not set to an instance of an object.' Looks like it rarely happens, but just in case I documented the stack trace here:
System.NullReferenceException HResult=0x80004003 Message=Object reference not set to an instance of an object. Source=Chess-Challenge StackTrace: at ChessChallenge.Chess.Board.MovePiece(Int32 piece, Int32 startSquare, Int32 targetSquare) in C:\Users\e.schwass\Source\Repos\Chess-Challenge\Chess-Challenge\src\Framework\Chess\Board\Board.cs:line 114 at ChessChallenge.Chess.Board.MakeMove(Move move, Boolean inSearch) in C:\Users\e.schwass\Source\Repos\Chess-Challenge\Chess-Challenge\src\Framework\Chess\Board\Board.cs:line 143 at ChessChallenge.Application.ChallengeController.PlayMove(Move move) in C:\Users\e.schwass\Source\Repos\Chess-Challenge\Chess-Challenge\src\Framework\Application\Core\ChallengeController.cs:line 256 at ChessChallenge.Application.ChallengeController.Update() in C:\Users\e.schwass\Source\Repos\Chess-Challenge\Chess-Challenge\src\Framework\Application\Core\ChallengeController.cs:line 366 at ChessChallenge.Application.Program.Main() in C:\Users\e.schwass\Source\Repos\Chess-Challenge\Chess-Challenge\src\Framework\Application\Core\Program.cs:line 40

image

XML debugging

VS code says I "have no extension for debugging XML" does anyone know which extension I should download to solve this issue?

Can you use nameof to load stored data

So can i use nameof? For example, i can have multible arrays worth of data stored in just a few tokens for defining a variable. And in the first round i load it into memory.

choosing illegal moves

it would be possible to look through all the pieces on the board and just choose a move (that isn't legal) that removes the opponents queen or one of their rooks.
the rules also do not state that this is not allowed.

Clarification on the match

What are the tournament details?
Is it all x all? Is it by brackets? Do you get white and black vs your opponent or not necessarily? Do all positions start from initial position, or are other preset positions?

Limit for memory allocation

Is there going to be a limit on how much data You can allocate during the game for things like a transposition table?

You can store unbounded data in identifiers

You can still store arbitrary data in identifiers, then retrieve it by calling the function and having it extract the stacktrace. Something like this would probably work:

String _Xfoobar_X() { return Environment.StackTrace.Split("_X")[1]; }
String theData() { return _Xfoobar_X(); }

Some illegal moves crash the game, some dont

If I make a move out of the chessboard (such as "a8a9"), the game throws an error and crashes, while for an illegal move "a8b7" (rook to move diagonally) the console just prints out Game over and the program doesn't crash. This could be an issue in the final tournament?

Game pieces are not visible when program runs

I started running the program and the game piece images are just not there.
It seems like it otherwise work, but it is rather hard to infer what adjustments need to be done in order to make my bot better.
Thank you in advance.

Unable to resolve Raylib-cs dep using Rider IDE

I tried to install it through the dotnet cli but it says that no version 4.5.0.2 of Raylib-cs matches net6.0:

Chess-Challenge.csproj: [NU1100] Unable to resolve 'Raylib-cs (>= 4.5.0.2)' for 'net6.0'.

Unity port ?

I am more comfortable using unity(for debugging and development) and plan to port the project to unity , since its c# the mybot.cs will also be playable in the normal framework .Is anyone else interested?

Moved piece becomes Null when using board.MakeMove()

I made a simple eval script to add up the values of the pieces but for some reason the piece that just moved becomes a null piece
image
image
As you can see here one of the White Knights becomes a Null
I used this code:

int eval = 0;
board.MakeMove(move);

foreach (PieceList piecelist in board.GetAllPieceLists())
{
    foreach (Piece piece in piecelist)
    {
        eval += pieceValues[(int)piece.PieceType]*(isWhite == piece.IsWhite ? 1 : -1);
        Console.WriteLine(piece.ToString() + " : " + pieceValues[(int)piece.PieceType]*(isWhite == piece.IsWhite ? 1 : -1));
    }
}

board.UndoMove(move);

Tournament on own implementation(s)

Is there an easy way to automatically pit a set of implementations against each other and evaluate them, other than manually changing the implementation of EvilBot each time?

How do you know which side your bot is on?

I see methods in the API that allow you to check if a piece is white or black, but how do you know which side your bot is playing at a given moment? I'm looking for a bool isPieceMyPiece(Square s) kind of method. Did I just overlook something, or does this functionality not exist?

Some error I am unable to fix

Chess-Challenge\src\Framework\Application\Core\ChallengeController.cs(208,57,208,62): 
error CS7036: There is no argument given that corresponds to the required parameter 'isWhitePlayer' of 'MyBot.MyBot(bool)'
ChessPlayer CreatePlayer(PlayerType type)
{
            return type switch
            {                                            ∀ ∀ ∀ ∀ 
                PlayerType.MyBot => new ChessPlayer(new MyBot(), type, GameDurationMilliseconds),
                PlayerType.EvilBot => new ChessPlayer(new EvilBot(), type, GameDurationMilliseconds),
                _ => new ChessPlayer(new HumanPlayer(boardUI), type)
            };
 }

I have no idea what to do to fix this
Error is at (∀) On MyBot()

Mention time limit in the rules

The rules currently mention no execution time limit for the bots.
The program itself shows a 1 minute per side per game limit, but this should likely be included in the rules as well.

Disabling token counter to remove the pause on start

Checking memory requirements at the start adds quite a long pause between trials, which I don't need right now.

I tried going into places like TokenCounter.cs and making it return 0 immediately but the pause persists.

Piece Lists not correctly updated after MakeMove()

Am I missing something?

I'm trying to get at the piece lists after making a move but they don't seem to be updated.

I've boiled it down to the following simple example.

    public Move Think(Board board, Timer timer)
    {
        var from = new Square(0, 1);
        var to = new Square(0, 2);
        var moveString = $"{from.Name}{to.Name}";
        var move = new Move(moveString, board);
        board.MakeMove(move);

        var originalLocation = board.GetPiece(from);
        var newLocation = board.GetPiece(to);
        var allPieces = board.GetPieceList(PieceType.Pawn, true);

        Debug.Assert(allPieces.All(p => p.IsPawn)); // Fails, first "pawn" is null
        Debug.Assert(originalLocation.IsNull); // Fails still has the Pawn in it set to true
        Debug.Assert(!newLocation.IsNull);    // Fails, IsNull is true instead of IsPawn

        board.UndoMove(move);
        return move;
    }

Unable to resolve Raylib-cs

I am not too familiar with C#, so maybe this has an easy fix. But, after installing .NET 6.0, when building the project in Rider, it is unable to resolve Raylib-cs for .NET 6.0.

Chess-Challenge.csproj: [NU1100] Unable to resolve 'Raylib-cs (>= 4.5.0.2)' for 'net6.0'.

Arbiter.InsufficientMaterial is incomplete

In Arbiter.InsufficientMaterial, it doesn't take into account the case where there are only 2 bishops remaining and they are both on the same color complex(whether they are white or black pieces does not matter, the game is still drawn)

Issue With Running The Program

So i just opened the program and when i try to run it it says "Please select a valid startup item!" its first time running vs on my new laptop so idk what i am doing.
Thanks.
image
It just says this

Rules dont ban functions like nameof() for storing data.

A string that is constructed using "" has a token-count that depends on its size. I would assume that this is done to avoid freely storing lots of data.

This token cost can be avioded by putting your data in the name of a function, and then returning nameof() within that funtion.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.