Writing and debugging programs

Size: px
Start display at page:

Download "Writing and debugging programs"

Transcription

1 Writing and debugging programs Programs should be designed top-down and built bottom-up. Style and presentation are aids to producing correct programs. Once written, programs should be tested analytically.

2 This lecture is about: designing programs top-down; building the code for a program bottom-up; using a good style to make programs more easily understood; testing programs systematically and analytically so you can be as certain as possible each part works as intended Writing and debugging programs 1

3 Designing programs - 1 Consider the following: Write a program that separates a list of letters into a list of vowels and a list of non-vowels. It might be run as follows:?- classify([a,b,c], Vowels,NonVowels). Vowels = [a], Non_Vowels = [b,c]? ; no 10 - Writing and debugging programs 2

4 First thoughts: Designing programs - 2 This is a list processing problem. It is a terminate at the end of list problem. We need to be able to distinguish between vowels and consonants Writing and debugging programs 3

5 In more detail: Designing programs - 3 There are three conditions and actions: the list of letters is empty terminate; the head of the list is a vowel add to the list of vowels and process the tail; the head of the list is not a vowel add to the list of consonants and process the tail Writing and debugging programs 4

6 Arguments: Designing programs - 4 We have to decide what arguments we need to pass in and out of the procedure: list of letters input ; list of vowels found output ; list of consonants found output Writing and debugging programs 5

7 Detailed design - 1 As this is a simple problem, we can quickly move to turning our thoughts into code: the list of letters is empty terminate In this problem, we can say that when there are no letters, then there are no vowels or consonants % 1 terminating classify([], [], []) Writing and debugging programs 6

8 Detailed design - 2 Having coded the terminating condition, we can move to the recursive clauses: the head of the list is a vowel add to the list of vowels and process the tail % 2 - recursive: letter is a vowel classify([vowel Tail],[Vowel Vowel_Tail], Non_Vls) :- vowel(vowel), classify(tail, Vowel_Tail, Non_Vls) Writing and debugging programs 7

9 Detailed design - 3 We can process vowels, so we need to be able to process consonants: the head of the list is not a vowel add to the list of consonants and process the tail % 3 - recursive: letter is not a vowel classify([non_vowel Tail], Vowels, [Non_Vowel Non_Vl_Tail]) :- classify(tail, Vowels, Non_Vl_Tail) Writing and debugging programs 8

10 Detailed design - 4 We are left with one piece of code to be written vowel/1. vowel(a). vowel(e). vowel(i). vowel(o). vowel(u) Writing and debugging programs 9

11 Building the program By the end of detailed design, the program will be just about complete. The next stage is to type the program into an editor and test that it works one procedure at a time. Within each procedure, test one clause at a time. The first procedure to be tested is the deepest in this case vowel/ Writing and debugging programs 10

12 Presentation of your programs Layout is a quick guide to the structure of your program. Until you are an expert Prolog programmer, follow the usual conventions. Always add one block comment per procedure. Add single line comments where needed Writing and debugging programs 11

13 Comments - 1 Prolog has two kinds of comments /* This starts a comment that can go on for many lines until it reaches */ % starts an in-line comment 10 - Writing and debugging programs 12

14 Comments - 2 It is conventional to include a block comment for each procedure that includes: /* *********************************** */ /* functor/arity */ /* details of each argument */ /* summary of what the procedure does */ /* author */ /* date */ /* *********************************** */ 10 - Writing and debugging programs 13

15 Testing a program - 1 Try to test individual clauses in a procedure then test the whole procedure. Test schedule: vowel(letter) classify([], Vowels, Non_Vowels) classify([b,c,d],vowels,non_vls) classify([a,e,i,o],vowels,non_vls) classify([a,c,e,g],vowels,non_vls) Demo Writing and debugging programs 14

16 Testing a program - 2 Clearly something is wrong. Consonants are processed OK but vowels aren t. Perhaps vowels are also being processed by the consonants rule? 10 - Writing and debugging programs 15

17 Testing a program - 3 We can test this easily by adding a write/1 subgoal to the rule: % 3 - recursive: letter is not a vowel classify([non_vl Tail], Vowels, [Non_Vl Non_Vl_Tail]) :- write(non_vl), nl, classify(tail, Vowels, Non_Vl_Tail). Demo Writing and debugging programs 16

18 When this is run, we get: Testing a program - 4?- classify([a,e,i,o,u], Vowels, Non_Vls). Vowels = [a,e,i,o], Non_Vls = []? ; o Vowels = [a,e,i], Non_Vls = [o]? 10 - Writing and debugging programs 17

19 Testing a program - 5 So, we need to stop both recursive clauses processing vowels: % 3 - recursive: letter is not a vowel classify([non_vowel Tail], Vowels, [Non_Vowel Non_Vl_Tail]) :- \+ vowel(non_vowel), classify(tail, Vowels, Non_Vl_Tail). Demo Writing and debugging programs 18

20 Three useful things Singleton variables Look at the error messages when consulting a program: member(head, [Heda _]). [Head,Heda] - singleton variables in user:member/2* Approximate lines: 22-26, 10 - Writing and debugging programs 19

21 Three useful things trace/notrace Prolog includes some debugging goals. To see what is happening in detail, use trace/notrace. % 2 - recursive: letter is a vowel classify([vowel Tail], [Vowel Tail], Non_Vls) :- trace, vowel(vowel), notrace, classify(tail, Vl_Tail, Non_Vls) Writing and debugging programs 20

22 Three useful things write/nl You can also add write/1 subgoals into rules to see what is going on, eg: % 2 - recursive: letter is a vowel classify([vowel Tail], [Vowel Vl_Tail], Non_Vls) :- vowel(vowel), write(classify(tail, Vl_Tail, Non_Vls)), nl, classify(tail, Vl_Tail, Non_Vls) Writing and debugging programs 21

