ELE 408 Final Project

Similar documents
ChesServe Test Plan. ChesServe CS 451 Allan Caffee Charles Conroy Kyle Golrick Christopher Gore David Kerkeslager

2 person perfect information

Game-playing AIs: Games and Adversarial Search I AIMA

Obstacle Dodger. Nick Raptakis James Luther ELE 408/409 Final Project Professor Bin Li. Project Description:

Chess and Python revisited

game tree complete all possible moves

CS 1571 Introduction to AI Lecture 12. Adversarial search. CS 1571 Intro to AI. Announcements

More Adversarial Search

Final Project: Reversi

Minimax Trees: Utility Evaluation, Tree Evaluation, Pruning

Foundations of AI. 5. Board Games. Search Strategies for Games, Games with Chance, State of the Art. Wolfram Burgard and Luc De Raedt SA-1

Introduction to Artificial Intelligence CS 151 Programming Assignment 2 Mancala!! Due (in dropbox) Tuesday, September 23, 9:34am

Software Requirements Specification

1 Modified Othello. Assignment 2. Total marks: 100. Out: February 10 Due: March 5 at 14:30

OWEN Walking Robot Install Guide

CS151 - Assignment 2 Mancala Due: Tuesday March 5 at the beginning of class

IRU151_IRU152. OPC UA User Manual

Welcome to the Brain Games Chess Help File.

Adversary Search. Ref: Chapter 5

Artificial Intelligence

Game Playing. Why do AI researchers study game playing? 1. It s a good reasoning problem, formal and nontrivial.

Play Chess Lessons Against Computer 3d Easy For Beginners

YourTurnMyTurn.com: chess rules. Jan Willem Schoonhoven Copyright 2018 YourTurnMyTurn.com

mywbut.com Two agent games : alpha beta pruning

Games (adversarial search problems)

Infoblox and Ansible Integration

Applications of Artificial Intelligence and Machine Learning in Othello TJHSST Computer Systems Lab

ANSYS v14.5. Manager Installation Guide CAE Associates

The game of Paco Ŝako

Artificial Intelligence

Universally Accessible Games: The case of motor-impaired users

GAME PROGRAMMING & DESIGN LAB 1 Egg Catcher - a simple SCRATCH game

Pay attention to how flipping of pieces is determined with each move.

Inspiring Creative Fun Ysbrydoledig Creadigol Hwyl. Kinect2Scratch Workbook

Project 1: Game of Bricks

COMP219: Artificial Intelligence. Lecture 13: Game Playing

Tac Due: Sep. 26, 2012

Solving tasks and move score... 18

Taffy Tangle. cpsc 231 assignment #5. Due Dates

A Simple Pawn End Game

Chess For Beginners Game Full Version 3d Animated

Programming an Othello AI Michael An (man4), Evan Liang (liange)

For slightly more detailed instructions on how to play, visit:

Artificial Intelligence Search III

STEP BY STEP GUIDE (RASPBERRY PI)

CS 229 Final Project: Using Reinforcement Learning to Play Othello

Activity 6: Playing Elevens

Game Playing AI Class 8 Ch , 5.4.1, 5.5

CS 2710 Foundations of AI. Lecture 9. Adversarial search. CS 2710 Foundations of AI. Game search

CISC 1600, Lab 2.2: More games in Scratch

3. Bishops b. The main objective of this lesson is to teach the rules of movement for the bishops.

CPS331 Lecture: Search in Games last revised 2/16/10

After learning the Rules, What should beginners learn next?

In this project you ll learn how to create a times table quiz, in which you have to get as many answers correct as you can in 30 seconds.

Foundations of AI. 6. Adversarial Search. Search Strategies for Games, Games with Chance, State of the Art. Wolfram Burgard & Bernhard Nebel

Interactive 1 Player Checkers. Harrison Okun December 9, 2015

Board Game AIs. With a Focus on Othello. Julian Panetta March 3, 2010

How to Make Games in MakeCode Arcade Created by Isaac Wellish. Last updated on :10:15 PM UTC

Game-playing AIs: Games and Adversarial Search FINAL SET (w/ pruning study examples) AIMA

COMP219: COMP219: Artificial Intelligence Artificial Intelligence Dr. Annabel Latham Lecture 12: Game Playing Overview Games and Search

Google DeepMind s AlphaGo vs. world Go champion Lee Sedol

2/5/17 ADVERSARIAL SEARCH. Today. Introduce adversarial games Minimax as an optimal strategy Alpha-beta pruning Real-time decision making

Section Marks Agents / 8. Search / 10. Games / 13. Logic / 15. Total / 46

Scratch Coding And Geometry

CPSC 217 Assignment 3

Adversarial Search (Game Playing)

Artificial Intelligence. 4. Game Playing. Prof. Bojana Dalbelo Bašić Assoc. Prof. Jan Šnajder

CS 440 / ECE 448 Introduction to Artificial Intelligence Spring 2010 Lecture #5

