C nnect 4 Group 9-18 See Zhuo Rui Jorelle 3S3 (Leader)

Slides:



Advertisements
Similar presentations
P ROBLEM S OLVING WITH 6C Probability and strategy.
Advertisements

GAME THEORY.
Martin Boyd Christopher Hirunthanakorn
The Game of Algebra or The Other Side of Arithmetic The Game of Algebra or The Other Side of Arithmetic © 2007 Herbert I. Gross by Herbert I. Gross & Richard.
AE1APS Algorithmic Problem Solving John Drake.  Invariants – Chapter 2  River Crossing – Chapter 3  Logic Puzzles – Chapter 5  Matchstick Games -
AI for Connect-4 (or other 2-player games) Minds and Machines.
Place captured red pieces here Place captured yellow pieces here To use as Kings Rules New Game Exit Left mouse click on piece – drag to desired location.
Dice Task Task 1Task 2Task 3Task 4 Task 5Task 6Task 7Task 8 NC Level 3 to 6.
Strategy Games for Older Students YUMI DEADLY CENTRE School of Curriculum Enquiries: YuMi Deadly.
Connect Four Michelle Chen Felix Chung Annabel Hung Raymond Wong.
Brian Duddy.  Two players, X and Y, are playing a card game- goal is to find optimal strategy for X  X has red ace (A), black ace (A), and red two (2)
Connect Four AI Robert Burns and Brett Crawford. Connect Four  A board with at least six rows and seven columns  Two players: one with red discs and.
Games. Adversaries Consider the process of reasoning when an adversary is trying to defeat our efforts In game playing situations one searches down the.
Senior Project Poster Day 2007, CIS Dept. University of Pennsylvania Reversi Meng Tran Faculty Advisor: Dr. Barry Silverman Strategies: l Corners t Corners.
Cilk Pousse James Process CS534. Overview Introduction to Pousse Searching Evaluation Function Move Ordering Conclusion.
The Chooser-Picker 7-in-a-row game András Csernenszky July Szeged.
Analyzing Puzzles and Games. What is the minimum number of moves required to complete this puzzle?
Game tree search Thanks to Andrew Moore and Faheim Bacchus for slides!
Chess Strategies Component Skills Strategies Prototype Josh Waters, Ty Fenn, Tianyu Chen.
CompSci Backtracking, Search, Heuristics l Many problems require an approach similar to solving a maze ä Certain mazes can be solved using the.
CPS Backtracking, Search, Heuristics l Many problems require an approach similar to solving a maze ä Certain mazes can be solved using the “right-hand”
An AI Game Project. Background Fivel is a unique hybrid of a NxM game and a sliding puzzle. The goals in making this project were: Create an original.
Teaching Computers to Think:
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.
CHESS “The Ultimate GAME of Challenge and Strategy”
Game playing Types of games Deterministic vs. chance
Game Playing Why do AI researchers study game playing?
Backtracking, Search, Heuristics
Entry Task What is the polynomial function in standard form with the zeros of 0,2,-3 and -1?
Figure 5: Change in Blackjack Posterior Distributions over Time.
The Hungarian algorithm for non-square arrays
Optimal Play of the Farkle Dice Game
Properties of Operations
Othello Artificial Intelligence With Machine Learning
Tools for Decision Analysis: Analysis of Risky Decisions
Next Level Tic-Tac-Toe
PENGANTAR INTELIJENSIA BUATAN (64A614)
Heuristic Search A heuristic is a rule for choosing a branch in a state space search that will most likely lead to a problem solution Heuristics are used.
Pairings FIDE Arbiter Seminar.
Presented by: Jacob Thurston Project 19 – How to Play Checkers 3/8/12
Othello Artificial Intelligence With Machine Learning
Types of Algorithms.
Heuristic AI for XiangQi
The Parameterized Poker Squares EAAI NSG Challenge
Chapter 6 Game Theory (Module 4) 1.
Game Theory.
Types of Algorithms.
This game plays just like the popular children’s game, Connect Four®
Patterns – Learning Outcomes
Pairings FIDE Arbiter Seminar.
Maths Games for Maths Games Days
Kevin Mason Michael Suggs
NIM - a two person game n objects are in one pile
Applied Combinatorics, 4th Ed. Alan Tucker
PASCAL’S TRIANGLE.
The Alpha-Beta Procedure
CSE (c) S. Tanimoto, 2001 Search-Introduction
Haskell Tips You can turn any function that takes two inputs into an infix operator: mod 7 3 is the same as 7 `mod` 3 takeWhile returns all initial.
Chapter 3 Special Section
CO Games Development 1 Week 8 Depth-first search, Combinatorial Explosion, Heuristics, Hill-Climbing Gareth Bellaby.
Team Dont Block Me, National Taiwan University
Addo How to play.
Types of Algorithms.
Backtracking, Search, Heuristics
Minimax strategies, alpha beta pruning
Six dominoes have been placed in this grid and there is only one way of filing the grid with more dominoes. Try it:
Connect 4 michael yura.
Backtracking, Search, Heuristics
2019 SAIMC Puzzle Challenge General Regulations
Unit II Game Playing.
Presentation transcript:

C nnect 4 Group 9-18 See Zhuo Rui Jorelle 3S3 (Leader) Leom Sheng Teng 3S2 Hrithik Victor Sekhri 3S2

Contents Recap Objective 2 Objective 1 Preview Introduction Objectives Terminology Objective 1 Methodology Findings Objective 2 Methodology Findings Preview Objective 3 Web report

Introduction Connect 4 is a two-player, zero-sum game, in which each player alternately drop pieces to the bottom of a 7 by 6 grid. The first player to connect four pieces either horizontally, vertically or diagonally is the victor. Zero-sum - One person’s gain is equivalent to another person’s loss

Objectives To derive a set of heuristic rules for Connect 4 for both players, which will help them determine their next move. To find out if our heuristic rules for Connect 4 apply to different variations of the game in which the number of discs required to be connected to win, and the dimensions of the board are altered. To derive a set of heuristic rules for each variation of the game and deduce the results when both players play perfectly, using a knowledge-based approach. Knowledge-based approach - A general method of investigation or inquiry, which utilises known concepts in a given area.

Terminology Block Play follow up Greedy algorithm Perfect Play Move made to temporarily prevent opponent from connecting four in a row Play follow up Play in the same column as the opponent Greedy algorithm Play that makes the most optimal moves Perfect Play A scenario where both players make the most optimal moves Odd/Even Threat A threat which is classified based on whether the row number that it is found in is odd or even Threat A generalised term for a cell that a player may occupy to form a four in a row

Objective 1 How to win the game?

Game tree In order to test our heuristic rules, we played many games with the AI. Our algorithm had a success rate of above 80% against the AI, even in Advanced difficulty. The picture shows one of the game trees we recorded for easy analysis. We played as player 1. This particular example is identical to one of the perfect play we saw in our literature review.

Mapping From the work by Allis (1988), we know that there are 69 ways to form a four-in-a-row. The given map shows the number of four-in-a- rows each cell can be part of. This allows us to easily evaluate the value of each cell. We identified the six cells in the middle to be the most important, as they are part of the most four-in-a-rows. Prepare the relevant Literature review slide

Scoring system Through the use of the map, we were able to make general judgements on who was winning the game. We devised a scoring system, whereby the score is the sum of the value of the cells occupied by the player.

Scoring system By subtracting our opponents’ score from our score, we get the net score. When our net score is positive, chances are that we are winning.

General rules Before the game, try to start first. When there is a winning move, make it. When your opponent has directly playable threat, block it. When your opponent makes two-in-a-row either horizontally or diagonally (minor threat), block it. Do not play directly below your opponent’s threats. Do not establish threats above your opponent’s threats. Do not play directly below your own threats.

But what happens when none of these rules can be applied?

Greedy algorithm An algorithm that follows the problem solving heuristic of making the locally optimal choice (filling cell with the greatest value) at each stage with the hope of finding a global optimum (winning the game). This includes starting in the centre on the first turn. However, it is important that we take into account the changing value of cells throughout the game as a result of opponent blocks.