23 Consolidation moment Design your program top-down divide the problem into smaller parts until you get down to code. Build your program bottom-up start with the lowest-level procedures and build into larger units. Test as you go test individual clauses as you write them, not when you ve typed the whole program Writing and debugging programs 22

24 Software Workshop Prolog Consider the following puzzle How could this puzzle be: represented solved in Prolog? 10 - Writing and debugging programs 23

25 General technique of search Prolog can be described as using a: generate and test search technique. This means: generate a possible solution to a problem test to see if the possible solution is acceptable Writing and debugging programs 24

26 Search Writing and debugging programs 25

27 Search Writing and debugging programs 26

28 How can this be programmed? We need to design: a representation of the board a solver consisting of: a possible solution generator a tester 10 - Writing and debugging programs 27

29 Representation - 1 We can code the board itself as a structured object: board(square(a1, A2, A3, A4, A5, A6, B1, B2, B3, B4, B5, B6, C1, C2, C3, C4, C5, C6, D1, D2, D3, D4, D5, D6, E1, E2, E3, E4, E5, E6, F1, F2, F3, F4, F5, F6), but we only use this for display 10 - Writing and debugging programs 28

30 Representation - 2 The square is also represented as a list with shared variables: square([a1, A2, A3, A4, A5, A6, B1, B2, B3, B4, B5, B6, C1, C2, C3, C4, C5, C6, D1, D2, D3, D4, D5, D6, E1, E2, E3, E4, E5, E6, F1, F2, F3, F4, F5, F6]), 10 - Writing and debugging programs 29

31 Representation - 3 Rows, columns and groups are represented as structured objects of six cells: sixes([six(a1, A2, A3, A4, B2, C2), six(a5, A6, B3, B4, B5, C3), six(b1, C1, D1, D2, D3, E2), six(b6, C4, C5, C6, D6, E6), six(d4, D5, E5, F4, F5, F6), six(e1, E3, E4, F1, F2, F3), etc. ])) :- Note the use of shared variables again Writing and debugging programs 30

32 Representation - 4 We need to be able to represent that individual squares are instantiated: A1 = 1, B3 = 1, B6 = 3, C3 = 2, D6 = 2, E1 = 3, E2 = 6, F3 = 4, F5 = Writing and debugging programs 31

33 Representation - 5 Bringing all of this together in a shortened example: board(square(a1, A2, A3, A4, A5, A6, F1, F2, F3, F4, F5, F6), square([a1, A2, A3, A4, A5, A6, F1, F2, F3, F4, F5, F6]), sixes([six(a1, A2, A3, A4, B2, C2), six(a5, A6, B3, B4, B5, C3), ])) :- A1 = 1, B3 = 1, F5 = Writing and debugging programs 32

34 Generating solutions - 1 In today s version, the program is very short: Step 1: Define the values that can fill a square: candidates([1,2,3,4,5,6]). Step 2: Go through the list of squares and put a candidate number in each square Writing and debugging programs 33

35 Generating solutions - 2 This is the code that puts all the candidates into the list of squares: % 1 - terminating generate([], _Candidates). % 2 - recursive generate([square Squares], Candidates) :- member(square, Candidates), generate(squares, Candidates) Writing and debugging programs 34

36 Testing solutions - 1 This involves testing each row, column and group to ensure that they have 6 unique numerical values. First the individual rows/columns/ groups are selected from the representation: % 1 - terminating test([]). % 2 - recursive test([six Sixes]) :- test_six(six), test(sixes) Writing and debugging programs 35

37 Testing solutions - 2 Then testing each combination of squares to ensure uniqueness: test_six(six(sq1, Sq2, Sq3, Sq4, Sq5, Sq6)) :- Sq1 =\= Sq2, Sq1 =\= Sq3, Sq1 =\= Sq4,, Sq4 =\= Sq6, Sq5 =\= Sq Writing and debugging programs 36

38 Running the program run :- % pick up the board and candidates board(display_square, square(square), sixes(sixes)), candidates(candidates), % generate a solution generate(square, Candidates), % test the solution test(sixes), % display successful solutions display_square(display_square) Writing and debugging programs 37

39 Running the program run :- % pick up the board and candidates board(display_square, square(square), sixes(sixes)), candidates(candidates), % generate a solution generate(square, Candidates), % test the solution test(sixes), % display successful solutions display_square(display_square) Writing and debugging programs 38

40 Running the program run :- % pick up the board and candidates board(display_square, square(square), sixes(sixes)), candidates(candidates), % generate a solution generate(square, Candidates), % test the solution test(sixes), % display successful solutions display_square(display_square) Writing and debugging programs 39

41 Running the program run :- % pick up the board and candidates board(display_square, square(square), sixes(sixes)), candidates(candidates), % generate a solution generate(square, Candidates), % test the solution test(sixes), % display successful solutions display_square(display_square) Writing and debugging programs 40

42 Running the program run :- % pick up the board and candidates board(display_square, square(square), sixes(sixes)), candidates(candidates), % generate a solution generate(square, Candidates), % test the solution test(sixes), % display successful solutions display_square(display_square) Writing and debugging programs 41

43 Running the program run :- % pick up the board and candidates board(display_square, square(square), sixes(sixes)), candidates(candidates), % generate a solution generate(square, Candidates), % test the solution test(sixes), % display successful solutions display_square(display_square) Writing and debugging programs 42

44 Analysing the program This program is correct, but it has to do a lot of work. Why? There are 6 ways of filling the first square, 6 ways of filling the second square,, 6 ways of filling the last square. = 10,314,424,798,490,535,546,171,949,056 possible solutions to be tested (if starting with an empty board) Writing and debugging programs 43

45 What can we do? Simple designs are good but they don t always work. There are two ways in which we can produce a quick program: 1. make the Prolog program more complex by writing heuristics into the code. 2. use one of the specialised extensions of Prolog using constraint processing Writing and debugging programs 44