Programming I (mblock)

Today. Types of Game. Games and Search 1/18/2010. COMP210: Artificial Intelligence. Lecture 10. Game playing

Artificial Intelligence. Topic 5. Game playing

Editing the standing Lazarus object to detect for being freed

SudokuSplashZone. Overview 3

ARTIFICIAL INTELLIGENCE (CS 370D)

Table of Contents. Creating Your First Project 4. Enhancing Your Slides 8. Adding Interactivity 12. Recording a Software Simulation 19

Deep Green. System for real-time tracking and playing the board game Reversi. Final Project Submitted by: Nadav Erell

Adversarial Search. Robert Platt Northeastern University. Some images and slides are used from: 1. CS188 UC Berkeley 2. RN, AIMA

League of Legends: Dynamic Team Builder

STEP-BY-STEP THINGS TO TRY FINISHED? START HERE NEW TO SCRATCH? CREATE YOUR FIRST SCRATCH PROJECT!

Adversarial Search. CMPSCI 383 September 29, 2011

Playing Games. Henry Z. Lo. June 23, We consider writing AI to play games with the following properties:

Games and Adversarial Search II

To Explore the Properties of Parallelogram

Game Playing State-of-the-Art

MASA. (Movement and Action Sequence Analysis) User Guide

Using the Desktop Recorder

Microchess 2.0 gives you a unique and exciting way to use your Apple II to enjoy the intellectually stimulating game of chess. The complete program lo

Adversarial Search. CS 486/686: Introduction to Artificial Intelligence

Module 3. Problem Solving using Search- (Two agent) Version 2 CSE IIT, Kharagpur

Virtual Universe Pro. Player Player 2018 for Virtual Universe Pro

Play Chess Lessons Against Computer 3d Easy

Lesson 8 Tic-Tac-Toe (Noughts and Crosses)

Assignment 2 (Part 1 of 2), University of Toronto, CSC384 - Intro to AI, Winter

Artificial Intelligence Adversarial Search

3 USRP2 Hardware Implementation

WPE 48N USER MANUAL Version1.1

ModaDJ. Development and evaluation of a multimodal user interface. Institute of Computer Science University of Bern

CS 5522: Artificial Intelligence II

Assessment: Reverse Engineering

Game-playing: DeepBlue and AlphaGo

Transcription:

ELE 408 Final Project Chess AI game played over the Network Domenic Ferri Brandon Lian

Project Goal: The project goal is to create a single player versus AI chess game using socket programming to establish connectivity between the chess GUI and the AI engine. Detailed Design: The project is divided into three parts. First is the Chess GUI which is responsible for displaying the chess board and pieces as well as allowing the user to input moves and play the game. The Chess GUI was completely programmed from scratch using a Python package called Pygame. The GUI is them loaded onto the FPGA board and executed using the ARM processor. Next is the chess engine which is responsible for playing against the player by choosing optimal chess moves using basic AI theory. The chess engine was found online as an open source program that we modified slightly in order to use in this project. The engine is completely written in C programming language and is run from a desktop computer. Finally, the socket programming is used to establish connectivity between the GUI and engine. The GUI sends the current state of the game to the engine over the network, and the engine sends its chosen move back to the GUI. In order to create the chess GUI, we used the basic concept of giving each square number 0 to 63. This allows us to track the position of pieces by assigning a number to a piece. The piece positions are stored in a list which is updated when pieces are moved and captured. We also use the numbers to track mouse clicks so we know which piece was clicked on. A 2 dimensional list called current keeps track of the state of the game. The list has an element for each piece remaining on the board. Each of these elements has 3 of its own elements that state the name of the piece, position, and an array of legal moves. In order to find a list of legal moves, the rules of the game and the movement of each piece are hardcorded, and the conditions for each possible move are checked. For example, a Pawn can only move one square forward unless it has not moved before, in which it can move two squares forward. It can move diagonally only if capturing. Using the numbered squares, we know the one square forward is always the current position plus 8 for black and current position minus 8 for black. We then check if that destination square already has a piece on it. If it does, then it cannot move to it. The overall concept is that the rules of the game for each piece are used to generate a list of legal moves for each piece remaining. When a user makes a move, the GUI cheks if the move is in the list of legal moves. In order to send the user move to the chess AI, we need to translate the move into Universal Chess Interface convention. UCI used columns labeled A to H and rows labeled 1 to 8 to identify each square instead of using just numbers. Therefore, we translate the square's number to UCI convention before sending it. The move is sent over socket programming which establishes communication between the GUI and Engine. The socket program allows the chess AI to run on any computer on the same network as long as the ip is known. It also stops any unneeded information from the communication, such as extra white space, so that the GUI has

