Recursive Triangle Puzzle

Size: px
Start display at page:

Download "Recursive Triangle Puzzle"

Transcription

1 Recursive Triangle Puzzle Lecture 36 Section 14.7 Robb T. Koether Hampden-Sydney College Fri, Dec 7, 2012 Robb T. Koether (Hampden-Sydney College) Recursive Triangle Puzzle Fri, Dec 7, / 17

2 1 The Triangle Puzzle 2 Strategy 3 Coding the Solution 4 Assignment Robb T. Koether (Hampden-Sydney College) Recursive Triangle Puzzle Fri, Dec 7, / 17

3 Outline 1 The Triangle Puzzle 2 Strategy 3 Coding the Solution 4 Assignment Robb T. Koether (Hampden-Sydney College) Recursive Triangle Puzzle Fri, Dec 7, / 17

4 The Triangle Puzzle The triangle puzzle consists of a triangular board with 15 holes arranged as a triangle, 5 holes on a side. A peg is in every hole but one. A legal move: Three holes in a row. The hole at one end is empty. The other two holes have pegs in them. Remove the two pegs from those holes and place a peg in the empty hole (a jump ). The objective is to end up with only one peg left. Robb T. Koether (Hampden-Sydney College) Recursive Triangle Puzzle Fri, Dec 7, / 17

5 The Triangle Puzzle The Triangle Puzzle Robb T. Koether (Hampden-Sydney College) Recursive Triangle Puzzle Fri, Dec 7, / 17

6 Outline 1 The Triangle Puzzle 2 Strategy 3 Coding the Solution 4 Assignment Robb T. Koether (Hampden-Sydney College) Recursive Triangle Puzzle Fri, Dec 7, / 17

7 Strategy We will adopt a very simple strategy to solve the puzzle: Try every possible sequence of moves until we find one that works. This is somewhat like a sequential search, except that the possibilities are not arranged in sequence. If a move results in a dead end, then back up and try a different move. Apply that strategy recursively. Robb T. Koether (Hampden-Sydney College) Recursive Triangle Puzzle Fri, Dec 7, / 17

8 Strategy Number the holes Robb T. Koether (Hampden-Sydney College) Recursive Triangle Puzzle Fri, Dec 7, / 17

9 Strategy Create a list of every possible move. (0, 1, 3) (0, 2, 5) (1, 3, 6) (1, 4, 8) (2, 4, 7) (2, 5, 9) (3, 1, 0) (3, 4, 5) (3, 6, 10) (3, 7, 9) (4, 7, 11) (4, 8, 13) (5, 2, 0) (5, 4, 3) (5, 8, 12) (5, 9, 14) (6, 3, 1) (6, 7, 8) (7, 4, 2) (7, 8, 9) (8, 4, 1) (8, 7, 6) (9, 5, 2) (9, 8, 7) (10, 6, 3) (10, 11, 12) (11, 7, 4) (11, 12, 13) (12, 7, 3) (12, 8, 5) (12, 11, 10) (12, 13, 14) (13, 8, 4) (13, 12, 11) (14, 9, 5) (14, 13, 12) Robb T. Koether (Hampden-Sydney College) Recursive Triangle Puzzle Fri, Dec 7, / 17

10 Strategy Try the moves in the order in which they are listed. Skip any move in the list that is not legal, given the current board configuration. Robb T. Koether (Hampden-Sydney College) Recursive Triangle Puzzle Fri, Dec 7, / 17

11 Outline 1 The Triangle Puzzle 2 Strategy 3 Coding the Solution 4 Assignment Robb T. Koether (Hampden-Sydney College) Recursive Triangle Puzzle Fri, Dec 7, / 17

12 Coding the Solution Create a Move class. A Move object has 3 data members. int jumper The peg that jumps. int jumpee The peg that gets jumped. int newpeg The hole where jumper landed. Store the set of all possible moves in an array possmoves of Moves (size 36). Robb T. Koether (Hampden-Sydney College) Recursive Triangle Puzzle Fri, Dec 7, / 17

13 Coding the Solution Create an array soln of the sequence of moves so far, stored by their index (size 13). Create an array board of bools that represents the game board (size 15). true means there is a peg in the hole. false means the hole is empty. Robb T. Koether (Hampden-Sydney College) Recursive Triangle Puzzle Fri, Dec 7, / 17

14 Coding the Solution The sovlepuzzle() Function void solvepuzzle(bool board[], Move possmoves[], int soln[], int nummoves); Write a function solvepuzzle(). The function solvepuzzle() will scan the list of possible moves, looking for a legal move, given the current board configuration. The parameter currmove is the most recent move taken. Robb T. Koether (Hampden-Sydney College) Recursive Triangle Puzzle Fri, Dec 7, / 17

15 Coding the Solution The islegal() Function bool islegal(bool board[], Move move); We need a function islegal() that will determine whether a move is legal, given the current board configuration. This function will return true if move.jumper and move.jumpee are occupied, and move.newpeg is unoccupied. Otherwise, it returns false. Robb T. Koether (Hampden-Sydney College) Recursive Triangle Puzzle Fri, Dec 7, / 17

16 Outline 1 The Triangle Puzzle 2 Strategy 3 Coding the Solution 4 Assignment Robb T. Koether (Hampden-Sydney College) Recursive Triangle Puzzle Fri, Dec 7, / 17

17 Assignment Assignment Read Section Robb T. Koether (Hampden-Sydney College) Recursive Triangle Puzzle Fri, Dec 7, / 17