46 Why should we be bothered with a game? Games are real world problems: on a small scale; with clearly defined rules and outcomes. Similar real-world problems are: automatic timetabling schools, universities, hospitals; resource allocation allocating ships to berths, planes to airport terminal doors; etc Writing and debugging programs 45

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

G53CLP Constraint Logic Programming

G53CLP Constraint Logic Programming G53CLP Constraint Logic Programming Dr Rong Qu Modeling CSPs Case Study I Constraint Programming... represents one of the closest approaches computer science has yet made to the Holy Grail of programming:

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

Task Scheduling. A Lecture in CE Freshman Seminar Series: Ten Puzzling Problems in Computer Engineering. May 2016 Task Scheduling Slide 1

Task Scheduling. A Lecture in CE Freshman Seminar Series: Ten Puzzling Problems in Computer Engineering. May 2016 Task Scheduling Slide 1 Task Scheduling A Lecture in CE Freshman Seminar Series: Ten Puzzling Problems in Computer Engineering May 0 Task Scheduling Slide About This Presentation This presentation belongs to the lecture series

More information

Spring 06 Assignment 2: Constraint Satisfaction Problems

Spring 06 Assignment 2: Constraint Satisfaction Problems 15-381 Spring 06 Assignment 2: Constraint Satisfaction Problems Questions to Vaibhav Mehta(vaibhav@cs.cmu.edu) Out: 2/07/06 Due: 2/21/06 Name: Andrew ID: Please turn in your answers on this assignment

More information

MEP: Demonstration Project Y7A, Unit 1. Activities

MEP: Demonstration Project Y7A, Unit 1. Activities UNIT 1 Logic Activities Activities 1.1 Two Way Tables 1.2 Shapes in Two Way Tables a. Shapes b. Numbers c. Letters 1.3 Venn Diagrams 1.4 Numbers in Venn Diagrams a. Venn Diagrams 1.5 Plane Passengers 1.6

More information

Input. Output. Examples. Note. Input file: Output file: standard input standard output

Input. Output. Examples. Note. Input file: Output file: standard input standard output Problem AC. Art Museum file: 6 seconds 6 megabytes EPFL (Extreme Programmers For Life) want to build their 7th art museum. This museum would be better, bigger and simply more amazing than the last 6 museums.

More information

Task Scheduling. A Lecture in CE Freshman Seminar Series: Ten Puzzling Problems in Computer Engineering. May 2007 Task Scheduling Slide 1

Task Scheduling. A Lecture in CE Freshman Seminar Series: Ten Puzzling Problems in Computer Engineering. May 2007 Task Scheduling Slide 1 Task Scheduling A Lecture in CE Freshman Seminar Series: Ten Puzzling Problems in Computer Engineering May 00 Task Scheduling Slide About This Presentation This presentation belongs to the lecture series

More information

A Level Computer Science H446/02 Algorithms and programming. Practice paper - Set 1. Time allowed: 2 hours 30 minutes

A Level Computer Science H446/02 Algorithms and programming. Practice paper - Set 1. Time allowed: 2 hours 30 minutes A Level Computer Science H446/02 Algorithms and programming Practice paper - Set 1 Time allowed: 2 hours 30 minutes Do not use: a calculator First name Last name Centre number Candidate number INSTRUCTIONS

More information

On the Combination of Constraint Programming and Stochastic Search: The Sudoku Case

On the Combination of Constraint Programming and Stochastic Search: The Sudoku Case On the Combination of Constraint Programming and Stochastic Search: The Sudoku Case Rhydian Lewis Cardiff Business School Pryfysgol Caerdydd/ Cardiff University lewisr@cf.ac.uk Talk Plan Introduction:

More information

Assignment 6 Play A Game: Minesweeper or Battleship!!! Due: Sunday, December 3rd, :59pm

Assignment 6 Play A Game: Minesweeper or Battleship!!! Due: Sunday, December 3rd, :59pm Assignment 6 Play A Game: Minesweeper or Battleship!!! Due: Sunday, December 3rd, 2017 11:59pm This will be our last assignment in the class, boohoo Grading: For this assignment, you will be graded traditionally,

More information

(Provisional) Lecture 31: Games, Round 2

(Provisional) Lecture 31: Games, Round 2 CS17 Integrated Introduction to Computer Science Hughes (Provisional) Lecture 31: Games, Round 2 10:00 AM, Nov 17, 2017 Contents 1 Review from Last Class 1 2 Finishing the Code for Yucky Chocolate 2 3

More information

Kenken For Teachers. Tom Davis January 8, Abstract

Kenken For Teachers. Tom Davis   January 8, Abstract Kenken For Teachers Tom Davis tomrdavis@earthlink.net http://www.geometer.org/mathcircles January 8, 00 Abstract Kenken is a puzzle whose solution requires a combination of logic and simple arithmetic

More information

Spring 06 Assignment 2: Constraint Satisfaction Problems

Spring 06 Assignment 2: Constraint Satisfaction Problems 15-381 Spring 06 Assignment 2: Constraint Satisfaction Problems Questions to Vaibhav Mehta(vaibhav@cs.cmu.edu) Out: 2/07/06 Due: 2/21/06 Name: Andrew ID: Please turn in your answers on this assignment

More information

ModelBuilder Getting Started

ModelBuilder Getting Started 2013 Esri International User Conference July 8 12, 2013 San Diego, California Technical Workshop ModelBuilder Getting Started Matt Kennedy Esri UC2013. Technical Workshop. Agenda Geoprocessing overview

More information

FreeCell Puzzle Protocol Document

FreeCell Puzzle Protocol Document AI Puzzle Framework FreeCell Puzzle Protocol Document Brian Shaver April 11, 2005 FreeCell Puzzle Protocol Document Page 2 of 7 Table of Contents Table of Contents...2 Introduction...3 Puzzle Description...

More information

