Chomp. How is the game played Human player goes first choose a square, all to the right and down are “eaten” computer takes a turn whoever is forced to.

Slides:



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

A Case Study  Some Advice on How to Go about Solving Problems in Prolog  A Program to Play Connect-4 Game.
9.2 Mixed Strategies Two players, Robert and Carol, play a game with payoff matrix (to Robert): Is the game strictly determined? Why? Robert has strategy:
Lets Play Catch! Keeping Score in Alice By Francine Wolfe Duke University Professor Susan Rodger May 2010.
Tic Tac Toe Game Design Using OOP
CHAPTER 10 FUN AND GAMES Group 1: Xiangling Liu.
Tic Tac Au-Toe-Mata Mark Schiebel. Outline I.Brief Cellular Automata Background II.Tic-Tac Au-Toe-Mata Rules III.Project Design IV.Computer Strategy V.Conclusion.
Integer Tic Tac Toe Let’s Begin Rules: 1.Erase all x’s and o’s from the previous game before you begin. 2.Decide which player will be x’s and which will.
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.
Top-Down Design CSC 161: The Art of Programming Prof. Henry Kautz 9/16/2009.
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.
For the ultimate in entertainment, play with 2 or more people, individually or as a team Players alternate turns Each player picks an “answer” and must.
1 A reminder that the first couple of “Grid Drills” from the practice plan can be viewed HERE in video clip form. HERE Click HERE to view the 2 animated.
This game is loosely based on the Whack-A- Mole arcade game.  Each game starts with 45 seconds of play.  Moles randomly pop out of holes on the landscape.
Representing a Game Board In a game, we represent the action taking place using an array – In a very simple game, we use individual variables to represent.
Design Example. Requirements Make a program that simulates the game of blackjack For now, we ignore money/betting…. just simulate game play But… this.
BINGO! Topic Create Your Game Card You will need a blank piece of paper.
© 2007 Ray S. Babcock Tracks Game is played on a (nxn) set of squares. There are three possible moves (labeled A,B,C). Players alternate making a move.
Wizard Game: Class-Level Variables in Alice By Jenna Hayes Under the direction of Professor Susan Rodger Duke University, July
Salvador Badillo-Rios and Verenice Mojica. Goal The goal of this research project was to provide an extended analysis of 2-D Chomp using computational.
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.
Today in CS161 Lecture #4 Solving Problems with Computers Walk through the Tic Tac Toe Algorithm Getting ready for Creating Programs Turn the Inches to.
Field Trip #26 Create a Find a Word Puzzle in Java By Keith Lynn.
Case Study: Game2D with Method Design
F27SB2 Software Development 2 Lecture 6: Java GUIs 5.
Investigation #1 Factors and Products.
KeyListener and Keyboard Events Just as we can implement listeners to handle mouse events, we can do the same for keyboard events (keypresses) –to implement.
 Make sure you are subscribed to announcements on Moodle.  Activity 4 will be due 48hrs after your lab ends.
