seblague / chess-challenge Goto Github PK
View Code? Open in Web Editor NEWCreate your own tiny chess bot!
Home Page: https://www.youtube.com/watch?v=Ne40a5LkK6A
License: MIT License
Create your own tiny chess bot!
Home Page: https://www.youtube.com/watch?v=Ne40a5LkK6A
License: MIT License
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?
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.
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.
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(); }
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?
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.
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?
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.
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;
}
It won't build the program becasue its searching for a file called Chess-Challenge.dll inside the /bin folder. Has anyone run into this?
I want to make my bot resign, but I can't find a method of doing that in the documentation.
Is it fine if I use .NET 7?
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?
I feel like this should be forbidden, in the spirit of the rule:
"As implied by the allowed namespaces, you may not read data from a file or access the internet, nor may you create any new threads or tasks to run code in parallel/in the background."
If we keep tinkering with our code and find a "better" solution, are we allowed to submit updated bots?
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?
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()
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.
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?
Is it allowed to train a neural network using board evaluations emitted by stockfish? Because tbh that doesn’t seem fair :))
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#)
Essentially, you could store a 1MB weights file (or whatever binary data) into a BigInt using the following:
var myBigInteger = new BigInteger(0x123456789ABCDEF123456789ABCDEF123456789ABCDEF123456789ABCDEF);
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?
Is there going to be a limit on how much data You can allocate during the game for things like a transposition table?
I couldn't find it in Board, don't know where else to look.
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
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);
VS code says I "have no extension for debugging XML" does anyone know which extension I should download to solve this issue?
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'.
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.
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)
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.
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)
I would like to use machine learning in my approach, but how I can I store learning data considering token limitation ?
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.
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.
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'.
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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.