Sudoku Solver Version: 2.5 Due Date: April 5 th 2013

Sudoku Solver Version: 2.5 Due Date: April 5 th 2013 Sudoku Solver Version: 2.5 Due Date: April 5 th 2013 Summary: For this assignment you will be writing a program to solve Sudoku puzzles. You are provided with a makefile, the.h files, and cell.cpp, and

More information

UPenn NETS 412: Algorithmic Game Theory Game Theory Practice. Clyde Silent Confess Silent 1, 1 10, 0 Confess 0, 10 5, 5

UPenn NETS 412: Algorithmic Game Theory Game Theory Practice. Clyde Silent Confess Silent 1, 1 10, 0 Confess 0, 10 5, 5 Problem 1 UPenn NETS 412: Algorithmic Game Theory Game Theory Practice Bonnie Clyde Silent Confess Silent 1, 1 10, 0 Confess 0, 10 5, 5 This game is called Prisoner s Dilemma. Bonnie and Clyde have been

More information

arxiv: v1 [cs.ai] 25 Jul 2012

arxiv: v1 [cs.ai] 25 Jul 2012 To appear in Theory and Practice of Logic Programming 1 Redundant Sudoku Rules arxiv:1207.926v1 [cs.ai] 2 Jul 2012 BART DEMOEN Department of Computer Science, KU Leuven, Belgium bart.demoen@cs.kuleuven.be

More information

expert sudoku C08AF111E38FF93DB6AF118C2DC9B2A6 Expert Sudoku 1 / 6

expert sudoku C08AF111E38FF93DB6AF118C2DC9B2A6 Expert Sudoku 1 / 6 Expert Sudoku 1 / 6 2 / 6 3 / 6 Expert Sudoku Expert Sudoku. Expert Sudoku puzzle games are still played and won the same way as all other Sudoku boards. Place a digit one through nine into the 3x3 box,

More information

Algorithms for Data Structures: Search for Games. Phillip Smith 27/11/13

Algorithms for Data Structures: Search for Games. Phillip Smith 27/11/13 Algorithms for Data Structures: Search for Games Phillip Smith 27/11/13 Search for Games Following this lecture you should be able to: Understand the search process in games How an AI decides on the best

More information

Probability of Compound Events. Lesson 3

Probability of Compound Events. Lesson 3 Probability of Compound Events Lesson 3 Objective Students will be able to find probabilities of compound events using organized lists, tables, and tree diagrams. They will also understand that, just as

More information

Annotated Chapter Outline

Annotated Chapter Outline Annotated Chapter Outline Chapter 1: Context, Scope and Approach 1. Context. Access-poverty-economy linkages, need for substantive scale-up, global movement SE4ALL, SDGs, etc. 2. Rationale. Complementary

More information

CMSC 201 Fall 2018 Project 3 Sudoku

CMSC 201 Fall 2018 Project 3 Sudoku CMSC 201 Fall 2018 Project 3 Sudoku Assignment: Project 3 Sudoku Due Date: Design Document: Tuesday, December 4th, 2018 by 8:59:59 PM Project: Tuesday, December 11th, 2018 by 8:59:59 PM Value: 80 points

More information

THE ASSOCIATION OF MATHEMATICS TEACHERS OF NEW JERSEY 2018 ANNUAL WINTER CONFERENCE FOSTERING GROWTH MINDSETS IN EVERY MATH CLASSROOM

THE ASSOCIATION OF MATHEMATICS TEACHERS OF NEW JERSEY 2018 ANNUAL WINTER CONFERENCE FOSTERING GROWTH MINDSETS IN EVERY MATH CLASSROOM THE ASSOCIATION OF MATHEMATICS TEACHERS OF NEW JERSEY 2018 ANNUAL WINTER CONFERENCE FOSTERING GROWTH MINDSETS IN EVERY MATH CLASSROOM CREATING PRODUCTIVE LEARNING ENVIRONMENTS WEDNESDAY, FEBRUARY 7, 2018

More information

Exercises for Introduction to Game Theory SOLUTIONS

Exercises for Introduction to Game Theory SOLUTIONS Exercises for Introduction to Game Theory SOLUTIONS Heinrich H. Nax & Bary S. R. Pradelski March 19, 2018 Due: March 26, 2018 1 Cooperative game theory Exercise 1.1 Marginal contributions 1. If the value

More information

CSC 396 : Introduction to Artificial Intelligence

CSC 396 : Introduction to Artificial Intelligence CSC 396 : Introduction to Artificial Intelligence Exam 1 March 11th - 13th, 2008 Name Signature - Honor Code This is a take-home exam. You may use your book and lecture notes from class. You many not use

More information

MITOCW watch?v=6fyk-3vt4fe

MITOCW watch?v=6fyk-3vt4fe MITOCW watch?v=6fyk-3vt4fe Good morning, everyone. So we come to the end-- one last lecture and puzzle. Today, we're going to look at a little coin row game and talk about, obviously, an algorithm to solve

More information

CMPUT 396 Tic-Tac-Toe Game

CMPUT 396 Tic-Tac-Toe Game CMPUT 396 Tic-Tac-Toe Game Recall minimax: - For a game tree, we find the root minimax from leaf values - With minimax we can always determine the score and can use a bottom-up approach Why use minimax?

More information

Applications of Advanced Mathematics (C4) Paper B: Comprehension INSERT WEDNESDAY 21 MAY 2008 Time:Upto1hour

Applications of Advanced Mathematics (C4) Paper B: Comprehension INSERT WEDNESDAY 21 MAY 2008 Time:Upto1hour ADVANCED GCE 4754/01B MATHEMATICS (MEI) Applications of Advanced Mathematics (C4) Paper B: Comprehension INSERT WEDNESDAY 21 MAY 2008 Afternoon Time:Upto1hour INSTRUCTIONS TO CANDIDATES This insert contains

More information