Pointers. The Rectangle Game. Robb T. Koether. Hampden-Sydney College. Mon, Jan 21, 2013

Pointers. The Rectangle Game. Robb T. Koether. Hampden-Sydney College. Mon, Jan 21, 2013 Pointers The Rectangle Game Robb T. Koether Hampden-Sydney College Mon, Jan 21, 2013 Robb T. Koether (Hampden-Sydney College) Pointers Mon, Jan 21, 2013 1 / 21 1 Introduction 2 The Game Board 3 The Move

More information

Digital Logic Circuits

Digital Logic Circuits Digital Logic Circuits Lecture 5 Section 2.4 Robb T. Koether Hampden-Sydney College Wed, Jan 23, 2013 Robb T. Koether (Hampden-Sydney College) Digital Logic Circuits Wed, Jan 23, 2013 1 / 25 1 Logic Gates

More information

Enhanced Turing Machines

Enhanced Turing Machines Enhanced Turing Machines Lecture 28 Sections 10.1-10.2 Robb T. Koether Hampden-Sydney College Wed, Nov 2, 2016 Robb T. Koether (Hampden-Sydney College) Enhanced Turing Machines Wed, Nov 2, 2016 1 / 21

More information

Counting and Probability

Counting and Probability Counting and Probability Lecture 42 Section 9.1 Robb T. Koether Hampden-Sydney College Wed, Apr 9, 2014 Robb T. Koether (Hampden-Sydney College) Counting and Probability Wed, Apr 9, 2014 1 / 17 1 Probability

More information

Rectangle Man. Lecture 9. Robb T. Koether. Hampden-Sydney College. Fri, Sep 8, 2017

Rectangle Man. Lecture 9. Robb T. Koether. Hampden-Sydney College. Fri, Sep 8, 2017 Rectangle Man Lecture 9 Robb T. Koether Hampden-Sydney College Fri, Sep 8, 2017 Robb T. Koether (Hampden-Sydney College) Rectangle Man Fri, Sep 8, 2017 1 / 18 Outline 1 Drawing Rectangle Man 2 Manipulating

More information

ENEE 150: Intermediate Programming Concepts for Engineers Spring 2018 Handout #7. Project #1: Checkers, Due: Feb. 19th, 11:59p.m.

ENEE 150: Intermediate Programming Concepts for Engineers Spring 2018 Handout #7. Project #1: Checkers, Due: Feb. 19th, 11:59p.m. ENEE 150: Intermediate Programming Concepts for Engineers Spring 2018 Handout #7 Project #1: Checkers, Due: Feb. 19th, 11:59p.m. In this project, you will build a program that allows two human players

More information

Subqueries Lecture 9

