The Sweet Learning Computer

Similar documents
CSC Curriculum Term One Lesson Plans

Grade 7/8 Math Circles Game Theory October 27/28, 2015

! Denver, CO! Demystifying Computing with Magic, continued

Grade 6 Math Circles Combinatorial Games November 3/4, 2015

Grade 6 Math Circles Combinatorial Games - Solutions November 3/4, 2015

Fun and Games on a Chess Board II

LEARN TO PLAY CHESS CONTENTS 1 INTRODUCTION. Terry Marris December 2004

Fun and Games on a Chess Board

Unit. The double attack. Types of double attack. With which pieces? Notes and observations

CS 4700: Foundations of Artificial Intelligence

Games of Skill Lesson 1 of 9, work in pairs

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

OCTAGON 5 IN 1 GAME SET

Games of Skill ANSWERS Lesson 1 of 9, work in pairs

KS3 Levels 3-8. Unit 3 Probability. Homework Booklet. Complete this table indicating the homework you have been set and when it is due by.

A Combinatorial Game Mathematical Strategy Planning Procedure for a Class of Chess Endgames

Analyzing Games: Solutions

All games have an opening. Most games have a middle game. Some games have an ending.

Creating PacMan With AgentCubes Online

Triple Challenge.txt

Take the Leap. xchess Rules. xchess.org P r i n t t o P l a y

Game-playing AIs: Games and Adversarial Search I AIMA

The game of Paco Ŝako

Title Screen. Instructions Screen. Character Screen. GameBoard

Adversary Search. Ref: Chapter 5

Materials: Game board, dice (preferable one 10 sided die), 2 sets of colored game board markers.

GCSE style questions arranged by topic

2. Review of Pawns p

Boulder Chess. [0] Object of Game A. The Object of the Game is to fill the opposing Royal Chambers with Boulders. [1] The Board and the Pieces

Gough, John , Doing it with dominoes, Australian primary mathematics classroom, vol. 7, no. 3, pp

game tree complete all possible moves

CPM Educational Program

Wild. Overlay Wild. Bonus Game. Football: Champions Cup Game Rules

More on games (Ch )

After learning the Rules, What should beginners learn next?

Take one! Rules: Two players take turns taking away 1 chip at a time from a pile of chips. The player who takes the last chip wins.

Ian Stewart. 8 Whitefield Close Westwood Heath Coventry CV4 8GY UK

Lecture 19 November 6, 2014

3. If you can t make the sum with your cards, you must draw one card. 4. Players take turns rolling and discarding cards.

Senior Math Circles February 10, 2010 Game Theory II

An End Game in West Valley City, Utah (at the Harman Chess Club)

Chapter 1: Positional Play


Game Playing AI Class 8 Ch , 5.4.1, 5.5

THE COMPLETE RULES OF TIME-CUBE CHESS

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

Combined Games. Block, Alexander Huang, Boao. icamp Summer Research Program University of California, Irvine Irvine, CA

SIMPLE POP ART EFFECT

1. a. Miki tosses a coin 50 times, and the coin shows heads 28 times. What fraction of the 50 tosses is heads? What percent is this?

Players try to obtain a hand whose total value is greater than that of the house, without going over 21.

Creating PacMan With AgentCubes Online

Chess Rules- The Ultimate Guide for Beginners

MyPawns OppPawns MyKings OppKings MyThreatened OppThreatened MyWins OppWins Draws

Chess Handbook: Course One

37 Game Theory. Bebe b1 b2 b3. a Abe a a A Two-Person Zero-Sum Game

If a pawn is still on its original square, it can move two squares or one square ahead. Pawn Movement

The Basic Rules of Chess

Little Dead Riding Hood

Keeping secrets secret

KATAMARI RIDER. Fire. Earth. Water. Wind GETTING STARTED PLAY

Grade 3. Summer Math Packet. This packet is optional for those students who just completed Grade 2 and who will be in Grade 3 in September.

Battle. Table of Contents. James W. Gray Introduction

A Sampling of Chess and Chip Games

Chess Puzzle Mate in N-Moves Solver with Branch and Bound Algorithm

SDS PODCAST EPISODE 110 ALPHAGO ZERO

CS 331: Artificial Intelligence Adversarial Search II. Outline

Let's Race! Typing on the Home Row

More on games (Ch )

DELUXE 3 IN 1 GAME SET

Tournament etiquette is a lot simpler than table manners. We expect Scholastic Players to always demonstrate the following basic courtesies:

V. Adamchik Data Structures. Game Trees. Lecture 1. Apr. 05, Plan: 1. Introduction. 2. Game of NIM. 3. Minimax

ZOMBIES!!! JR. PLAYTIME IS OVER! TWILIGHT CREATIONS PRESENTS. Game Design by Todd and Kerry Breitenstein

HEY! DON T READ THESE RULES!

Equipment for the basic dice game

The Pieces Lesson. In your chess set there are six different types of piece.

In this project you ll learn how to create a game, in which you have to match up coloured dots with the correct part of the controller.

The first player to construct his or her obelisk is the winner, and if a player has no legal moves, he or she immediately loses the game.

Advanced Strategy in Spades

Girls Programming Network. Scissors Paper Rock!

The Art of the Discard

MATHEMATICAL RELATIONAL SKILLS AND COUNTING 0 20

THE EFFECTIVENESS OF DAMATH IN ENHANCING THE LEARNING PROCESS OF FOUR FUNDAMENTAL OPERATIONS ON WHOLE NUMBERS