Higher National Unit specification. General information for centres. Jewellery: Hand Engraving Techniques. Unit code: F3Y4 35

Higher National Unit specification. General information for centres. Jewellery: Hand Engraving Techniques. Unit code: F3Y4 35 Higher National Unit specification General information for centres Unit title: Jewellery: Hand Engraving Techniques Unit code: F3Y4 35 Unit purpose: This Unit enables candidates to develop the skills and

More information

CSE 21 Math for Algorithms and Systems Analysis. Lecture 2 Lists Without Repe>>on

CSE 21 Math for Algorithms and Systems Analysis. Lecture 2 Lists Without Repe>>on CSE 21 Math for Algorithms and Systems Analysis Lecture 2 Lists Without Repe>>on Review of Last Lecture Sets and Lists Sets are unordered collec>on Lists are ordered collec>ons Rule of product # of lists

More information

SudokuSplashZone. Overview 3

SudokuSplashZone. Overview 3 Overview 3 Introduction 4 Sudoku Game 4 Game grid 4 Cell 5 Row 5 Column 5 Block 5 Rules of Sudoku 5 Entering Values in Cell 5 Solver mode 6 Drag and Drop values in Solver mode 6 Button Inputs 7 Check the

More information

CS188: Section Handout 1, Uninformed Search SOLUTIONS

CS188: Section Handout 1, Uninformed Search SOLUTIONS Note that for many problems, multiple answers may be correct. Solutions are provided to give examples of correct solutions, not to indicate that all or possible solutions are wrong. Work on following problems

More information

Lab 1. CS 5233 Fall 2007 assigned August 22, 2007 Tom Bylander, Instructor due midnight, Sept. 26, 2007

Lab 1. CS 5233 Fall 2007 assigned August 22, 2007 Tom Bylander, Instructor due midnight, Sept. 26, 2007 Lab 1 CS 5233 Fall 2007 assigned August 22, 2007 Tom Bylander, Instructor due midnight, Sept. 26, 2007 In Lab 1, you will program the functions needed by algorithms for iterative deepening (ID) and iterative

More information

Cato s Hike Quick Start

Cato s Hike Quick Start Cato s Hike Quick Start Version 1.1 Introduction Cato s Hike is a fun game to teach children and young adults the basics of programming and logic in an engaging game. You don t need any experience to play

More information

Part I At the top level, you will work with partial solutions (referred to as states) and state sets (referred to as State-Sets), where a partial solu

Part I At the top level, you will work with partial solutions (referred to as states) and state sets (referred to as State-Sets), where a partial solu Project: Part-2 Revised Edition Due 9:30am (sections 10, 11) 11:001m (sections 12, 13) Monday, May 16, 2005 150 points Part-2 of the project consists of both a high-level heuristic game-playing program

More information

NURIKABE. Mason Salisbury, Josh Smith, and Diyalo Manral

NURIKABE. Mason Salisbury, Josh Smith, and Diyalo Manral NURIKABE Mason Salisbury, Josh Smith, and Diyalo Manral Quick History Created in Japan in 1991 by Renin First appeared in a puzzle compilation book called Nikoli Named after a creature in Japanese folklore.

More information

LMI Sudoku test Shapes and Sizes 7/8 January 2012

LMI Sudoku test Shapes and Sizes 7/8 January 2012 LMI Sudoku test Shapes and Sizes 7/8 January 2012 About Shapes and Sizes Chaos sudokus (or Number Place by its original name) have always been among my favourite puzzles. When I came across such a puzzle

More information

DOWNLOAD OR READ : SUDOKU LARGE PRINT PUZZLE BOOK FOR ADULTS 200 MEDIUM PUZZLES PUZZLE BOOKS PLUS PDF EBOOK EPUB MOBI

DOWNLOAD OR READ : SUDOKU LARGE PRINT PUZZLE BOOK FOR ADULTS 200 MEDIUM PUZZLES PUZZLE BOOKS PLUS PDF EBOOK EPUB MOBI DOWNLOAD OR READ : SUDOKU LARGE PRINT PUZZLE BOOK FOR ADULTS 200 MEDIUM PUZZLES PUZZLE BOOKS PLUS PDF EBOOK EPUB MOBI Page 1 Page 2 sudoku large print puzzle book for adults 200 medium puzzles puzzle books

More information

Physical Gameplay in Half-Life 2. presented by Jay Stelly Valve Corporation. All Rights Reserved.

Physical Gameplay in Half-Life 2. presented by Jay Stelly Valve Corporation. All Rights Reserved. Physical Gameplay in Half-Life 2 presented by Jay Stelly Physical Gameplay in Half-Life 2 New technology that hadn t been successfully integrated into our genre Technical solutions not very well understood

More information

Maths Workshop Topic Number and Place Value Miss Barrett

Maths Workshop Topic Number and Place Value Miss Barrett Maths Workshop 31.01.18 Topic Number and Place Value Miss Barrett Aims of today To get an insight into what your child is expected to know ahead of the SATs. To take away some ideas to support your child

More information

Goals for this Lecture. Lecture 5: Introduction to Analysis. Requirements Engineering. IEEE definition of requirement

Goals for this Lecture. Lecture 5: Introduction to Analysis. Requirements Engineering. IEEE definition of requirement Lecture 5: Introduction to Analysis Kenneth M. Anderson Object-Oriented Analysis and Design CSCI 6448 - Spring Semester, 2003 Goals for this Lecture Introduce the concept of analysis Discuss requirements

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

Griddler Creator. Supervisor: Linda Brackenbury. Temitope Otudeko 04/05

Griddler Creator. Supervisor: Linda Brackenbury. Temitope Otudeko 04/05 Griddler Creator Supervisor: Linda Brackenbury Temitope Otudeko 04/05 TABLE OF CONTENTS Introduction... 3 Griddler puzzle Puzzles... 3 Rules and Techniques for solving griddler puzzles... 3 History of

More information