Subqueries Lecture 9 Subqueries Lecture 9 Robb T. Koether Hampden-Sydney College Mon, Feb 6, 2012 Robb T. Koether (Hampden-Sydney College) SubqueriesLecture 9 Mon, Feb 6, 2012 1 / 13 1 Subqueries 2 Robb T. Koether (Hampden-Sydney

More information

Controlling Bias; Types of Variables

Controlling Bias; Types of Variables Controlling Bias; Types of Variables Lecture 11 Sections 3.5.2, 4.1-4.2 Robb T. Koether Hampden-Sydney College Mon, Feb 6, 2012 Robb T. Koether (Hampden-Sydney College) Controlling Bias;Types of Variables

More information

CMPS 12A Introduction to Programming Programming Assignment 5 In this assignment you will write a Java program that finds all solutions to the n-queens problem, for. Begin by reading the Wikipedia article

More information

Lecture 11: 1% Pure Luck

Lecture 11: 1% Pure Luck Lecture 11: 1% Pure Luck Make-up lab hours: :0-6 today CS150: Computer Science University of Virginia Computer Science David Evans http://www.cs.virginia.edu/evans Data Abstractions Solving the How to

More information

In the game of Chess a queen can move any number of spaces in any linear direction: horizontally, vertically, or along a diagonal.

In the game of Chess a queen can move any number of spaces in any linear direction: horizontally, vertically, or along a diagonal. CMPS 12A Introduction to Programming Winter 2013 Programming Assignment 5 In this assignment you will write a java program finds all solutions to the n-queens problem, for 1 n 13. Begin by reading the

More information

ENGR170 Assignment Problem Solving with Recursion Dr Michael M. Marefat

ENGR170 Assignment Problem Solving with Recursion Dr Michael M. Marefat ENGR170 Assignment Problem Solving with Recursion Dr Michael M. Marefat Overview The goal of this assignment is to find solutions for the 8-queen puzzle/problem. The goal is to place on a 8x8 chess board

More information

Once you get a solution draw it below, showing which three pennies you moved and where you moved them to. My Solution:

Once you get a solution draw it below, showing which three pennies you moved and where you moved them to. My Solution: Arrange 10 pennies on your desk as shown in the diagram below. The challenge in this puzzle is to change the direction of that the triangle is pointing by moving only three pennies. Once you get a solution

More information

Solitaire Games. MATH 171 Freshman Seminar for Mathematics Majors. J. Robert Buchanan. Department of Mathematics. Fall 2010

Solitaire Games. MATH 171 Freshman Seminar for Mathematics Majors. J. Robert Buchanan. Department of Mathematics. Fall 2010 Solitaire Games MATH 171 Freshman Seminar for Mathematics Majors J. Robert Buchanan Department of Mathematics Fall 2010 Standard Checkerboard Challenge 1 Suppose two diagonally opposite corners of the

More information

For 1 to 4 players Ages 12 to adult. Ternion Factor TM. Three games of strategy Solitaire puzzles. A product of Kadon Enterprises, Inc.

For 1 to 4 players Ages 12 to adult. Ternion Factor TM. Three games of strategy Solitaire puzzles. A product of Kadon Enterprises, Inc. For 1 to 4 players Ages 12 to adult Ternion Factor TM Three games of strategy Solitaire puzzles A product of Kadon Enterprises, Inc. The Ternion Factor, Ternion Spaces, and Escape! are trademarks of Arthur

More information

More Recursion: NQueens

More Recursion: NQueens More Recursion: NQueens continuation of the recursion topic notes on the NQueens problem an extended example of a recursive solution CISC 121 Summer 2006 Recursion & Backtracking 1 backtracking Recursion

More information

Public-Service Announcement

Public-Service Announcement Public-Service Announcement Autofocus is Berkeley s first mobile photography club. Join us as we build a community of phone photographers at Cal. All you need to be part is an interest in photography and

More information

Second Annual University of Oregon Programming Contest, 1998

Second Annual University of Oregon Programming Contest, 1998 A Magic Magic Squares A magic square of order n is an arrangement of the n natural numbers 1,...,n in a square array such that the sums of the entries in each row, column, and each of the two diagonals

More information

Tic-tac-toe. Lars-Henrik Eriksson. Functional Programming 1. Original presentation by Tjark Weber. Lars-Henrik Eriksson (UU) Tic-tac-toe 1 / 23

Tic-tac-toe. Lars-Henrik Eriksson. Functional Programming 1. Original presentation by Tjark Weber. Lars-Henrik Eriksson (UU) Tic-tac-toe 1 / 23 Lars-Henrik Eriksson Functional Programming 1 Original presentation by Tjark Weber Lars-Henrik Eriksson (UU) Tic-tac-toe 1 / 23 Take-Home Exam Take-Home Exam Lars-Henrik Eriksson (UU) Tic-tac-toe 2 / 23

More information

Problem A To and Fro (Problem appeared in the 2004/2005 Regional Competition in North America East Central.)

Problem A To and Fro (Problem appeared in the 2004/2005 Regional Competition in North America East Central.) Problem A To and Fro (Problem appeared in the 2004/2005 Regional Competition in North America East Central.) Mo and Larry have devised a way of encrypting messages. They first decide secretly on the number

More information

13 Searching for Pattern

13 Searching for Pattern 13 Searching for Pattern 13.1 Pictorial Logic In this section we will see how to continue patterns involving simple shapes. Example Continue these patterns by drawing the next 5 shapes in each case: Solution

More information

Myostat Motion Control Inc. Cool Muscle 1 RT3 Application Note. Program Bank Notes for Cool Muscle Language

Myostat Motion Control Inc. Cool Muscle 1 RT3 Application Note. Program Bank Notes for Cool Muscle Language Myostat Motion Control Inc. Cool Muscle 1 RT3 Application Note Program Bank Notes for Cool Muscle Language 1. Program Banks 1. Basic Program Bank This example shows how to write a very basic program bank

More information

Notes on solving and playing peg solitaire on a computer

Notes on solving and playing peg solitaire on a computer Notes on solving and playing peg solitaire on a computer George I. Bell gibell@comcast.net arxiv:0903.3696v4 [math.co] 6 Nov 2014 Abstract We consider the one-person game of peg solitaire played on a computer.

More information

Computer Graphics (CS/ECE 545) Lecture 7: Morphology (Part 2) & Regions in Binary Images (Part 1)

Computer Graphics (CS/ECE 545) Lecture 7: Morphology (Part 2) & Regions in Binary Images (Part 1) Computer Graphics (CS/ECE 545) Lecture 7: Morphology (Part 2) & Regions in Binary Images (Part 1) Prof Emmanuel Agu Computer Science Dept. Worcester Polytechnic Institute (WPI) Recall: Dilation Example

More information

INTRODUCTION TO COMPUTER SCIENCE I PROJECT 6 Sudoku! Revision 2 [2010-May-04] 1

INTRODUCTION TO COMPUTER SCIENCE I PROJECT 6 Sudoku! Revision 2 [2010-May-04] 1 INTRODUCTION TO COMPUTER SCIENCE I PROJECT 6 Sudoku! Revision 2 [2010-May-04] 1 1 The game of Sudoku Sudoku is a game that is currently quite popular and giving crossword puzzles a run for their money

More information

CMPUT 657: Heuristic Search

CMPUT 657: Heuristic Search CMPUT 657: Heuristic Search Assignment 1: Two-player Search Summary You are to write a program to play the game of Lose Checkers. There are two goals for this assignment. First, you want to build the smallest

More information

Homework Assignment #2

Homework Assignment #2 CS 540-2: Introduction to Artificial Intelligence Homework Assignment #2 Assigned: Thursday, February 15 Due: Sunday, February 25 Hand-in Instructions This homework assignment includes two written problems

More information

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

Pay attention to how flipping of pieces is determined with each move. CSCE 625 Programing Assignment #5 due: Friday, Mar 13 (by start of class) Minimax Search for Othello The goal of this assignment is to implement a program for playing Othello using Minimax search. Othello,

More information

Score Boards (Connect the two boards with single digits at the joint section)

Score Boards (Connect the two boards with single digits at the joint section) Notes The "hexagonal frames" are also needed for the game even after removing the triangular tiles from them, so please do NOT lose the frames. You cannot play the game without them! Kaleido Playing Time:

More information

Senior Math Circles February 10, 2010 Game Theory II

Senior Math Circles February 10, 2010 Game Theory II 1 University of Waterloo Faculty of Mathematics Centre for Education in Mathematics and Computing Senior Math Circles February 10, 2010 Game Theory II Take-Away Games Last Wednesday, you looked at take-away

More information

Conway s Soldiers. Jasper Taylor

Conway s Soldiers. Jasper Taylor Conway s Soldiers Jasper Taylor And the maths problem that I did was called Conway s Soldiers. And in Conway s Soldiers you have a chessboard that continues infinitely in all directions and every square

More information

CS 32 Puzzles, Games & Algorithms Fall 2013

CS 32 Puzzles, Games & Algorithms Fall 2013 CS 32 Puzzles, Games & Algorithms Fall 2013 Study Guide & Scavenger Hunt #2 November 10, 2014 These problems are chosen to help prepare you for the second midterm exam, scheduled for Friday, November 14,

More information

Selected Game Examples

Selected Game Examples Games in the Classroom ~Examples~ Genevieve Orr Willamette University Salem, Oregon gorr@willamette.edu Sciences in Colleges Northwestern Region Selected Game Examples Craps - dice War - cards Mancala

More information

Beyond Prolog: Constraint Logic Programming

Beyond Prolog: Constraint Logic Programming Beyond Prolog: Constraint Logic Programming This lecture will cover: generate and test as a problem solving approach in Prolog introduction to programming with CLP(FD) using constraints to solve a puzzle

More information

CS61B Lecture #33. Today: Backtracking searches, game trees (DSIJ, Section 6.5)

CS61B Lecture #33. Today: Backtracking searches, game trees (DSIJ, Section 6.5) CS61B Lecture #33 Today: Backtracking searches, game trees (DSIJ, Section 6.5) Coming Up: Concurrency and synchronization(data Structures, Chapter 10, and Assorted Materials On Java, Chapter 6; Graph Structures:

More information

Math 3012 Applied Combinatorics Lecture 2

Math 3012 Applied Combinatorics Lecture 2 August 20, 2015 Math 3012 Applied Combinatorics Lecture 2 William T. Trotter trotter@math.gatech.edu The Road Ahead Alert The next two to three lectures will be an integrated approach to material from

More information

CS61B Lecture #22. Today: Backtracking searches, game trees (DSIJ, Section 6.5) Last modified: Mon Oct 17 20:55: CS61B: Lecture #22 1

CS61B Lecture #22. Today: Backtracking searches, game trees (DSIJ, Section 6.5) Last modified: Mon Oct 17 20:55: CS61B: Lecture #22 1 CS61B Lecture #22 Today: Backtracking searches, game trees (DSIJ, Section 6.5) Last modified: Mon Oct 17 20:55:07 2016 CS61B: Lecture #22 1 Searching by Generate and Test We vebeenconsideringtheproblemofsearchingasetofdatastored

More information

Brain-on! A Trio of Puzzles

Brain-on! A Trio of Puzzles Hands Hands-on = Brain-on! A Trio of Puzzles "I hear and I forget, I see and I remember, I do and I understand." - Chinese proverb Manipulatives and hands-on activities can be the key to creating concrete

More information

Count Equal Groups. in all. Count equal groups to find how many. groups of. groups of. in all. in all R20

Count Equal Groups. in all. Count equal groups to find how many. groups of. groups of. in all. in all R20 Lesson 3.1 Count Equal Groups Equal groups have the same number in each group. There are 3 tulips in each of 4 vases. How many tulips are there in all? Step 1 Think: there are 4 vases, so draw 4 circles

More information

CS 540-2: Introduction to Artificial Intelligence Homework Assignment #2. Assigned: Monday, February 6 Due: Saturday, February 18

CS 540-2: Introduction to Artificial Intelligence Homework Assignment #2. Assigned: Monday, February 6 Due: Saturday, February 18 CS 540-2: Introduction to Artificial Intelligence Homework Assignment #2 Assigned: Monday, February 6 Due: Saturday, February 18 Hand-In Instructions This assignment includes written problems and programming

More information

Collectives Pattern. Parallel Computing CIS 410/510 Department of Computer and Information Science. Lecture 8 Collective Pattern

Collectives Pattern. Parallel Computing CIS 410/510 Department of Computer and Information Science. Lecture 8 Collective Pattern Collectives Pattern Parallel Computing CIS 410/510 Department of Computer and Information Science Outline q What are Collectives? q Reduce Pattern q Scan Pattern q Sorting 2 Collectives q Collective operations

More information

Modelling & Datatypes. John Hughes

Modelling & Datatypes. John Hughes Modelling & Datatypes John Hughes Software Software = Programs + Data Modelling Data A big part of designing software is modelling the data in an appropriate way Numbers are not good for this! We model

More information

Integer Programming Based Algorithms for Peg Solitaire Problems

Integer Programming Based Algorithms for Peg Solitaire Problems } \mathrm{m}\mathrm{i}\mathrm{s}\mathrm{o}\mathrm{j}\mathrm{i}\mathrm{r}\mathrm{o}\mathrm{t}\mathfrak{u}-\mathrm{t}\mathrm{o}\mathrm{k}\mathrm{y}\mathrm{o}\mathrm{a}\mathrm{c}\mathrm{j}\mathrm{p}$ we forward-only

