diff --git a/AUTHORS.md b/AUTHORS.md new file mode 100644 index 0000000..008df05 --- /dev/null +++ b/AUTHORS.md @@ -0,0 +1,12 @@ +# Authors +WinChess is developed and maintained by: +- **Touil Ghassen** � Project lead, software architecture, and chess-engine development +- **[BAZIZ Chafia](https://github.com/ChiChiNour310)** � Developer +- **[BOUAKAZ Ahlem](https://github.com/ahlambkz0923)** � Developer +## Contributors +Additional contributors are acknowledged through the Git commit history and +the GitHub contributors list. +## Authorship policy +Authors and co-authors must be credited only for work to which they actually +contributed. Joint commits should use Git's `Co-authored-by` trailers with an +email address associated with the contributor's GitHub account. diff --git a/ChessGUI/ChessGUI.csproj b/ChessGUI/ChessGUI.csproj index 5e4e265..0edda81 100644 --- a/ChessGUI/ChessGUI.csproj +++ b/ChessGUI/ChessGUI.csproj @@ -1,12 +1,12 @@ + - WinExe net10.0-windows WinChess WinChess - Windows chess application with a native C++ engine, WPF GUI, and UCI host. - Ahlem Chafia; WinChess contributors + Open-source Windows chess application with a native C++ engine, WPF GUI, and UCI host. + Touil Ghassen; BAZIZ Chafia; BOUAKAZ Ahlem 0.1.0 https://github.com/binarylab2022-del/WinChess git @@ -20,8 +20,10 @@ prevents BadImageFormatException and keeps deployment deterministic. --> x64 false + BinaryLab + Copyright © 2026 Touil Ghassen, BAZIZ Chafia, BOUAKAZ Ahlem + https://github.com/binarylab2022-del/WinChess - @@ -36,7 +38,6 @@ - PreserveNewest @@ -75,23 +76,16 @@ PreserveNewest - - - $(MSBuildProjectDirectory)\..\bin\x64\$(Configuration)\ChessDLL.dll - + - - + \ No newline at end of file diff --git a/ChessGUI/MainWindow.xaml.cs b/ChessGUI/MainWindow.xaml.cs index 34f79aa..402f6e9 100644 --- a/ChessGUI/MainWindow.xaml.cs +++ b/ChessGUI/MainWindow.xaml.cs @@ -56,7 +56,7 @@ internal BoardTheme(string name, Color light, Color dark) }; private BoardSnapshot _boardSnapshot = new(); - private Button selectedSquare = null; + private Button? selectedSquare; private int selectedRow; private int selectedCol; private bool whiteIsHuman = true; @@ -67,8 +67,8 @@ internal BoardTheme(string name, Color light, Color dark) private bool _engineThinking = false; private bool _boardFlipped = false; private int _boardThemeIndex = 0; - private Button derniereFrom = null; - private Button derniereTo = null; + private Button? derniereFrom; + private Button? derniereTo; private int depthWhite = 4; private int depthBlack = 4; @@ -89,7 +89,7 @@ internal BoardTheme(string name, Color light, Color dark) private int _benchmarkDraws; private int _benchmarkLosses; - private ContentPresenter GetPresenter(Button cell) + private ContentPresenter? GetPresenter(Button cell) { var innerGrid = cell.Content as Grid; if (innerGrid == null) return null; @@ -119,6 +119,10 @@ private Button GetCellForEngineCoordinate(int engineRow, int engineCol) return squares[display.row, display.col]; } + /// + /// Initializes the WinChess main window, board controls, + /// native chess engine, and live-analysis services. + /// public MainWindow() { InitializeComponent(); @@ -145,6 +149,7 @@ public MainWindow() ComputerTurnIfNeeded(); } + /// protected override void OnClosed(EventArgs e) { _benchmarkCts?.Cancel(); @@ -238,7 +243,7 @@ private void AfficherPiecesDepuisEngine() { var engine = ToEngineCoordinate(displayRow, displayCol); PieceCode piece = _boardSnapshot.PieceAtCanonical(engine.row, engine.col); - ContentPresenter presenter = GetPresenter(squares[displayRow, displayCol]); + ContentPresenter? presenter = GetPresenter(squares[displayRow, displayCol]); if (presenter != null) presenter.Content = PieceToImage(piece); } @@ -248,10 +253,10 @@ private void AfficherPiecesDepuisEngine() MettreAJourListeCoups(); } - private ImageSource ChargerSourcePiece(PieceCode piece) + private ImageSource? ChargerSourcePiece(PieceCode piece) { if (piece == PieceCode.Empty) return null; - if (_pieceSources.TryGetValue(piece, out ImageSource source)) return source; + if (_pieceSources.TryGetValue(piece, out ImageSource? source) && source is not null) return source; string[] names = { @@ -266,7 +271,7 @@ private ImageSource ChargerSourcePiece(PieceCode piece) TextAsGeometry = false }; var converter = new FileSvgReader(settings); - DrawingGroup drawing = converter.Read(path); + DrawingGroup? drawing = converter.Read(path); if (drawing == null) return null; var image = new DrawingImage(drawing); @@ -275,9 +280,9 @@ private ImageSource ChargerSourcePiece(PieceCode piece) return image; } - private Image PieceToImage(PieceCode piece) + private Image? PieceToImage(PieceCode piece) { - ImageSource source = ChargerSourcePiece(piece); + ImageSource? source = ChargerSourcePiece(piece); if (source == null) return null; return new Image { @@ -345,7 +350,8 @@ private async void Cell_Click(object sender, RoutedEventArgs e) int row = engine.row; int col = engine.col; - if (selectedSquare == null) + Button? previousSelection = selectedSquare; + if (previousSelection is null) { PieceCode piece = _boardSnapshot.PieceAtCanonical(row, col); if (piece == PieceCode.Empty) return; @@ -360,7 +366,7 @@ private async void Cell_Click(object sender, RoutedEventArgs e) return; } - selectedSquare.BorderThickness = new Thickness(0); + previousSelection.BorderThickness = new Thickness(0); EffacerSurbrillance(); ClearHintHighlight(); @@ -433,7 +439,7 @@ private int DemanderPromotion() }; btn.Click += (s, ev) => { - result = (int)(s as Button).Tag; + if (s is Button button && button.Tag is int promotionValue) result = promotionValue; dialog.Close(); }; panel.Children.Add(btn); @@ -981,9 +987,9 @@ private async Task RunBenchmarkAsync( { TxtBenchmarkStatus.Text = $"Game {game + 1}/{games}: {external.DisplayName} thinking…"; - string response = await external.GetBestMoveAsync( + string? response = await external.GetBestMoveAsync( ChessAPI.GetFENString(), timePerMove, token); - if (!PlayExternalUciMove(response)) + if (string.IsNullOrWhiteSpace(response) || !PlayExternalUciMove(response)) { ++_benchmarkWins; TxtBenchmarkStatus.Text = @@ -1399,7 +1405,7 @@ private void AfficherPrises(WrapPanel panel, int[] manquantes, bool iconeNoire) { for (int j = 0; j < manquantes[i]; j++) { - Image image = PieceToImage(pieces[i]); + Image? image = PieceToImage(pieces[i]); if (image == null) continue; image.Width = 22; image.Height = 22; diff --git a/ChessUCI/ChessUCI.cpp b/ChessUCI/ChessUCI.cpp index 35292eb..384d5f0 100644 --- a/ChessUCI/ChessUCI.cpp +++ b/ChessUCI/ChessUCI.cpp @@ -529,7 +529,7 @@ int main() { const std::string command = tokens[0]; if (command == "uci") { writeLine("id name WinChess"); - writeLine("id author Ahlem Chafia"); + writeLine("id author Touil Ghassen, BAZIZ Chafia, BOUAKAZ Ahlem"); writeLine("option name Hash type spin default 64 min 1 max " + std::to_string(g_getHashMaximum())); writeLine("option name Move Overhead type spin default 30 min 0 max 5000"); writeLine("option name Use PVS type check default true");