COMP9414: Artificial Intelligence Problem Solving and Search

COMP9414: Artificial Intelligence Problem Solving and Search CMP944, Monday March, 0 Problem Solving and Search CMP944: Artificial Intelligence Problem Solving and Search Motivating Example You are in Romania on holiday, in Arad, and need to get to Bucharest. What

More information

LEVEL 3 TECHNICAL LEVEL ENGINEERING Mathematics for Engineers Mark scheme

LEVEL 3 TECHNICAL LEVEL ENGINEERING Mathematics for Engineers Mark scheme LEVEL 3 TECHNICAL LEVEL ENGINEERING Mathematics for Engineers Mark scheme Unit number: J/506/5953 Series: June 2017 Version: 1.0 Final Mark schemes are prepared by the Lead Assessment Writer and considered,

More information

NAME DATE PERIOD. Study Guide and Intervention

NAME DATE PERIOD. Study Guide and Intervention 9-1 Section Title The probability of a simple event is a ratio that compares the number of favorable outcomes to the number of possible outcomes. Outcomes occur at random if each outcome occurs by chance.

More information

Question Score Max Cover Total 149

Question Score Max Cover Total 149 CS170 Final Examination 16 May 20 NAME (1 pt): TA (1 pt): Name of Neighbor to your left (1 pt): Name of Neighbor to your right (1 pt): This is a closed book, closed calculator, closed computer, closed

More information

QUICKSTART COURSE - MODULE 7 PART 3

QUICKSTART COURSE - MODULE 7 PART 3 QUICKSTART COURSE - MODULE 7 PART 3 copyright 2011 by Eric Bobrow, all rights reserved For more information about the QuickStart Course, visit http://www.acbestpractices.com/quickstart Hello, this is Eric

More information

Writing and running recursive Prolog programs

Writing and running recursive Prolog programs Writing and running recursive Prolog programs This lecture will cover writing and running recursive rules rules that can cope with unknown and unpredictable situations. Reminder: running the jealous/2

More information

6.1.1 The multiplication rule

6.1.1 The multiplication rule 6.1.1 The multiplication rule 1. There are 3 routes joining village A and village B and 4 routes joining village B and village C. Find the number of different ways of traveling from village A to village

More information

BBC Learning English Talk about English Business Language To Go Part 8 - Delegating

BBC Learning English Talk about English Business Language To Go Part 8 - Delegating BBC Learning English Business Language To Go Part 8 - Delegating This programme was first broadcast in 2001 This is not an accurate word-for-word transcript of the programme This week s work situation

More information

Language of Instruction Course Level Short Cycle ( ) First Cycle (x) Second Cycle ( ) Third Cycle ( ) Term Local Credit ECTS Credit Fall 3 5

Language of Instruction Course Level Short Cycle ( ) First Cycle (x) Second Cycle ( ) Third Cycle ( ) Term Local Credit ECTS Credit Fall 3 5 Course Details Course Name Telecommunications II Language of Instruction English Course Level Short Cycle ( ) First Cycle (x) Second Cycle ( ) Third Cycle ( ) Course Type Course Code Compulsory (x) Elective

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

Attribute Based Specification, Comparison And Selection Of A Robot

Attribute Based Specification, Comparison And Selection Of A Robot Attribute Based Specification, Comparison And Selection Of A Robot P. P. Bhangale, V. P. Agrawal, S. K. Saha Dept. of Mechanical Engg., Indian Institute of Technology Delhi, Hauz Khas, New Delhi-006 ABSTRACT

More information

Link and Link Impedance 2018/02/13. VECTOR DATA ANALYSIS Network Analysis TYPES OF OPERATIONS

Link and Link Impedance 2018/02/13. VECTOR DATA ANALYSIS Network Analysis TYPES OF OPERATIONS VECTOR DATA ANALYSIS Network Analysis A network is a system of linear features that has the appropriate attributes for the flow of objects. A network is typically topology-based: lines (arcs) meet at intersections

More information

We hope you enjoy the set. Good luck for the Indian Puzzle Championship! 3 A B C 4 H D 5 G F E 7 A B 8 H 9 G F

We hope you enjoy the set. Good luck for the Indian Puzzle Championship! 3 A B C 4 H D 5 G F E 7 A B 8 H 9 G F Notes:. All Puzzle rules have been copied from the IP 0 Instruction booklet. Participants are advised to have a look at the booklet before trying out these puzzles, as they contain easier examples with

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

2008 학년도대학수학능력시험 6 월모의평가듣기대본

2008 학년도대학수학능력시험 6 월모의평가듣기대본 2008 학년도대학수학능력시험 6 월모의평가듣기대본 M: The samples of our club logo are finally here. Take a look. W: Hey, they look pretty good! Which one do you like? M: I like the triangular one. W: I like it, too. But why

More information

EAB Engineering Accreditation Board

EAB Engineering Accreditation Board EAB Engineering Accreditation Board Appendix B: Specified Learning Outcomes Summary of Engineering Council Output Statements Specific Learning Outcomes Knowledge is information that can be recalled. Understanding

More information

Welcome to the Sudoku and Kakuro Help File.

Welcome to the Sudoku and Kakuro Help File. HELP FILE Welcome to the Sudoku and Kakuro Help File. This help file contains information on how to play each of these challenging games, as well as simple strategies that will have you solving the harder

More information

In this project, you will create a memory game where you have to memorise and repeat a sequence of random colours!

In this project, you will create a memory game where you have to memorise and repeat a sequence of random colours! Memory Introduction In this project, you will create a memory game where you have to memorise and repeat a sequence of random colours! Step 1: Random colours First, let s create a character that can change

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

Writing a Thesis: or how I learned to Iove cleaning the house, go shopping, do yard work, walk the cat, and find other ways to procrastinate