Discussion of Emergent Strategy

Part A. 1. How many seconds are there in sixty-two minutes? (A) 62 (B) 3602 (C) 3620 (D) 3680 (E) 3720 (C) 3 8 (A) 7 (B) 11 (C) 13 (D) 15 (E) 17

4th Pui Ching Invitational Mathematics Competition. Final Event (Secondary 1)

Essential Chess Basics (Updated Version) provided by Chessolutions.com

Why Icebreakers? great way to help young people get to know one another engage the group at the beginning of a session introduce a topic

For our EC331 project we successfully designed and implemented a PIC based Tic-Tac-Toe game using the PIC16874.

Creating Journey In AgentCubes

San Diego Museum of Man Lesson Plan Play the Game of Senet. Teacher Lesson Plan

Searching over Metapositions in Kriegspiel

Wythoff s Game. Kimberly Hirschfeld-Cotton Oshkosh, Nebraska

Beeches Holiday Lets Games Manual

The first player, Fred, turns on the calculator, presses a digit key and then presses the

Dude, Where s Your Brother?

#2: Challenge vs. Success

What Do You Expect Unit (WDYE): Probability and Expected Value

UNIT 13A AI: Games & Search Strategies

Inventor: 2009 manuela&wiesl

Kodu Module 1: Eating Apples in the Kodu World

Transcription:

A cs4fn / Teaching London Computing Special The Sweet Learning Computer Making a machine that learns www.cs4fn.org/machinelearning/

The Sweet Learning Computer How do machines learn? Don t they just blindly follow rules? You can build a machine just from cups and sweets that learns how to beat humans at simple games. It learns from its mistakes (because you eat it s sweets when it loses!) Let s see how by building one to play Hexapawn. The Rules of Hexapawn The game of Hexapawn is played on a 3x3 board. Three X and three O pieces are placed on the first and last rows of the board as shown to the right. It s a little like playing a mini-game of chess with only pawns. To make a move you can either: 1. Move one place forward if nothing is there, or 2. Take an opponent s piece that s in the next place diagonally For example, the board to the right gives the four possible moves for the player playing X from that position. There are 3 ways to win. The examples below show winning moves by X in each way. 1. Getting a piece onto the last row. 2. Putting the other player in a position so that they can t move. 3. Taking all the other player s pieces That s all there is to it. Play a few games to get the idea.

Setting up a Sweet Learning Computer To create the Sweet Learning Computer: 1. Stick each of the board position pictures on to a plastic cup. 2. Spread the cups out, grouping those for each move together so they are easy to find. 3. Place wrapped coloured sweets that match the coloured arrows shown on its board in to each cup. For example, the cup for position marked A1 (right) has a red, green, and orange sweet. 4. Put the pieces on the board in the start position (see the rules). Playing the Game The Sweet Learning Computer plays second and is X. Whenever it is the computer s turn: 1. Find the cup corresponding to the game position. 2. If there are no sweets in the selected cup, the Sweet Computer resigns. 3. If there are sweets in the selected cup, then pick it up, cover the top with your hand, shut your eyes, shake the cup and take out a sweet at random. 4. Look at the colour of the sweet. Make the move shown by that coloured arrow. For example, if at board position A1 (above) and you pick an orange sweet, the machine s move is to push the rightmost X a place forwards as shown by the orange arrow. 5. Place the sweet next to the cup to show the move made. Learning by making mistakes To allow the Sweet Learning Computer to learn from its mistakes you eat it s sweets as follows: 1. At the end of any game that it loses, eat the sweet corresponding to the last move it made. 2. Always place all the other sweets back in the cups they came from. What s going on At the start, the Sweet Computer plays randomly so will lose a lot. Every time it does lose it will not make its last, losing, move again (as the sweet that stands for that move isn t there for future games). Eventually positions that always lead to a loss end up with no sweets so the machine resigns. The sweet in the previous move that led to it being in that position is then eaten it starts to learn about bad second moves and eventually bad first moves. Over time it gets better and better, until it never makes a mistake as all the bad moves have gone. The sweets left represent moves for a perfect game. Plot a graph of when it wins and loses to see its progress learning. A1 Move 1 Note that on the first player s first move, playing down the left or right give symmetrical positions. As they are equivalent we ve only provided one of the symmetrical sets of positions (those leading from position A1 above). That means for this version of the game the first player is only allowed to move the left or centre pieces on their first move. We ve done this to speed up how quickly the machine learns. Once you understand how it works, extend the machine with the missing Sweet Computer Wins Sweet Computer Loses Game

A1 A2 B1 B2 Move 1 Move 1 Move 2 Move 2 B3 Move 2 B4 B5 B6 Move 2 Move 2 Move 2 B7 B8 B9 Move 2 Move 2 Move 2 B10 Move 2 B11 C1 C2 C3 Move 2 Move 3 Move 3 Move 3 C4 C5 C6 C7 Move 3 Move 3 Move 3 Move 3 C8 Move 3 C9 C10 C11 Move 3 Move 3 Move 3

!! More Machine Learning Fun at www.cs4fn.org/machinelearning Computer Science with a sense of fun: Sweet Computer Guide V2.1 (10 Jun 2016) Created by Peter McOwan and Paul Curzon Queen Mary University of London, Based on the Matchbox Computers of Donald Michie and Martin Gardner Teaching London Computing: teachinglondoncomputing.org