Combinatorial gameplay Used alongside greedy algorithm In summary, this means establishing threats whenever possible. The table below shows the priority of threats. Stacked Horizontal Diagonal Vertical Most advantageous Least advantageous

“Goodness” of threat 1st player 2nd player Odd threat Even Threat 1st Player Wins Draw 2nd Player Wins

Play follow up Best method to “play out the game” after establishment of two useful threats (1st player: 2 odd threats, 2nd player: 2 even threats) Ensures that late in the game, your opponent is forced into a Zugzwang (has no choice but to play directly under one of your threats as all the other cells have been filled up, allowing you to form four-in-a-row and win.

Heuristic rules for Connect 4 Are none of the rules applicable in your current situation? Follow General rules Greedy Algorithm + Combinatorial Gameplay Are you first or second player? First Second Established 1 odd threats? Established 1 even threats? Play follow up Yes No

Combinatorial gameplay General rules Greedy Algorithm Combinatorial gameplay Play follow up + VICTORY

Objective 2 Does it apply again?

Methodology Our methodology for Objective 2 is similar to our methodology for Objective 1, except that we analysed the different variations of the game to see how our heuristic rules can be applied. Our findings show the heuristic rules that cannot be applied to the different variations of the game and the reasoning behind it.

Connect 3: (5 by 4), (6 by 5) or (7 by 6) General rules When your opponent makes two-in-a-row either horizontally or diagonally (minor threat), block it. Allowing your opponent to make two-in-a-row and establish two threats will cause you to lose the game. Greedy algorithm Due to the ease of forming three-in-a-row, the value of the cells can be disregarded when establishing threats. “Goodness” of threat Similarly, the oddness or evenness of threats can be disregarded.

Connect 4: (5 by 4) All of our heuristic rules apply! SUCCESS

Connect 4: (6 by 5) “Goodness” of threat Establishing odd threats does not ensure victory for the first player. Similarly, establishing even threats does not ensure victory for the second player.

Connect 5: (5 by 4) General rules Greedy algorithm When your opponent makes two-in-a-row either horizontally or diagonally (minor threat), block it. Just making two-in-a-row is too trivial a threat considering the need to make five-in-a-row. Greedy algorithm The value of all the cells are the same, hence it is not applicable.

Connect 5: (6 by 5) General rules Greedy algorithm When your opponent makes two-in-a-row either horizontally or diagonally (minor threat), block it. Just making two-in-a-row is too trivial a threat considering the need to make five-in-a-row. Greedy algorithm With the focus on filling cells with greater value rather than on establishing threats, a five-in-a-row may be difficult to form. This is because a 6 by 5 dimension board is relatively small for Connect 5.

Connect 5: (6 by 5) “Goodness” of threat Establishing odd threats does not ensure victory for the first player. Similarly, establishing even threats does not ensure victory for the second player.

Connect 5: (7 by 6) General rules When your opponent makes two-in-a-row either horizontally or diagonally (minor threat), block it. Just making two-in-a-row is too trivial a threat considering the need to make five-in-a-row.

Conclusion Connect 3 Connect 4 Connect 5 5 by 4 General rules Greedy algorithm “Goodness” of threat “Goodness” of threats 6 by 5 7 by 6 Pattern Identified: “Goodness” of threats can be applied as long as oddness and evenness of dimensions of the board remain the same.

Connect 4 Connect 5 Connect 3 Objective 3 To derive a set of heuristic rules for each variation of the game and deduce the results when both players play perfectly, using a knowledge-based approach. Connect 3 Connect 4 Connect 5

References Allis, V. (1988). A Knowledge-based Approach of Connect-Four. Retrieved on 16 February 2015 from http://www.informatik.uni- trier.de/~fernau/DSL0607/Masterthesis-Viergewinnt.pdf Allen, J. D. (1990). Expert Play in Connect-Four. Retrieved on 2 March 2015 from http://tromp.github.io/c4.html Tromp, J. (2008). John’s Connect Four Playground. Retrieved on 8 March 2015 from http://tromp.github.io/c4/c4.html

Web report http://connect4hci.weebly.com/

Thank You