#1 Chess Engine of Spring 2017 at S&T

Slides:



Advertisements
Similar presentations
Anthony Cozzie. Quite possibly the nerdiest activity in the world But actually more fun than human chess Zappa o alpha-beta searcher, with a lot of tricks.
Advertisements

Adversarial Search We have experience in search where we assume that we are the only intelligent being and we have explicit control over the “world”. Lets.
Adversarial Search Reference: “Artificial Intelligence: A Modern Approach, 3 rd ed” (Russell and Norvig)
Place captured red pieces below Place captured blue pieces below Rules New Game Exit Left mouse click on piece – drag to desired location - left mouse.
CS 484 – Artificial Intelligence
Table of Contents Why Play Chess? Setting Up the Board Get to Know the Pieces Check and Checkmate What the Chess Pieces Are Worth Opening Goals Endgame.
CHESS FOR KIDS Lesson 1.
L.O. Today you will learn how to play chess. How to Play Chess.
Applied Neuro-Dynamic Programming in the Game of Chess James Gideon.
Application of Artificial intelligence to Chess Playing Capstone Design Project 2004 Jason Cook Bitboards  Bitboards are 64 bit unsigned integers, with.
Chess Variants (I) (#35) Build a 2-player Chess Game (no-AI) Make it as modular as possible, so that It is easy to adapt to game rule changes (variants)
Chess!!. Pawn How many pieces? 8 Value: Lowest What can it do? Move forward only one space at a time. Attack: Only Diagonally.
Introduction to Chess Naming the Chess Squares Names of the Pieces Initial Setup Materials taken from Teaching Chess Step By Step manuals, Books 1 and.
Minimax and Alpha-Beta Reduction Borrows from Spring 2006 CS 440 Lecture Slides.
1 Selected Goodies of DarkThought Ernst A. Heinz M.I.T. Laboratory for Computer Science (until June 2001)
1 Adversary Search Ref: Chapter 5. 2 Games & A.I. Easy to measure success Easy to represent states Small number of operators Comparison against humans.
Chess Merit Badge Chess Basics: Set Up the Board & Basic Rules by Joseph L. Bell © 2011.
A Beginners Guide. The Pieces Chess consists of Sixteen pieces eight Pawns two Rooks two Knights two bishops one Queen and one king this guide will show.
Apostles chess club Session 2. Chess pieces are made mostly in the Staunton style. It is the only style accepted by chess tournaments.
Game Playing Chapter 5. Game playing §Search applied to a problem against an adversary l some actions are not under the control of the problem-solver.
Prepared by : Walaa Maqdasawi Razan Jararah Supervised by: Dr. Aladdin Masri.
Game Playing Chapter 5. Game playing §Search applied to a problem against an adversary l some actions are not under the control of the problem-solver.
How to Play Chess By: John. Dedication I dedicate this project to my family because we all love chess.
Chess and AI Group Members Abhishek Sugandhi Sanjeet Khaitan Gautam Solanki
How to Play Chess. Name of Each Piece The relative values of the chess pieces 9 points 5 points 3+ points 3 points 1 point.
Chess By Kezia Farley.
Summary of the Moves of Chess
Lesson 1 History of Chess Why We Teach Chess Goal of Chess.
Chess By Kyle Fischer. What is chess? Chess is a game that you try to get the other person’s king in a checkmate.
A game based off of the esteemed classic By: Tadziu Kosiara.
CHESS. Write what you already know about chess on a piece of paper which I will hand out now.
How to play chess? By Mervyn George. The Rules of the Game White always move first White always move first You should always play touch a piece move a.
CHESS 2: Castling and Forking…and a Stalemate A Levoy Power Point.
The Basics Of Chess Student Name: Jovannie Charles Date: 3/25/11.
Every chess master was once a beginner. Irving Chernev
Chess Strategies Component Skills Strategies Prototype Josh Waters, Ty Fenn, Tianyu Chen.
Discussion 2: Intro to Project 1: Chess Submit Project 1 under # 11!
CHESS Basics for Beginners. BOARD SET-UP The letters go across the board in front of you. “White on right!” Each player has a white square in their right.
A Levoy PowerPoint Presentation
Parallel Programming in Chess Simulations Tyler Patton.
ARTIFICIAL INTELLIGENCE (CS 461D) Princess Nora University Faculty of Computer & Information Systems.
Adversarial Search 2 (Game Playing)
Parallel Programming in Chess Simulations Part 2 Tyler Patton.
Understanding AI of 2 Player Games. Motivation Not much experience in AI (first AI project) and no specific interests/passion that I wanted to explore.
CIS 350 – I Game Programming Instructor: Rolf Lakaemper.
CHESS “The Ultimate GAME of Challenge and Strategy”
Adversarial Search and Game-Playing
Memory Management Memory Areas and their use Memory Manager Tasks:
Instructor: Vincent Conitzer
BACE Bowron – Abernethy Chess Engine Christopher Bowron Rob Abernethy.
Iterative Deepening A*
Ab & Team Presents CHESS “It’s not just a game”.
Ramblewood Middle Chess Club
Pengantar Kecerdasan Buatan
Optimizing Minmax Alpha-Beta Pruning Real Time Decisions
CHESS PIECES.
Data Structures Interview / VIVA Questions and Answers
Memory Management Memory Areas and their use Memory Manager Tasks:
How To Play Chess (And other Information)
CHESS.
Chess Basics: Set Up the Board & Basic Rules
Dakota Ewigman Jacob Zimmermann
Discussion section #2 HW1 questions?
Instructor: Vincent Conitzer
Introduction to Artificial Intelligence Lecture 9: Two-Player Games I
Pruned Search Strategies
Memory Management Memory Areas and their use Memory Manager Tasks:
Strategic Thinking There are two concepts that all chess players must understand from the start; strategy and tactics. Beginners often confuse the two.
CS51A David Kauchak Spring 2019
Minimax Trees: Utility Evaluation, Tree Evaluation, Pruning
Presentation transcript:

#1 Chess Engine of Spring 2017 at S&T Made by Shawn Roach

A little about Euler’s Eureka Able to search 0.8 – 1.3 million nodes per second in the arena Able to search 2.5 – 4 million nodes per second on a stock i7-4790k Easily searches to at least depth 8 or 9 Meticulously crafted through roughly 200 hours of research, work, and benchmarking. Uses bitboards Written in C++11 Second place’s engine, Neurochess, claimed to only be searching to depth 6.

Search algorithm Enhancements Transposition Tables Stores best move and best score found at entry, and if it failed high/low Using hand written hash table for fast look ups, as vast majority of entries will never be used, and majority of requests will not be found. Sped up search by 70-85% (determined from setting table size to 1) MTD-f (Memory-enhanced Test Driver) Basically performs a binary search into the alpha beta tree with zero width windows (beta = alpha+1) Sped up search again by another 20-40% Quiescence search Searches all captures, checks, promotions, and all moves while in check. Limiting quiescence search depth to 14 (to kill perpetual checks) entry &operator[](const uint64_t zobristHash) { return hashTable[zobristHash % tableLength]; } I encourage researching the polyglot “.bin” file format of opening tables before implementing transposition tables -http://hardy.uhasselt.be/Toga/book_format.html Careful with how you set up entries in transposition table, simply changing the order of variables in a struct can increase/decrease its memory footprint. (learn how memory is aligned) .

Move ordering Moves are bit packed into a single uint32_t Bits of packed move 0 - 5 : from square 8 - 13 : to square 16-18 : piece type moved 000=none (illegal) 001=king 010=pawn 011=bishop 100=knight 101=rook 110=queen 19 : double pawn forward flag 20 : queen side castle flag 21 : king side castle flag 22 : checking flag, will put opponent in check 23-25 : capture type (stores each type of piece: bits 23-25 are 000=none 010=pawn 011=bishop 100=knight 101=rook 110=queen 26 : en passant flag 27 : equal capture flag, capturing same piece 28-30 : promotion type bits 28-30 are 000=none 011=bishop 100=knight 101=rook 110=queen 31 : winning capture flag, capture is of a higher value piece unused bits: 14-15 *bits 6 and 7 are used, but are not yet set during move ordering **extends to 64 bits when history table enabled, and puts history values in the upper 32 bits ***using simplified definitions of winning/equal captures Moves are bit packed into a single uint32_t By carefully specifying which bits are set, a large amount of information is conveyed during sorting through a single integer comparison operation. Entry from Transposition Table performed first. Using std::make_heap with std::pop_heap after each move over using std::sort ~10-15% speed up Puts off as much work to after a prune Recently found out rebel engine uses a simialer move ordering, http://rebel13.nl/rebel13/blog/lmr.html I have my history table disabled as it appeared to hurt performance by about 5%, I would have turned it back on if I ever implemented late move reductions

Move Generation Creates only legal moves, to avoid performing an illegal move and needing to backtrack. Move[218] over vector<Move> Array is declared on the stack, while vectors allocate onto the heap Sped up my move gen by 50-70% 218 is the maximum possible branching factor Bit packing Moves into 4 bytes. Transition from 24 byte moves to 4 bytes sped up my move gen again by ~40% despite extra work to pack bits Although more work is done to bit pack, I believe the performance improvement is likely caused by cache locality. Additionally I use magic tables, for bishop and rook move generation.

Time Management Sets a minimum depth to search to based on time remaining. Will use cutoff of 1/25th – 1/50th of time remaining, based on time remaining. Attempts to predict how long the next iteration will take by predicting effective branching factor of current iteration and multiplying with time taken by current iteration. Stopping if time used will exceed cutoff Uses two metrics to determine effective branching factor and averages Ratio of current iterations time elapsed with previous iterations time logdepthSearched(nodesExplored) Careful with pondering, as it can confuse my time management algorithms, causing it to believe another iteration will take much shorter than it really will. I ended up turning my pondering off due to this.

State Evaluation Material Balance Pawns=1, knights=3, bishops=3.5, rooks=5, queens=9 Bonus to pawns protect by other pawns Bonus to passed pawns by square of distance travelled King tropism Bonus to castling, punish for losing ability to castle Punish having not yet moved minor pieces out of back rank In terms of state evaluation research, big thanks to: https://books.google.com/books?id=9-3pBwAAQBAJ&pg=PA97&lpg=PA97&dq=chess+%22king+tropism%22&source=bl&ots=5iDJCFlOOd&sig=or7k6qk6h-YYrdBy4WFfWVPy70Y&hl=en&sa=X&ved=0ahUKEwir34iyq6DTAhWF64MKHel4AiAQ6AEIPzAD#v=onepage&q=chess%20%22king%20tropism%22&f=false https://www.gamedev.net/resources/_/technical/artificial-intelligence/chess-programming-part-vi-evaluation-functions-r1208