More information

Graphs of Tilings. Patrick Callahan, University of California Office of the President, Oakland, CA

Graphs of Tilings. Patrick Callahan, University of California Office of the President, Oakland, CA Graphs of Tilings Patrick Callahan, University of California Office of the President, Oakland, CA Phyllis Chinn, Department of Mathematics Humboldt State University, Arcata, CA Silvia Heubach, Department

More information

CSE548, AMS542: Analysis of Algorithms, Fall 2016 Date: Sep 25. Homework #1. ( Due: Oct 10 ) Figure 1: The laser game.

CSE548, AMS542: Analysis of Algorithms, Fall 2016 Date: Sep 25. Homework #1. ( Due: Oct 10 ) Figure 1: The laser game. CSE548, AMS542: Analysis of Algorithms, Fall 2016 Date: Sep 25 Homework #1 ( Due: Oct 10 ) Figure 1: The laser game. Task 1. [ 60 Points ] Laser Game Consider the following game played on an n n board,

More information

Introductory Probability

Introductory Probability Introductory Probability Combinations Nicholas Nguyen nicholas.nguyen@uky.edu Department of Mathematics UK Agenda Assigning Objects to Identical Positions Denitions Committee Card Hands Coin Toss Counts

More information

AP Computer Science A Practice Test 6 - Picture and Elevens Labs