Computer Programming for Engineers. Outline Tic-Tac-Toe (O-X Game) Drawing 3x3 grid Receiving the inputs Checking for a winner Taking turns between.
The ‘game’ is played by 12 players and 2 Accountants. The accountants and the first player can volunteer. Other players Are chosen as the game progresses.
Welcome to... A Game of X’s and O’s Modified from a game Developed by Presentation © All rights Reserved
Microsoft ® Office Access ™ 2007 Training Datasheets I: Create a table by entering data ICT Staff Development presents:
Java Threads. What is a Thread? A thread can be loosely defined as a separate stream of execution that takes place simultaneously with and independently.
Announcements This Wednesday, Class and Labs are cancelled! The last lab is due this Wednesday … how many people are planning on doing it? Finally posted.
Code reading skills LEVEL GAME.  Skeleton has error messages.  Notice the red lines on right slider. Click… you’ll go to an error.  pieces = levels.getPieces();
Senior Project Poster Day 2007, CIS Dept. University of Pennsylvania Reversi Meng Tran Faculty Advisor: Dr. Barry Silverman Strategies: l Corners t Corners.
A Classic Game of Strategy for the 21 st Century.
Crystal Bennett Joshua Chukwuka Advisor: Dr. K. Berg.
More on Logic Today we look at the for loop and then put all of this together to look at some more complex forms of logic that a program will need The.
Cilk Pousse James Process CS534. Overview Introduction to Pousse Searching Evaluation Function Move Ordering Conclusion.
Two-Dimensional Arrays That’s 2-D Arrays Girls & Boys! One-Dimensional Arrays on Steroids!
Fish Chomp. The screen where you can see what happens when you play your game is called the STAGE. The SCRIPT BANK is where the types of instructions.
1 x 2 Game 1: One Player Game If you select a number sentence, give the answer. If you select an answer give the number sentence that has that answer.
School of Engineering and Computer Science Victoria University of Wellington Copyright: Peter Andreae, VUW AI for games: min-max search COMP #
Winning Strategies of Games Played with Chips. I got a interesting game Now we show the game P 1 =4 P 2 =6 P 3 =8 Rule 1: Two players.
Multiples and Factors. Multiples A multiple is a number that is in the times tables. A multiple is a number that is in the times tables. Multiples of.
By Mr. Putnam. In Catfall, the goal of the game is to touch the falling cats with the mouse. Every time you touch a cat, your score goes up by one point.
Marble Racer. The screen where you can see what happens when you play your game is called the STAGE. The SCRIPT BANK is where the types of instructions.
CS Class 15 Today  More practice with arrays  Introduction to Multi-dimensional arrays Announcements  Programming project #4 due 10/23 by midnight.
Methods Chapter 6. 2 Program Modules in Java What we call "functions" in C++ are called "___________________" in Java Purpose –Reuse code –Modularize.
The Lovely Game of NIM. Version 1 - Classic NIM You will need seven objects, such as counters or blocks. It is a game for two players. Place the 7 counters.
CS12230 Introduction to Programming Extra example– More on responsibilities 1.
Programming for Art: Arrays – 2D ART 315 Dr. J. R. Parker Art/Digital Media Lab Lec 16 Fall 2010.
More on Logic Today we look at the for loop and then put all of this together to look at some more complex forms of logic that a program will need The.
CompSci Problem Solving: Sudoku  Rules of the Game Sudoku is played with a 9 by 9 "board" consisting of nine 3 by 3 sub-boards. The symbols 1 -
1 Working with Controls at Run Time. 2 Objectives You will be able to Add controls to a Windows form at run time. Modify controls at run time.
Today's Ninja Challenge: Write Your First Computer Game!
Hollywood Squares Review Click on the slide show tab –Choose from the beginning When asked –Choose enable content.
Welcome to... A Game of X’s and O’s
Extension Jeopardy! Rules There are three categories of extension topics. Each category has three questions, with the value of each correct question going.
Section 5.5 Application: The Card Game of War. 5.5 Application: The Card Game of War A deck of cards is shuffled and dealt to two players The players.
Name 8/29/17.
Backtracking, Search, Heuristics
Introduction to Programming
Lesson 5 Functions I A function is a small program which accomplishes a specific task. For example, we invoke (call) the function, sqrt(x), in the library.
AUA Building Behaviours
EECS 110: Lec 15: Classes and Objects (2)
Backtracking, Search, Heuristics
Presentation transcript:

Chomp

How is the game played Human player goes first choose a square, all to the right and down are “eaten” computer takes a turn whoever is forced to take the last square (with the X) loses.

All complete but 2 classes

How the game works starts with BoardGame applet init method creates: 1.game object 2.the board 3.the players adds a display field and the board to the applet’s content pane chooses 1 st player calls player makeMove method.

The first thing to do is understand the program as it is. Look at –position –human player –computer player –game –game board

Position: simplest class public class Position { private int row, col; /** * Constructor */ public Position(int r, int c) { row = r; col = c; } /** * Returns this position's row */ public int getRow() { return row; } /** * Returns this position's column */ public int getCol() { return col; } used by players, board and strategy

Strategy only used by Computer player stores moves 2 ways to move random with strategy try to play without discovering the strategy the computer uses first!!

The ChompGame class public class ChompGame extends CharMatrix keeps track of board’s configuration implements the moves does not display the board – done by ChompBoard is a “model” of the game only ChompGame and Strategy know anything about the rules of the game.

Char Matrix Needed for ChompGame Finish and test this class first. No need to add any extra constructors or methods. How will you test this to be sure it works? XXXX XXXX XXXX CharMatrix c = new CharMatrix(3,4,’x’); create a 3 row 4 column matrix of x’s c.clearRect(1,3,2,4); clear from row 1 to row 2 col 3 to col 4 XXXX XX XX

Board Game Applet top class derived from JApplet complete except the hasMoved method. init method creates: –game object –the board –the players –adds a display field and the board to the applet’s content pane. Very general. Doesn’t care what game is played or how players make their moves as long as they take turns.

Board Game has moved method Called by each player when that player completes its current move. First: updates to next player. Second: Either displays a winning message if the game is over or else displays a prompt and has the other player to make the next move Needed because a player does not complete the move right away when make Move is called –human player awaits a mouse click –computer player waits until display stops flashing