Writing a Thesis: or how I learned to Iove cleaning the house, go shopping, do yard work, walk the cat, and find other ways to procrastinate Writing a Thesis: or how I learned to Iove cleaning the house, go shopping, do yard work, walk the cat, and find other ways to procrastinate Paul Verburg Based on presentation developed by Toby Walsh,

More information

Model-Based Testing. CSCE Lecture 18-03/29/2018

Model-Based Testing. CSCE Lecture 18-03/29/2018 Model-Based Testing CSCE 747 - Lecture 18-03/29/2018 Creating Requirements-Based Tests Write Testable Specifications Produce clear, detailed, and testable requirements. Identify Independently Testable

More information

Adversary Search. Ref: Chapter 5

Adversary Search. Ref: Chapter 5 Adversary Search Ref: Chapter 5 1 Games & A.I. Easy to measure success Easy to represent states Small number of operators Comparison against humans is possible. Many games can be modeled very easily, although

More information

Engineering Drawing. Engineering Drawing TVET FIRST NATED SERIES. Engineering Drawing. Student s Book. NATED Series. M Cameron TVET FIRST NATED SERIES

Engineering Drawing. Engineering Drawing TVET FIRST NATED SERIES. Engineering Drawing. Student s Book. NATED Series. M Cameron TVET FIRST NATED SERIES The TVET First NATED Series offers students and lecturers a wide range of courses, written by lecturers, examiners and subject experts. Troupant/Macmillan have developed brand new books that cover the

More information

UNIT 13A AI: Games & Search Strategies

UNIT 13A AI: Games & Search Strategies UNIT 13A AI: Games & Search Strategies 1 Artificial Intelligence Branch of computer science that studies the use of computers to perform computational processes normally associated with human intellect

More information

AI in Business Enterprises

AI in Business Enterprises AI in Business Enterprises Are Humans Rational? Rini Palitmittam 10 th October 2017 Image Courtesy: Google Images Founders of Modern Artificial Intelligence Image Courtesy: Google Images Founders of Modern

More information

Eight Queens Puzzle Solution Using MATLAB EE2013 Project

Eight Queens Puzzle Solution Using MATLAB EE2013 Project Eight Queens Puzzle Solution Using MATLAB EE2013 Project Matric No: U066584J January 20, 2010 1 Introduction Figure 1: One of the Solution for Eight Queens Puzzle The eight queens puzzle is the problem

More information

Multiplication and Area

Multiplication and Area Grade 3 Module 4 Multiplication and Area OVERVIEW In this 20-day module students explore area as an attribute of two-dimensional figures and relate it to their prior understandings of multiplication. In

More information

Heuristics, and what to do if you don t know what to do. Carl Hultquist

Heuristics, and what to do if you don t know what to do. Carl Hultquist Heuristics, and what to do if you don t know what to do Carl Hultquist What is a heuristic? Relating to or using a problem-solving technique in which the most appropriate solution of several found by alternative

More information

Game Theory. Problem data representing the situation are constant. They do not vary with respect to time or any other basis.

Game Theory. Problem data representing the situation are constant. They do not vary with respect to time or any other basis. Game Theory For effective decision making. Decision making is classified into 3 categories: o Deterministic Situation: o o Problem data representing the situation are constant. They do not vary with respect

More information

Job Search Process An Action Plan

Job Search Process An Action Plan 1/5 Plan your job search process Searching for work is more than writing and sending out covering letters: it is closely tied to career planning and personal growth. The following table presents some essential

More information

Optical Design with Zemax

Optical Design with Zemax Optical Design with Zemax Lecture 9: Advanced handling 2014-06-13 Herbert Gross Sommer term 2014 www.iap.uni-jena.de 2 Preliminary Schedule 1 11.04. Introduction 2 25.04. Properties of optical systems

More information

Lab 7: 3D Tic-Tac-Toe

Lab 7: 3D Tic-Tac-Toe Lab 7: 3D Tic-Tac-Toe Overview: Khan Academy has a great video that shows how to create a memory game. This is followed by getting you started in creating a tic-tac-toe game. Both games use a 2D grid or

More information

Programming Project 2

Programming Project 2 Programming Project 2 Design Due: 30 April, in class Program Due: 9 May, 4pm (late days cannot be used on either part) Handout 13 CSCI 134: Spring, 2008 23 April Space Invaders Space Invaders has a long

More information

Classic Sudoku 9x9 - Easy To Medium - Volume Logic Puzzles By Nick Snels READ ONLINE

Classic Sudoku 9x9 - Easy To Medium - Volume Logic Puzzles By Nick Snels READ ONLINE Classic Sudoku 9x9 - Easy To Medium - Volume 62-276 Logic Puzzles By Nick Snels READ ONLINE If you are searched for a book by Nick Snels Classic Sudoku 9x9 - Easy to Medium - Volume 62-276 Logic Puzzles

More information

Contract Negotiation- Ten Tips From the Trenches