AP Computer Science A Practice Test 6 - Picture and Elevens Labs AP Computer Science A Practice Test 6 - Picture and Elevens Labs Name Date Period 1) What are the RGB values for a white pixel? R, G, B = 2) a) How many bytes does it take in the RGB color model (including

More information

Overview PROBLEM SOLVING AGENTS. Problem Solving Agents

Overview PROBLEM SOLVING AGENTS. Problem Solving Agents Overview PROBLEM SOLVING AGENTS Aims of the this lecture: introduce problem solving; introduce goal formulation; show how problems can be stated as state space search; show the importance and role of abstraction;

More information

Multiplication and Division MODELS

Multiplication and Division MODELS Multiplication and Divion MODELS Multiplication groups and arrays When we put objects into rows and columns like th we call it an array. Arrays can make it easier to work out how many objects there are

More information

Missing Sequence. You have 10 minutes to complete this test. Select the square that comes next in the sequence.

Missing Sequence. You have 10 minutes to complete this test. Select the square that comes next in the sequence. Missing Sequence Select the square that comes next in the sequence. 1. 2. 3. Similarities 4. 5. 6. Analogies 7. 8. ` 9. Odd one out 10. 11. 12. Complete the grid 13. 14. 15. Answers 1. A- The pattern along

More information

Problem C The Stern-Brocot Number System Input: standard input Output: standard output

Problem C The Stern-Brocot Number System Input: standard input Output: standard output Problem C The Stern-Brocot Number System Input: standard input Output: standard output The Stern-Brocot tree is a beautiful way for constructing the set of all nonnegative fractions m / n where m and n

More information

Outline. Drawing the Graph. 1 Homework Review. 2 Introduction. 3 Histograms. 4 Histograms on the TI Assignment

Outline. Drawing the Graph. 1 Homework Review. 2 Introduction. 3 Histograms. 4 Histograms on the TI Assignment Lecture 14 Section 4.4.4 on Hampden-Sydney College Fri, Sep 18, 2009 Outline 1 on 2 3 4 on 5 6 Even-numbered on Exercise 4.25, p. 249. The following is a list of homework scores for two students: Student

More information

Specification Due Date: Friday April 7 at 6am Top-down Program Outline Due Date: Wednesday April 19 at 6am Program Due Date: Monday May 15 at 6am

Specification Due Date: Friday April 7 at 6am Top-down Program Outline Due Date: Wednesday April 19 at 6am Program Due Date: Monday May 15 at 6am Kerry Ojakian s CSI 31 Class Specification Due Date: Friday April 7 at 6am Top-down Program Outline Due Date: Wednesday April 19 at 6am Program Due Date: Monday May 15 at 6am HW: Final Project Do ONE of

More information

Directed Towers of Hanoi

Directed Towers of Hanoi Richard Anstee, UBC, Vancouver January 10, 2019 Introduction The original Towers of Hanoi problem considers a problem 3 pegs and with n different sized discs that fit on the pegs. A legal move is to move

More information

Movement of the pieces

Movement of the pieces Movement of the pieces Rook The rook moves in a straight line, horizontally or vertically. The rook may not jump over other pieces, that is: all squares between the square where the rook starts its move

More information

Game Playing in Prolog

Game Playing in Prolog 1 Introduction CIS335: Logic Programming, Assignment 5 (Assessed) Game Playing in Prolog Geraint A. Wiggins November 11, 2004 This assignment is the last formally assessed course work exercise for students

More information

C SC 483 Chess and AI: Computation and Cognition. Lecture 3 September 10th

C SC 483 Chess and AI: Computation and Cognition. Lecture 3 September 10th C SC 483 Chess and AI: Computation and Cognition Lecture 3 September th Programming Project A series of tasks There are lots of resources and open source code available for chess Please don t simply copy

More information

CS/ENGRD 2110 Object-Oriented Programming and Data Structures Spring 2012 Thorsten Joachims. Lecture 17: Heaps and Priority Queues

CS/ENGRD 2110 Object-Oriented Programming and Data Structures Spring 2012 Thorsten Joachims. Lecture 17: Heaps and Priority Queues CS/ENGRD 2110 Object-Oriented Programming and Data Structures Spring 2012 Thorsten Joachims Lecture 17: Heaps and Priority Queues Stacks and Queues as Lists Stack (LIFO) implemented as list insert (i.e.

More information

An Optimal Algorithm for a Strategy Game

An Optimal Algorithm for a Strategy Game International Conference on Materials Engineering and Information Technology Applications (MEITA 2015) An Optimal Algorithm for a Strategy Game Daxin Zhu 1, a and Xiaodong Wang 2,b* 1 Quanzhou Normal University,

More information

Over ===* Three games of strategy and chance Unique solitaire puzzles. For I to 4 players Ages 12 to adult. PassTM

Over ===* Three games of strategy and chance Unique solitaire puzzles. For I to 4 players Ages 12 to adult. PassTM Over ===* For I to 4 players Ages 12 to adult PassTM Three games of strategy and chance Unique solitaire puzzles A product of Kadon Enterprises, Inc. Over-Pass is a trademark of Arthur Blumberg, used by

More information

Arithmetic Sequences Read 8.2 Examples 1-4

Arithmetic Sequences Read 8.2 Examples 1-4 CC Algebra II HW #8 Name Period Row Date Arithmetic Sequences Read 8.2 Examples -4 Section 8.2 In Exercises 3 0, tell whether the sequence is arithmetic. Explain your reasoning. (See Example.) 4. 2, 6,

More information

a b c d e f g h 1 a b c d e f g h C A B B A C C X X C C X X C C A B B A C Diagram 1-2 Square names

a b c d e f g h 1 a b c d e f g h C A B B A C C X X C C X X C C A B B A C Diagram 1-2 Square names Chapter Rules and notation Diagram - shows the standard notation for Othello. The columns are labeled a through h from left to right, and the rows are labeled through from top to bottom. In this book,

More information

The 8-queens problem

The 8-queens problem The 8-queens problem CS 5010 Program Design Paradigms Bootcamp Lesson 8.7 Mitchell Wand, 2012-2015 This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License. 1

More information

Merge Sort. Note that the recursion bottoms out when the subarray has just one element, so that it is trivially sorted.

Merge Sort. Note that the recursion bottoms out when the subarray has just one element, so that it is trivially sorted. 1 of 10 Merge Sort Merge sort is based on the divide-and-conquer paradigm. Its worst-case running time has a lower order of growth than insertion sort. Since we are dealing with subproblems, we state each

More information

!"#$%&"'()*+,"-./+0")("'1234+"5161/78"9:+)(16+"5+):/1/7

!#$%&'()*+,-./+0)('1234+5161/789:+)(16+5+):/1/7 Hey Diddle Diddle !"#$%&"'()*+,"-./+0")("'1234+"5161/78"9:+)(16+"5+):/1/7 ;44":17."3):(".?"(

More information

FEATURES 24 PUZZLES, ASSORTED MIX, MOSTLY THEMED ON 24 HPC. HINTS FOR EACH PUZZLE. SOLUTIONS FOR EACH PUZZLE.

FEATURES 24 PUZZLES, ASSORTED MIX, MOSTLY THEMED ON 24 HPC. HINTS FOR EACH PUZZLE. SOLUTIONS FOR EACH PUZZLE. FEATURES 4 PUZZLES, ASSORTED MIX, MOSTLY THEMED ON 4 HPC. HINTS FOR EACH PUZZLE. SOLUTIONS FOR EACH PUZZLE. Nanro 80 Points Turning Fences 95 Points Toroidal Skyscrapers 85 Points (50 + 5) Tents 0 Points

More information

Strings, Puzzle App I

Strings, Puzzle App I Strings, Puzzle App I CSE 120 Winter 2018 Instructor: Teaching Assistants: Justin Hsia Anupam Gupta, Cheng Ni, Eugene Oh, Sam Wolfson, Sophie Tian, Teagan Horkan Going beyond Pokemon Go: preparing for

More information

CSE 1400 Applied Discrete Mathematics Permutations

CSE 1400 Applied Discrete Mathematics Permutations CSE 1400 Applied Discrete Mathematics Department of Computer Sciences College of Engineering Florida Tech Fall 2011 1 Cyclic Notation 2 Re-Order a Sequence 2 Stirling Numbers of the First Kind 2 Problems

More information

1 Introduction. 2 An Easy Start. KenKen. Charlotte Teachers Institute, 2015

1 Introduction. 2 An Easy Start. KenKen. Charlotte Teachers Institute, 2015 1 Introduction R is a puzzle whose solution requires a combination of logic and simple arithmetic and combinatorial skills 1 The puzzles range in difficulty from very simple to incredibly difficult Students

More information

Figure 1: A Checker-Stacks Position

Figure 1: A Checker-Stacks Position 1 1 CHECKER-STACKS This game is played with several stacks of black and red checkers. You can choose any initial configuration you like. See Figure 1 for example (red checkers are drawn as white). Figure

More information

UN DOS TREZ Sudoku Competition. Puzzle Booklet for Preliminary Round. 19-Feb :45PM 75 minutes

UN DOS TREZ Sudoku Competition. Puzzle Booklet for Preliminary Round. 19-Feb :45PM 75 minutes Name: College: Email id: Contact: UN DOS TREZ Sudoku Competition Puzzle Booklet for Preliminary Round 19-Feb-2010 4:45PM 75 minutes In Association With www.logicmastersindia.com Rules of Sudoku A typical

More information

122 Taking Shape: Activities to Develop Geometric and Spatial Thinking, Grades K 2 P

122 Taking Shape: Activities to Develop Geometric and Spatial Thinking, Grades K 2 P Game Rules The object of the game is to work together to completely cover each of the 6 hexagons with pattern blocks, according to the cards chosen. The game ends when all 6 hexagons are completely covered.

More information

DDC Series Dial Digital Controller INSTALLATION AND OPERATING INSTRUCTIONS

DDC Series Dial Digital Controller INSTALLATION AND OPERATING INSTRUCTIONS DDC Series Dial Digital Controller INSTALLATION AND OPERATING INSTRUCTIONS Thank you for choosing the Toro DDC (Digital Dial Controller) irrigation controller. The DDC incorporates the lates programming

More information

Unit 12: Artificial Intelligence CS 101, Fall 2018

Unit 12: Artificial Intelligence CS 101, Fall 2018 Unit 12: Artificial Intelligence CS 101, Fall 2018 Learning Objectives After completing this unit, you should be able to: Explain the difference between procedural and declarative knowledge. Describe the

More information

Brief introduction Maths on the Net Year 2

Brief introduction Maths on the Net Year 2 Brief introduction Maths on the Net Year 2 Mildenberger Verlag 77652 Offenburg Im Lehbühl 6 Tel. + 49 (7 81) 91 70-0 Fax + 49 (7 81) 91 70-50 Internet: www.mildenberger-verlag.de E-Mail: info@mildenberger-verlag.de

More information

Recursive Sequences. EQ: How do I write a sequence to relate each term to the previous one?

Recursive Sequences. EQ: How do I write a sequence to relate each term to the previous one? Recursive Sequences EQ: How do I write a sequence to relate each term to the previous one? Dec 14 8:20 AM Arithmetic Sequence - A sequence created by adding and subtracting by the same number known as

More information

Homework Assignment #1

Homework Assignment #1 CS 540-2: Introduction to Artificial Intelligence Homework Assignment #1 Assigned: Thursday, February 1, 2018 Due: Sunday, February 11, 2018 Hand-in Instructions: This homework assignment includes two

More information

Geometry. a) Rhombus b) Square c) Trapezium d) Rectangle

Geometry. a) Rhombus b) Square c) Trapezium d) Rectangle Geometry A polygon is a many sided closed shape. Four sided polygons are called quadrilaterals. Sum of angles in a quadrilateral equals 360. Parallelogram is a quadrilateral where opposite sides are parallel.

More information

Weighted Polya Theorem. Solitaire

Weighted Polya Theorem. Solitaire Weighted Polya Theorem. Solitaire Sasha Patotski Cornell University ap744@cornell.edu December 15, 2015 Sasha Patotski (Cornell University) Weighted Polya Theorem. Solitaire December 15, 2015 1 / 15 Cosets

More information

Kismet Interface Overview

Kismet Interface Overview The following tutorial will cover an in depth overview of the benefits, features, and functionality within Unreal s node based scripting editor, Kismet. This document will cover an interface overview;

More information

COS 226 Algorithms and Data Structures Fall Midterm Exam

COS 226 Algorithms and Data Structures Fall Midterm Exam COS 226 lgorithms and Data Structures Fall 2015 Midterm Exam You have 80 minutes for this exam. The exam is closed book, except that you are allowed to use one page of notes (8.5-by-11, one side, in your

More information

COS 226 Algorithms and Data Structures Fall Midterm Exam

COS 226 Algorithms and Data Structures Fall Midterm Exam COS 226 lgorithms and Data Structures Fall 2015 Midterm Exam This exam has 8 questions worth a total of 100 points. You have 80 minutes. The exam is closed book, except that you are allowed to use one

More information

NUMBER PATTERNS. The first 3 triangular numbers can be illustrated as follows: 1 2 3

NUMBER PATTERNS. The first 3 triangular numbers can be illustrated as follows: 1 2 3 1 NUMBER PATTERNS EXERCISE 1 1. Write down the first 20 Natural Numbers. 2. Provide answers to the following: a. What are the 4 th, 5 th and 6 th even numbers? b. What relationship is between an even number

More information

ISudoku. Jonathon Makepeace Matthew Harris Jamie Sparrow Julian Hillebrand

ISudoku. Jonathon Makepeace Matthew Harris Jamie Sparrow Julian Hillebrand Jonathon Makepeace Matthew Harris Jamie Sparrow Julian Hillebrand ISudoku Abstract In this paper, we will analyze and discuss the Sudoku puzzle and implement different algorithms to solve the puzzle. After

More information

rum Puzzles in 2D and 3D Visualized with DSGI and Perspective Ted Clay, Clay Software and Statistics, Ashland, Oregon

rum Puzzles in 2D and 3D Visualized with DSGI and Perspective Ted Clay, Clay Software and Statistics, Ashland, Oregon Puzzles in 2D and 3D Visualized with DSGI and Perspective Ted Clay, Clay Software and Statistics, Ashland, Oregon Mapping ABSTRACT Do you enjoy puzzles? SAS@ can be used to solve not only abstract problems

More information

Chapter 7: Sorting 7.1. Original

Chapter 7: Sorting 7.1. Original Chapter 7: Sorting 7.1 Original 3 1 4 1 5 9 2 6 5 after P=2 1 3 4 1 5 9 2 6 5 after P=3 1 3 4 1 5 9 2 6 5 after P=4 1 1 3 4 5 9 2 6 5 after P=5 1 1 3 4 5 9 2 6 5 after P=6 1 1 3 4 5 9 2 6 5 after P=7 1

More information

Tapa Variations Contest

Tapa Variations Contest Tapa Variations Contest Feb 011 week TAPA RULE: Paint some cells black to create a continuous wall. Number/s in a cell indicate the length of black cell blocks on its neighbouring cells. If there is more

More information

Week 1 Assignment Word Search

Week 1 Assignment Word Search Week 1 Assignment Word Search Overview For this assignment, you will program functionality relevant to a word search puzzle game, the game that presents the challenge of discovering specific words in a

More information

Color-matching Non-matching Symmetries Patterns Game

Color-matching Non-matching Symmetries Patterns Game Ages 6 to adult For 1 or 2 players 9 unique four-color squares MiniMatch-ITM Color-matching Non-matching Symmetries Patterns Game A product of Kadon Enterprises, Inc. MiniMatch-I is a trademark of Kadon

More information

ActivArena TEMPLATES TEACHER NOTES FOR ACTIVARENA RESOURCES BLANK WORKING SPACE SPLIT (WITH TITLE SPACE) About this template

ActivArena TEMPLATES TEACHER NOTES FOR ACTIVARENA RESOURCES BLANK WORKING SPACE SPLIT (WITH TITLE SPACE) About this template TEMPLATES BLANK WORKING SPACE SPLIT (WITH TITLE SPACE) It contains two blank workspaces that can be the basis of many tasks. Learners may perform identical tasks or completely different tasks in their

More information

Final Project: Verify a Sudoku Solution Due Fri Apr 29 (2400 hrs)? Wed May 4 (1200 hrs)? 1

Final Project: Verify a Sudoku Solution Due Fri Apr 29 (2400 hrs)? Wed May 4 (1200 hrs)? 1 Final Project: Verify a Sudoku Solution Due Fri Apr 29 (2400 hrs)? Wed May 4 (1200 hrs)? 1 A. Why? A final project is a good way to have students combine topics from the entire semester, to see how they

More information

Coin Cappers. Tic Tac Toe

Coin Cappers. Tic Tac Toe Coin Cappers Tic Tac Toe Two students are playing tic tac toe with nickels and dimes. The player with the nickels has just moved. Itʼs now your turn. The challenge is to place your dime in the only square

More information

Video Game Engines. Chris Pollett San Jose State University Dec. 1, 2005.

Video Game Engines. Chris Pollett San Jose State University Dec. 1, 2005. Video Game Engines Chris Pollett San Jose State University Dec. 1, 2005. Outline Introduction Managing Game Resources Game Physics Game AI Introduction A Game Engine provides the core functionalities of

More information

CSE Day 2016 COMPUTE Exam. Time: You will have 50 minutes to answer as many of the problems as you want to.

CSE Day 2016 COMPUTE Exam. Time: You will have 50 minutes to answer as many of the problems as you want to. CSE Day 2016 COMPUTE Exam Name: School: There are 21 multiple choice problems in this event. Time: You will have 50 minutes to answer as many of the problems as you want to. Scoring: You will get 4 points

More information

Notes for Recitation 3

Notes for Recitation 3 6.042/18.062J Mathematics for Computer Science September 17, 2010 Tom Leighton, Marten van Dijk Notes for Recitation 3 1 State Machines Recall from Lecture 3 (9/16) that an invariant is a property of a

More information

Solving Triangular Peg Solitaire

Solving Triangular Peg Solitaire 1 2 3 47 23 11 Journal of Integer Sequences, Vol. 11 (2008), Article 08.4.8 arxiv:math/070385v [math.co] 17 Jan 2009 Solving Triangular Peg Solitaire George I. Bell Tech-X Corporation 521 Arapahoe Ave,

More information

A Peg Solitaire Font

A Peg Solitaire Font Bridges 2017 Conference Proceedings A Peg Solitaire Font Taishi Oikawa National Institute of Technology, Ichonoseki College Takanashi, Hagisho, Ichinoseki-shi 021-8511, Japan. a16606@g.ichinoseki.ac.jp

More information

Lecture 1. Permutations and combinations, Pascal s triangle, learning to count

Lecture 1. Permutations and combinations, Pascal s triangle, learning to count 18.440: Lecture 1 Permutations and combinations, Pascal s triangle, learning to count Scott Sheffield MIT 1 Outline Remark, just for fun Permutations Counting tricks Binomial coefficients Problems 2 Outline

More information

MAGIC SQUARES KATIE HAYMAKER

MAGIC SQUARES KATIE HAYMAKER MAGIC SQUARES KATIE HAYMAKER Supplies: Paper and pen(cil) 1. Initial setup Today s topic is magic squares. We ll start with two examples. The unique magic square of order one is 1. An example of a magic

More information

GPLMS Revision Programme GRADE 3 Booklet

GPLMS Revision Programme GRADE 3 Booklet GPLMS Revision Programme GRADE 3 Booklet Learner s name: School name: _ Day 1 1. Read carefully: a) The place or position of a digit in a number gives the value of that digit. b) In the number 273, 2,

More information