an easier time processing the machines moves. The GUI code sends different commands to the chess engine in order to begin a new game, restart the game, and more. The chess AI uses a classical approach to determining the best move by using a combination of the Minimax algorithm and alpha beta pruning. The engine sends the move back over the socket program to the GUI, which updates the game state with the new move and waits for the players next move. Procedure for running project: A short video run down/explanation is given here: https://www.youtube.com/watch?v=iofd9j3bky4 However these instructions below are more in depth and should be followed. * = may vary/from here on (like the use in linux terminal) Follow instructions in this exact order: 1. Open Terminal on a linux desktop computer Cntrl+alt+t 2. Make a desired directory for files to go to: Mkdir AI_Chess_Over_Network cd AI_Chess_Over_Network 3. Copy and unzip ELE408_FinalProj.zip Unzip ELE408_FinalProj.zip 4. Like in the lab, insert your microsd card and start up the DE1-SoC board running LXDE linux 5. In a separate terminal run connect to the DE1-SoC and copy the ChessBoard/ directory to the DE1-SoC board screen /dev/ttyusb0 115200 mkdir AI_Chess_Over_Network cd AI_Chess_Over_Network scp -r hostname@hostip:~/ai_chess_over_network/chessboard/. 6. Install pygame packages on DE1-SoC board As root: apt-get install python-pygame (make sure glibc6 is version < 2.16, I believe this the lib version on the boards before hand is 2.15, but in our development process we had updated to 2.17 and then had to reinstall 2.15 in order to get the GUI running, if you have this issue you can download

libc6_2.15-0ubuntu20_armhf.deb to you desktop from https://launchpad.net/ubuntu/quantal/armhf/libc6/2.15-0ubuntu20 and copy the file from there to the DE1-SoC board: On DE1-SoC: scp -r hostname@hostip:~/(directorypath)/ libc6_2.15-0ubuntu20_armhf.deb. and can run As root on DE1: dpkg --install libc6_2.15-0ubuntu20_armhf.deb From whatever directory you copied this package to on the DE1-Soc) 7. In the terminal for your desktop go to: cd MisterQueen-master/bin/release 8. In this same terminal run: ifconfig 9. From enp0* copy the inet addr: IP address for use in the programs 10. In this terminal run the python script uci.py and paste in the IP address when asked, this is the server side python uci.py Input IP Address:(ip address goes here) 11. From the terminal that is running screen, the terminal for the DE1-SoC board, move into the ChessBoard directory and run the chess.py script and paste in the same IP address when asked, this is the client side cd ChessBoard/ python chess.py Input IP Address:(ip address goes here) 12. On the server side terminal you should see that you have connected to the client IP, and the initializations taking place for the game. On the DE1-SoC you should see the GUI appear on the touchscreen with all the chess pieces in their starting positions 13. You can use the touch screen as mouse inputs to move the pieces, however we recommend connecting a mouse to the DE1-SoC because of the inaccuracy of the touch screen 14. If you are not familiar with the rules and moves involved with chess here is a link to learn: https://www.chess.com/learn-how-to-play-chess 15. You can move a piece by clicking the piece, and then clicking the square you would like to go to. If you move a piece on the DE1-SoC GUI you should see the move received by

the the server side, the script sends that move to the engine and prints out what the best move will be 16. The best move will be sent to the DE1-SoC GUI and update the board with this new information 17. If the game is over, either one side has no pieces left, or the king from either side has been taken, press the New Game button on the DE1-SoC GUI to reset the board and will also restart the game on the engine side. Was our Best Outcome met? Originally we planned to have the chess engine operate on the FPGA board and that would act as the server. We now realize the better option is to use the FPGA as the platform for the GUI, and the desktop which has more computational power and resources as the server side, you can see this decision was made in our final product. We also wanted to work with machine algorithms so that the engine would get better and better, but due to time constraints and lack of familiarity with chess engines we made the executive decision to use Michael Fogleman s chess engine MisterQueen that was written in C to expedite development. We do have a chess game that communicates between a GUI on the DE1-SoC as a client and an open source chess engine on the desktop as our server using socket programming. Our Best outcome was not met because we did not implement and integrate deep learning algorithms. Features for Future Development: Adding functionality for determining check and checkmate states, currently the AI just takes our king and we restart the game, or we take his king and we restart the game Ideally we would like to modify the engine further to use machine learning algorithms to constantly get better at the game Adding levels of difficulty so that we can invite beginners to play the game and challenge the most hardened of veterans Animations would be really nice, the refresh is a little hard to follow so implementing smoother transitions from square to square would be visually pleasing Adding some music would be fun as well, having a good combination of audio and visual is necessary for a good game

Conclusion: In conclusion we learned a lot throughout the process developing this project and bringing it to life. We learned a lot about writing scripts in python developing the GUI, using python for socket programming and how to interact with a C program executable inside of the python script, and learned about deterministic chess engines and the methods they use in order to complete computations and determine what the best move to make is. We would like to thank Michael Fogleman for producing his open source chess engine, MisterQueen, and allowing the community of developers to use and learn from his research and development.