Feature/connect four#31
Merged
Merged
Conversation
New project: Alligator.ConnectFour — implements IPosition<Drop> and IRules<Position, Drop> Features: - 7x6 board with discs dropped from top - Zobrist hashing for fast incremental position identification - Vertical/horizontal/diagonal win detection via last-move optimization - Heuristic evaluation: center preference + window-of-4 scoring - Move ordering: center columns yielded first - Cached Drop instances (only 7 objects, reused via Drop.At()) - 8 unit tests: win detection (vertical/horizontal/diagonal), TakeBack, solver integration
… depth and improved evaluation - Add Program.cs with human vs AI game loop (column input, colored board display) - Add Configuration.cs with MaxDepth=13 (searches at depths 2,4,6,8,10,12) - Make solver MaxDepth configurable via IConfiguration (default 7, backward compatible) - Improve static evaluation: positional weight table (winning lines per cell), distance-based threat scoring, and double threat detection (+80 bonus)
The pure geometric weights (counting 4-in-a-row windows) gave higher scores to middle rows (2-3). This created a stacking penalty: playing center column let the opponent place on top for a higher-weighted cell (row 1 weight 10 > row 0 weight 7), making the AI avoid the center opening.
New formula: columnWeight[c] + (Rows - 1 - row), where columnWeight is the horizontal window count {3,4,5,7,5,4,3}. Center column remains dominant, but lower rows now always outweigh upper rows in the same column.
…spective The solver's HeuristicValue + IsOpponentsTurn mechanism expects absolute values (always from the same player's perspective), matching TreePosition and TicTacToe. Connect Four's Evaluate() incorrectly returned values from the current player's perspective, which caused NullWindowTest to produce negated minimax values and BestNodeSearch to select the worst moves instead of the best.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.