Contract Negotiation- Ten Tips From the Trenches Contract Negotiation- Ten Tips From the Trenches [Editor s Note: Here s another guest post I strong-armed the author into writing. He sent me a long email suggesting I write more about contract negotiation,

More information

This chapter gives you everything you

This chapter gives you everything you Chapter 1 One, Two, Let s Sudoku In This Chapter Tackling the basic sudoku rules Solving squares Figuring out your options This chapter gives you everything you need to know to solve the three different

More information

EARIN Jarosław Arabas Room #223, Electronics Bldg.

EARIN   Jarosław Arabas Room #223, Electronics Bldg. EARIN http://elektron.elka.pw.edu.pl/~jarabas/earin.html Jarosław Arabas jarabas@elka.pw.edu.pl Room #223, Electronics Bldg. Paweł Cichosz pcichosz@elka.pw.edu.pl Room #215, Electronics Bldg. EARIN Jarosław

More information

CS1800: More Counting. Professor Kevin Gold

CS1800: More Counting. Professor Kevin Gold CS1800: More Counting Professor Kevin Gold Today Dealing with illegal values Avoiding overcounting Balls-in-bins, or, allocating resources Review problems Dealing with Illegal Values Password systems often

More information

Reflections on the N + k Queens Problem

Reflections on the N + k Queens Problem Integre Technical Publishing Co., Inc. College Mathematics Journal 40:3 March 12, 2009 2:02 p.m. chatham.tex page 204 Reflections on the N + k Queens Problem R. Douglas Chatham R. Douglas Chatham (d.chatham@moreheadstate.edu)

More information

BEST PRACTICES COURSE WEEK 21 Creating and Customizing Library Parts PART 7 - Custom Doors and Windows

BEST PRACTICES COURSE WEEK 21 Creating and Customizing Library Parts PART 7 - Custom Doors and Windows BEST PRACTICES COURSE WEEK 21 Creating and Customizing Library Parts PART 7 - Custom Doors and Windows Hello, this is Eric Bobrow. In this lesson, we'll take a look at how you can create your own custom

More information

Chief Architect X3 Training Series. Layers and Layer Sets

Chief Architect X3 Training Series. Layers and Layer Sets Chief Architect X3 Training Series Layers and Layer Sets Save time while creating more detailed plans Why do you need Layers? Setting up Layer Lets Adding items to layers Layers and Layout Pages Layer

More information

MSc in Engineering (Technology Based Business Development) study programme Weekly schedule, autumn semester 2014

MSc in Engineering (Technology Based Business Development) study programme Weekly schedule, autumn semester 2014 MSc in (Technology Based Business Development) study programme Weekly schedule, autumn semester 2014 (Mondays and Tuesdays) Programme 01.09 Monday 1 02.09 Tuesday 03.09 Wednesday 04.09 Thursday Visits

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

Chapter Two: The GamePlan Software *

Chapter Two: The GamePlan Software * Chapter Two: The GamePlan Software * 2.1 Purpose of the Software One of the greatest challenges in teaching and doing research in game theory is computational. Although there are powerful theoretical results

More information

New A Level Design and Technology: Product Design

New A Level Design and Technology: Product Design New A Level Design and Technology: Product Design Information for OCR centres transferring to new specifications for first teaching in September 2008 This document maps the current A Level Design and Technology:

More information

A Glimpse of Constraint Satisfaction

A Glimpse of Constraint Satisfaction Journal Artificial Intelligence Review, Kluwer Academic Publishers, Vol., 999, pages - A Glimpse of Constraint Satisfaction EDWARD TSANG Department of Computer Science, University of Essex, Colchester,

More information

Year 7 Entrance Exams. Maths. Specimen Paper 3

Year 7 Entrance Exams. Maths. Specimen Paper 3 Year 7 Entrance Exams Maths Specimen Paper 3 Instructions to candidates Time allowed: 45 minutes Instructions to candidates: 1. Show all working - you may receive marks for correct working even if your

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

MITOCW watch?v=-qcpo_dwjk4

MITOCW watch?v=-qcpo_dwjk4 MITOCW watch?v=-qcpo_dwjk4 The following content is provided under a Creative Commons license. Your support will help MIT OpenCourseWare continue to offer high quality educational resources for free. To

More information

Lecture 13 Register Allocation: Coalescing

Lecture 13 Register Allocation: Coalescing Lecture 13 Register llocation: Coalescing I. Motivation II. Coalescing Overview III. lgorithms: Simple & Safe lgorithm riggs lgorithm George s lgorithm Phillip. Gibbons 15-745: Register Coalescing 1 Review:

More information

SUDOKU X. Samples Document. by Andrew Stuart. Moderate

SUDOKU X. Samples Document. by Andrew Stuart. Moderate SUDOKU X Moderate Samples Document by Andrew Stuart About Sudoku X This is a variant of the popular Sudoku puzzle which contains two extra constraints on the solution, namely the diagonals, typically indicated

More information

Theory of Probability - Brett Bernstein

Theory of Probability - Brett Bernstein Theory of Probability - Brett Bernstein Lecture 3 Finishing Basic Probability Review Exercises 1. Model flipping two fair coins using a sample space and a probability measure. Compute the probability of

More information

Applications of Advanced Mathematics (C4) Paper B: Comprehension WEDNESDAY 21 MAY 2008 Time:Upto1hour

Applications of Advanced Mathematics (C4) Paper B: Comprehension WEDNESDAY 21 MAY 2008 Time:Upto1hour ADVANCED GCE 4754/01B MATHEMATICS (MEI) Applications of Advanced Mathematics (C4) Paper B: Comprehension WEDNESDAY 21 MAY 2008 Afternoon Time:Upto1hour Additional materials: Rough paper MEI Examination

More information

Solving Who Am I? Puzzles. Building Who Am I? Puzzles. t u Who Am I? The product of my digits is 16. The sum of my digits is 8. Who Am I?

Solving Who Am I? Puzzles. Building Who Am I? Puzzles. t u Who Am I? The product of my digits is 16. The sum of my digits is 8. Who Am I? Solving Puzzles The product of my digits is 7. The sum of my digits is 8. My units digit is greater than my tens digit. I am even. My tens digit is. h t u The product of my three digits is 2. h is four

More information

DOWNLOAD OR READ : THE TIMES CRYPTIC CROSSWORD BOOK WORLD FAMOUS CROSSWORD PUZZLES PDF EBOOK EPUB MOBI

DOWNLOAD OR READ : THE TIMES CRYPTIC CROSSWORD BOOK WORLD FAMOUS CROSSWORD PUZZLES PDF EBOOK EPUB MOBI DOWNLOAD OR READ : THE TIMES CRYPTIC CROSSWORD BOOK 22 100 WORLD FAMOUS CROSSWORD PUZZLES PDF EBOOK EPUB MOBI Page 1 Page 2 the times cryptic crossword book 22 100 world famous crossword puzzles the times

More information