ISudoku. Jonathon Makepeace Matthew Harris Jamie Sparrow Julian Hillebrand

Size: px
Start display at page:

Download "ISudoku. Jonathon Makepeace Matthew Harris Jamie Sparrow Julian Hillebrand"

Transcription

1 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 analyzing each algorithm, we will determine the efficiency of each and determine which is the best implementation. In this paper, we will state our methods to test each algorithm and list our constraints that will lead to our conclusion. 1. Introduction Sudoku is a puzzle game often found in newspapers or magazines. The object of the game is to place numbers in a grid such that certain conditions are met. On paper, many people can solve a Sudoku puzzle given enough time and it wouldn t be too difficult. However, some puzzles can be too difficult for any human to solve. In this paper, we will analyze four algorithms for computing solutions to Sudoku puzzles. 2. Informal Statement of Problem Traditionally, the object of Sudoku is, given a minimum of 17 clue numbers already placed in the cells of a 9 9 grid subdivided into 3 3 regions, place the integers 1-9 in each empty cell such that no row, column, nor region of cells contain a duplicate digit. This definition is not strict, however; other symbols may be used in place of integers, the number of unique symbols may vary, and a puzzle does not need to be 9 9 size. However, for our implementation purposes, we focused on the traditional 9 9 puzzle grid. 3. Formal Statement of Problem The problem definition of solving a Sudoku puzzle can be expressed formally as a constraint satisfaction problem with three constraints. The first constraint requires that all numbers 1 through n be placed in a row with n cells; the second and third constraints require the same for the puzzle s columns

2 and regions, respectively. Given an n n Sudoku grid, the Sudoku is successfully solved if: x N and i N, with x n and i n: j N (with j n) such that numberat(i, j) = x. ( For any given number x [between 1 and n] and row number i [between 1 and n], there is a column number j [between 1 and n] such that x can be found in row i, column j. ) x N and j N, with x n and j n: i N (with i n) such that numberat(i, j) = x. ( For any given number x and column number j, there is a row number i...) x N and r N, with x n and r n: i N (with i n) and j N (with j n) such that regionof(i,j) = r AND numberat(i,j) = x. 4. Backtracking A common naive algorithm for solving a Sudoku puzzle is brute-force backtracking. For an n n puzzle board, backtracking generates all possible configurations of n symbols (most commonly, represented by the integers in the range [1, n ]) to fill each empty cell. Each of these configurations is tested until a solution to the puzzle is found. The idea of backtracking is to exhaust all possibilities in a large amount of candidates and pick the first answer that is valid. Using recursion, the algorithm generates a depth-first tree of possibilities that grows exponentially with each blank cell to be filled. Our recursive implementation of backtracking in Python is shown in Figure 4.1. def backtrackingsolve( self ): c = None for cell in self.cells: # Iterate over each cell in the puzzle if cell.num is None : c = cell # Work with the first blank cell found. break if c is None : # If no empty cell is found, the puzzle is solved return True for candidate in range ( 1, 10 ): if c.isvalidcandidate(candidate): c.num = candidate if self.backtrackingsolve(): # Recursively branch down possibilities for cell c return True c.num = None return False Figure 4.1 By default, backtracking is not an efficient algorithm due to its naive implementation. At each empty cell on an n

3 n board, backtracking takes at worst O( n ) attempts to find a valid symbol for that cell that does not violate any of the three constraints (iterates through every symbol). In the best case, the first symbol tested in any empty cell (in our case, the integer 1) happens to be a valid candidate (does not violate any of the three constraints), and the cell is filled in O(1) constant time. After a valid candidate for the empty cell is found, it is placed in the cell. The algorithm branches down the decision tree at that cell and recursively attempts to find a valid symbol for the next empty cell, backtracking to the previous cell if one is not found. Therefore, in the worst case, each subsequent empty cell must work through n possibilities for each of the n possibilities of the previous cell (a total of n 2 possibilities for two empty cells). The complexity thus increases exponentially for every empty cell in the puzzle. The average complexity of the backtracking algorithm is then O( n m ), where m is the initial number of empty cells (or n 2 - (# of clue numbers)). Figure 4.2 Figure 4.2 shows the increase in average run times for the backtracking algorithm when it is given 10 puzzles of each of 3 difficulties. The easy, medium, and hard puzzles tested initially contain 40, 33, and 26 clue numbers, respectively. 5. Dancing Links Dancing Links is not the easiest method one could implement to solve a sudoku puzzle. However, the ingenious strategy, developed by Donald Knuth, applies perfectly to this type of problem. He developed this technique to implement his Algorithm X, which is used to solve Exact Cover problems.. An Exact Cover problem requires one solution to satisfy all given constraints exactly once, like our Sudoku puzzle. When applying Algorithm X, this requires a double linked list of all

4 possibilities and an efficient use of backtracking. When creating the double linked list, it is set up as a sparse matrix, which creates a node for each non-zero entry and links it to its neighbors of the same row and column. Then, when running the algorithm, we begin by covering a node and then covering all other nodes in its set, or web of linked nodes. If there are nodes that can t be covered by the set, it is not the solution, and our algorithm backtracks by uncovering the nodes in the reverse order of how they were covered. If there are no remaining nodes however, then our set must be a solution. Figure 4.3 Dancing Links has a complexity of O( n 3 ) or O(n*n*n) as it is essentially sorting through a grid or list (n) of double linked lists (n*n). As the puzzle difficulty increased, the overall complexity of the algorithm did not. Of course, the specific set that would be the solution became more difficult to discover, which led to an increase in run time. 6. Crook s Algorithm One of the most simple and easy to understand algorithms to use when solving the Sudoku puzzle was developed by J.F. Crook. Crook s algorithm was designed to be a pen and paper method to solve the puzzle and can be accomplished by anyone given enough time. It s very important to look at the definition when solving a Sudoku puzzle, as it will provide insight on how to find the answer. The solution of a Sudoku puzzle requires that every row, column, and box contain all the numbers in the set [ 1, 2,..., 9 ] and that every cell be occupied by one and only one number( Crook Source). Meaning that only one copy of each digit can be in every set, whether it be vertical or horizontal. Using Crook s algorithm, we must keep a preemptive set of possible values that could be be inside the cell. For each cell, a mark-up is created to determine the possible values, on pen and paper it is used for visual

5 reference to keep track of the values in the game. After determining the markup, the user must pick a cell to start with to begin the process. The next step can requires the user to pick a number out of the markup values. Doing this will repeat the previous mentioned step, where you go through each cell on the row and column and take out the entered value from the possible markup values. Repeat the process till all the solutions have been determined and qualify for a solution based on the Sudoku puzzle definition. These steps can further be simplified to the following steps: 1. Mark up the cells ie. list of numbers that the cell may contain. 2. Look at each column, row and 3x3 box and break down into preemptive sets. Break down the sets and use 1 Occupancy Theorem whenever possible. 3. Determine if puzzle is: Finished, not possible or next step. 4. Choose an empty cell and mark a number and color. Repeat step 2 1 Let X be a pre-emptive set in a Sudoku puzzle markup. Then every number in X that appears in the markup of cells not in X over the range of X cannot be a part of the puzzle solution. until no more preemptive sets remain. 5. Go through the markup until you solve or determine as not possible. Figure 4.4 Crook s algorithm is basically a trial and error type of algorithm. After initializing the markup, it goes through each possibility until it finds a solution. It can be considered an exhausted search, but it has different elements associated with it. We determined that the big O of this algorithm is N^2 for the average case, because the algorithm must sort through two different sets to reach the markup in each cell. The complexity increases at a rate that is near that of backtracking. There is some slight deviations in the data, where it takes more time to solve easy puzzles compared to the other algorithms. This could be caused by the design of the algorithm, being that it

6 has to go through the possibilities until it finds the first solution. As mentioned previously in the backtracking section, as the difficulty increased, so did the amount of time exponentially increase. The main cause of this is from the increase of blank spaces present as the difficult goes up. There were also factors that affect the amount of possible answers in the final solution to a puzzle. Some instances of the puzzle only had a single solution, where these types of puzzles are called diabolical. Each number has to be in a specific spot in the puzzle for the solution to be found. Crook s algorithm would take an exceedingly long amount of time compared to other puzzles (as seen in Figure 4.4), because of the amount of sets each iteration would have to go through and validate for correctness. Genetic Algorithm A genetic algorithm is a general way to solve optimization problems. The basic algorithm is very simple: 1. Create a population (vector) of random solutions (represented in a problem specific way, but often a vector of floats or ints) 2. Pick a few solutions and sort them according to fitness 3. Replace the worst solution with a new solution, which is either a copy of the best solution, a mutation (perturbation) of the best solution, an entirely new randomized solution or a cross between the two best solutions. These are the most common evolutionary operators, but you could dream up others that use information from existing solutions to create new potentially good solutions. 4. Check if you have a new global best fitness, if so, store the solution. 5. If too many iterations go by without improvement, the entire population might be stuck in a local minimum (at the bottom of a local valley, with a possible chasm somewhere else, so to speak). If so, kill everyone and start over at Go to 2. Fitness is a measure of how good a solution is, lower meaning better. This measure is performed by a fitness function that you supply. Writing a fitness function is how you describe the problem to the GA.

7 The magnitude of the fitness values returned does not matter (in sane implementations), only how they compare to each other. There are other, subtly different, ways to perform the evolutionary process. Some are good and some are popular but bad. The one described above is called tournament selection and it is one of the good ways. Much can be said about the intricacies of GA but it will have to be said somewhere else, lest I digress completely. And within a few minutes (about 2.6 million iterations when I tried), the correct answer pops out! The nice thing about this method is that you do not have to know anything about how to solve a Sudoku puzzle or even think very hard at all. Note that I did not even bother to just let it search for the unknown values - it also has to find the digits that we already know (which should not be too hard with a decent fitness function, see below). The only bit of thinking we did was to understand that a Sudoku solution has to be a permutation of [1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 2, 3, 4, 5, 6, 7, 8, 9], but this merely made the evolution part faster. If we wanted to make it faster still, we could make a genome type that let us say that there are actually nine separate vectors who are each guaranteed to be a permutation of 1 to 9. We could have thought even less and represented the solution by 81 ints who are all in the range 1 to 9, by using another genome type: >> genome = stdgenomes.enumgenome(81, range(1,10)) The range argument to EnumGenome does not have to be a vector of integers, it could be a vector of any objects, since they are never treated like numbers. In my experiment this took maybe minutes to solve. For more difficult Sudoku puzzles, I would definitely go with the permutation genome, since using EnumGenome increases the search space to 9^81 possible solutions. 7. Conclusion Our initial estimates concluded that Dancing Links would be the most efficient

8 method out of the ones listed. But with the complexity found to be larger than that of the other algorithms, we grew unsure. Looking at the data, it actually seems to be the slowest of the algorithms. Backtracking and Crooks algorithms, per the data, are quite similar. Though their algorithms require a thorough check of all empty cells and possibilities, Dancing Links starts with all possibilities linked together in a large matrix, and runs through sets cutting down those possibilities. cking-6613d33229af [Accessed 7 Dec. 2018]. 8. References Crook, J. (2009). A Pencil-and-Paper Algorithm for Solving Sudoku Puzzles. [PDF file] Retrieved from p.pdf Knuth, D. (2000). Dancing Links. [PDF file] Retrieved from Zibbu, Shirsh. (2018). Sudoku and Backtracking - Hacker Noon. [online] Available at:

isudoku Computing Solutions to Sudoku Puzzles w/ 3 Algorithms by: Gavin Hillebrand Jamie Sparrow Jonathon Makepeace Matthew Harris

isudoku Computing Solutions to Sudoku Puzzles w/ 3 Algorithms by: Gavin Hillebrand Jamie Sparrow Jonathon Makepeace Matthew Harris isudoku Computing Solutions to Sudoku Puzzles w/ 3 Algorithms by: Gavin Hillebrand Jamie Sparrow Jonathon Makepeace Matthew Harris What is Sudoku? A logic-based puzzle game Heavily based in combinatorics

More information

of Nebraska - Lincoln

of Nebraska - Lincoln University of Nebraska - Lincoln DigitalCommons@University of Nebraska - Lincoln MAT Exam Expository Papers Math in the Middle Institute Partnership 7-2009 Sudoku Marlene Grayer University of Nebraska-Lincoln

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

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

8. You Won t Want To Play Sudoku Again

8. You Won t Want To Play Sudoku Again 8. You Won t Want To Play Sudoku Again Thanks to modern computers, brawn beats brain. Programming constructs and algorithmic paradigms covered in this puzzle: Global variables. Sets and set operations.

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

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

Solving Sudoku Using Artificial Intelligence

Solving Sudoku Using Artificial Intelligence Solving Sudoku Using Artificial Intelligence Eric Pass BitBucket: https://bitbucket.org/ecp89/aipracticumproject Demo: https://youtu.be/-7mv2_ulsas Background Overview Sudoku problems are some of the most

More information

Python for education: the exact cover problem

Python for education: the exact cover problem Python for education: the exact cover problem arxiv:1010.5890v1 [cs.ds] 28 Oct 2010 A. Kapanowski Marian Smoluchowski Institute of Physics, Jagellonian University, ulica Reymonta 4, 30-059 Kraków, Poland

More information

The Mathematics Behind Sudoku Laura Olliverrie Based off research by Bertram Felgenhauer, Ed Russel and Frazer Jarvis. Abstract

The Mathematics Behind Sudoku Laura Olliverrie Based off research by Bertram Felgenhauer, Ed Russel and Frazer Jarvis. Abstract The Mathematics Behind Sudoku Laura Olliverrie Based off research by Bertram Felgenhauer, Ed Russel and Frazer Jarvis Abstract I will explore the research done by Bertram Felgenhauer, Ed Russel and Frazer

More information

A Retrievable Genetic Algorithm for Efficient Solving of Sudoku Puzzles Seyed Mehran Kazemi, Bahare Fatemi

A Retrievable Genetic Algorithm for Efficient Solving of Sudoku Puzzles Seyed Mehran Kazemi, Bahare Fatemi A Retrievable Genetic Algorithm for Efficient Solving of Sudoku Puzzles Seyed Mehran Kazemi, Bahare Fatemi Abstract Sudoku is a logic-based combinatorial puzzle game which is popular among people of different

More information

Investigation of Algorithmic Solutions of Sudoku Puzzles

Investigation of Algorithmic Solutions of Sudoku Puzzles Investigation of Algorithmic Solutions of Sudoku Puzzles Investigation of Algorithmic Solutions of Sudoku Puzzles The game of Sudoku as we know it was first developed in the 1979 by a freelance puzzle

More information

Cracking the Sudoku: A Deterministic Approach

Cracking the Sudoku: A Deterministic Approach Cracking the Sudoku: A Deterministic Approach David Martin Erica Cross Matt Alexander Youngstown State University Youngstown, OH Advisor: George T. Yates Summary Cracking the Sodoku 381 We formulate a

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

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

Comparing Methods for Solving Kuromasu Puzzles

Comparing Methods for Solving Kuromasu Puzzles Comparing Methods for Solving Kuromasu Puzzles Leiden Institute of Advanced Computer Science Bachelor Project Report Tim van Meurs Abstract The goal of this bachelor thesis is to examine different methods

More information

The most difficult Sudoku puzzles are quickly solved by a straightforward depth-first search algorithm

The most difficult Sudoku puzzles are quickly solved by a straightforward depth-first search algorithm The most difficult Sudoku puzzles are quickly solved by a straightforward depth-first search algorithm Armando B. Matos armandobcm@yahoo.com LIACC Artificial Intelligence and Computer Science Laboratory

More information

Rating and Generating Sudoku Puzzles Based On Constraint Satisfaction Problems

Rating and Generating Sudoku Puzzles Based On Constraint Satisfaction Problems Rating and Generating Sudoku Puzzles Based On Constraint Satisfaction Problems Bahare Fatemi, Seyed Mehran Kazemi, Nazanin Mehrasa International Science Index, Computer and Information Engineering waset.org/publication/9999524

More information

The puzzle Sudoku has become the passion

The puzzle Sudoku has become the passion A Pencil-and-Paper Algorithm for Solving Sudoku Puzzles J. F. Crook The puzzle Sudoku has become the passion of many people the world over in the past few years. The interesting fact about Sudoku is that

More information

Techniques for Generating Sudoku Instances

Techniques for Generating Sudoku Instances Chapter Techniques for Generating Sudoku Instances Overview Sudoku puzzles become worldwide popular among many players in different intellectual levels. In this chapter, we are going to discuss different

More information

An Exploration of the Minimum Clue Sudoku Problem

An Exploration of the Minimum Clue Sudoku Problem Sacred Heart University DigitalCommons@SHU Academic Festival Apr 21st, 12:30 PM - 1:45 PM An Exploration of the Minimum Clue Sudoku Problem Lauren Puskar Follow this and additional works at: http://digitalcommons.sacredheart.edu/acadfest

More information

Lecture 20: Combinatorial Search (1997) Steven Skiena. skiena

Lecture 20: Combinatorial Search (1997) Steven Skiena.   skiena Lecture 20: Combinatorial Search (1997) Steven Skiena Department of Computer Science State University of New York Stony Brook, NY 11794 4400 http://www.cs.sunysb.edu/ skiena Give an O(n lg k)-time algorithm

More information

The remarkably popular puzzle demonstrates man versus machine, backtraking and recursion, and the mathematics of symmetry.

The remarkably popular puzzle demonstrates man versus machine, backtraking and recursion, and the mathematics of symmetry. Chapter Sudoku The remarkably popular puzzle demonstrates man versus machine, backtraking and recursion, and the mathematics of symmetry. Figure.. A Sudoku puzzle with especially pleasing symmetry. The

More information

Automatically Generating Puzzle Problems with Varying Complexity

Automatically Generating Puzzle Problems with Varying Complexity Automatically Generating Puzzle Problems with Varying Complexity Amy Chou and Justin Kaashoek Mentor: Rishabh Singh Fourth Annual PRIMES MIT Conference May 19th, 2014 The Motivation We want to help people

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

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

Topic 10 Recursive Backtracking

Topic 10 Recursive Backtracking Topic 10 ki "In ancient times, before computers were invented, alchemists studied the mystical properties of numbers. Lacking computers, they had to rely on dragons to do their work for them. The dragons

More information

UNIVERSITY of PENNSYLVANIA CIS 391/521: Fundamentals of AI Midterm 1, Spring 2010

UNIVERSITY of PENNSYLVANIA CIS 391/521: Fundamentals of AI Midterm 1, Spring 2010 UNIVERSITY of PENNSYLVANIA CIS 391/521: Fundamentals of AI Midterm 1, Spring 2010 Question Points 1 Environments /2 2 Python /18 3 Local and Heuristic Search /35 4 Adversarial Search /20 5 Constraint Satisfaction

More information

BMT 2018 Combinatorics Test Solutions March 18, 2018

BMT 2018 Combinatorics Test Solutions March 18, 2018 . Bob has 3 different fountain pens and different ink colors. How many ways can he fill his fountain pens with ink if he can only put one ink in each pen? Answer: 0 Solution: He has options to fill his

More information

KenKen Strategies. Solution: To answer this, build the 6 6 table of values of the form ab 2 with a {1, 2, 3, 4, 5, 6}

KenKen Strategies. Solution: To answer this, build the 6 6 table of values of the form ab 2 with a {1, 2, 3, 4, 5, 6} KenKen is a puzzle whose solution requires a combination of logic and simple arithmetic and combinatorial skills. The puzzles range in difficulty from very simple to incredibly difficult. Students who

More information

N-Queens Problem. Latin Squares Duncan Prince, Tamara Gomez February

N-Queens Problem. Latin Squares Duncan Prince, Tamara Gomez February N-ueens Problem Latin Squares Duncan Prince, Tamara Gomez February 19 2015 Author: Duncan Prince The N-ueens Problem The N-ueens problem originates from a question relating to chess, The 8-ueens problem

More information

Yet Another Organized Move towards Solving Sudoku Puzzle

Yet Another Organized Move towards Solving Sudoku Puzzle !" ##"$%%# &'''( ISSN No. 0976-5697 Yet Another Organized Move towards Solving Sudoku Puzzle Arnab K. Maji* Department Of Information Technology North Eastern Hill University Shillong 793 022, Meghalaya,

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

KenKen Strategies 17+

KenKen Strategies 17+ KenKen is a puzzle whose solution requires a combination of logic and simple arithmetic and combinatorial skills. The puzzles range in difficulty from very simple to incredibly difficult. Students who

More information

Solving and Analyzing Sudokus with Cultural Algorithms 5/30/2008. Timo Mantere & Janne Koljonen

Solving and Analyzing Sudokus with Cultural Algorithms 5/30/2008. Timo Mantere & Janne Koljonen with Cultural Algorithms Timo Mantere & Janne Koljonen University of Vaasa Department of Electrical Engineering and Automation P.O. Box, FIN- Vaasa, Finland timan@uwasa.fi & jako@uwasa.fi www.uwasa.fi/~timan/sudoku

More information

Informatica Universiteit van Amsterdam. Performance optimization of Rush Hour board generation. Jelle van Dijk. June 8, Bachelor Informatica

Informatica Universiteit van Amsterdam. Performance optimization of Rush Hour board generation. Jelle van Dijk. June 8, Bachelor Informatica Bachelor Informatica Informatica Universiteit van Amsterdam Performance optimization of Rush Hour board generation. Jelle van Dijk June 8, 2018 Supervisor(s): dr. ir. A.L. (Ana) Varbanescu Signed: Signees

More information

CS 188 Fall Introduction to Artificial Intelligence Midterm 1

CS 188 Fall Introduction to Artificial Intelligence Midterm 1 CS 188 Fall 2018 Introduction to Artificial Intelligence Midterm 1 You have 120 minutes. The time will be projected at the front of the room. You may not leave during the last 10 minutes of the exam. Do

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

Take Control of Sudoku

Take Control of Sudoku Take Control of Sudoku Simon Sunatori, P.Eng./ing., M.Eng. (Engineering Physics), F.N.A., SM IEEE, LM WFS MagneScribe : A 3-in-1 Auto-Retractable Pen

More information

Solving Sudoku with Genetic Operations that Preserve Building Blocks

Solving Sudoku with Genetic Operations that Preserve Building Blocks Solving Sudoku with Genetic Operations that Preserve Building Blocks Yuji Sato, Member, IEEE, and Hazuki Inoue Abstract Genetic operations that consider effective building blocks are proposed for using

More information

A comparison of a genetic algorithm and a depth first search algorithm applied to Japanese nonograms

A comparison of a genetic algorithm and a depth first search algorithm applied to Japanese nonograms A comparison of a genetic algorithm and a depth first search algorithm applied to Japanese nonograms Wouter Wiggers Faculty of EECMS, University of Twente w.a.wiggers@student.utwente.nl ABSTRACT In this

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

Design and Analysis of Algorithms Prof. Madhavan Mukund Chennai Mathematical Institute. Module 6 Lecture - 37 Divide and Conquer: Counting Inversions

Design and Analysis of Algorithms Prof. Madhavan Mukund Chennai Mathematical Institute. Module 6 Lecture - 37 Divide and Conquer: Counting Inversions Design and Analysis of Algorithms Prof. Madhavan Mukund Chennai Mathematical Institute Module 6 Lecture - 37 Divide and Conquer: Counting Inversions Let us go back and look at Divide and Conquer again.

More information

Game Theory and Randomized Algorithms

Game Theory and Randomized Algorithms Game Theory and Randomized Algorithms Guy Aridor Game theory is a set of tools that allow us to understand how decisionmakers interact with each other. It has practical applications in economics, international

More information

Past questions from the last 6 years of exams for programming 101 with answers.

Past questions from the last 6 years of exams for programming 101 with answers. 1 Past questions from the last 6 years of exams for programming 101 with answers. 1. Describe bubble sort algorithm. How does it detect when the sequence is sorted and no further work is required? Bubble

More information

Nested Monte-Carlo Search

Nested Monte-Carlo Search Nested Monte-Carlo Search Tristan Cazenave LAMSADE Université Paris-Dauphine Paris, France cazenave@lamsade.dauphine.fr Abstract Many problems have a huge state space and no good heuristic to order moves

More information

Problem 4.R1: Best Range

Problem 4.R1: Best Range CSC 45 Problem Set 4 Due Tuesday, February 7 Problem 4.R1: Best Range Required Problem Points: 50 points Background Consider a list of integers (positive and negative), and you are asked to find the part

More information

Python for Education: The Exact Cover Problem

Python for Education: The Exact Cover Problem Python for Education: The Exact Cover Problem Andrzej Kapanowski Marian Smoluchowski Institute of Physics, Jagiellonian University, Cracow, Poland andrzej.kapanowski@uj.edu.pl Abstract Python implementation

More information

10/5/2015. Constraint Satisfaction Problems. Example: Cryptarithmetic. Example: Map-coloring. Example: Map-coloring. Constraint Satisfaction Problems

10/5/2015. Constraint Satisfaction Problems. Example: Cryptarithmetic. Example: Map-coloring. Example: Map-coloring. Constraint Satisfaction Problems 0/5/05 Constraint Satisfaction Problems Constraint Satisfaction Problems AIMA: Chapter 6 A CSP consists of: Finite set of X, X,, X n Nonempty domain of possible values for each variable D, D, D n where

More information

You ve seen them played in coffee shops, on planes, and

You ve seen them played in coffee shops, on planes, and Every Sudoku variation you can think of comes with its own set of interesting open questions There is math to be had here. So get working! Taking Sudoku Seriously Laura Taalman James Madison University

More information

CPSC 217 Assignment 3

CPSC 217 Assignment 3 CPSC 217 Assignment 3 Due: Friday November 24, 2017 at 11:55pm Weight: 7% Sample Solution Length: Less than 100 lines, including blank lines and some comments (not including the provided code) Individual

More information

An improved strategy for solving Sudoku by sparse optimization methods

An improved strategy for solving Sudoku by sparse optimization methods An improved strategy for solving Sudoku by sparse optimization methods Yuchao Tang, Zhenggang Wu 2, Chuanxi Zhu. Department of Mathematics, Nanchang University, Nanchang 33003, P.R. China 2. School of

More information

Pattern Avoidance in Unimodal and V-unimodal Permutations

Pattern Avoidance in Unimodal and V-unimodal Permutations Pattern Avoidance in Unimodal and V-unimodal Permutations Dido Salazar-Torres May 16, 2009 Abstract A characterization of unimodal, [321]-avoiding permutations and an enumeration shall be given.there is

More information

Comp th February Due: 11:59pm, 25th February 2014

Comp th February Due: 11:59pm, 25th February 2014 HomeWork Assignment 2 Comp 590.133 4th February 2014 Due: 11:59pm, 25th February 2014 Getting Started What to submit: Written parts of assignment and descriptions of the programming part of the assignment

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

Universiteit Leiden Opleiding Informatica

Universiteit Leiden Opleiding Informatica Universiteit Leiden Opleiding Informatica Predicting the Outcome of the Game Othello Name: Simone Cammel Date: August 31, 2015 1st supervisor: 2nd supervisor: Walter Kosters Jeannette de Graaf BACHELOR

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

In order for metogivebackyour midterms, please form. a line and sort yourselves in alphabetical order, from A

In order for metogivebackyour midterms, please form. a line and sort yourselves in alphabetical order, from A Parallel Bulesort In order for metogiveackyour midterms, please form a line and sort yourselves in alphaetical order, from A to Z. Cominatorial Search We have seen how clever algorithms can reduce sorting

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

Sudoku Solvers. A Different Approach. DD143X Degree Project in Computer Science, First Level CSC KTH. Supervisor: Michael Minock

Sudoku Solvers. A Different Approach. DD143X Degree Project in Computer Science, First Level CSC KTH. Supervisor: Michael Minock Sudoku Solvers A Different Approach DD143X Degree Project in Computer Science, First Level CSC KTH Supervisor: Michael Minock Christoffer Nilsson Professorsslingan 10 114 17 Stockholm Tel: 073-097 87 24

More information

Taking Sudoku Seriously

Taking Sudoku Seriously Taking Sudoku Seriously Laura Taalman, James Madison University You ve seen them played in coffee shops, on planes, and maybe even in the back of the room during class. These days it seems that everyone

More information

2048: An Autonomous Solver

2048: An Autonomous Solver 2048: An Autonomous Solver Final Project in Introduction to Artificial Intelligence ABSTRACT. Our goal in this project was to create an automatic solver for the wellknown game 2048 and to analyze how different

More information

Comparing BFS, Genetic Algorithms, and the Arc-Constancy 3 Algorithm to solve N Queens and Cross Math

Comparing BFS, Genetic Algorithms, and the Arc-Constancy 3 Algorithm to solve N Queens and Cross Math Comparing BFS, Genetic Algorithms, and the Arc-Constancy 3 Algorithm to solve N Queens and Cross Math Peter Irvine College of Science And Engineering University of Minnesota Minneapolis, Minnesota 55455

More information

Games and Adversarial Search II

Games and Adversarial Search II Games and Adversarial Search II Alpha-Beta Pruning (AIMA 5.3) Some slides adapted from Richard Lathrop, USC/ISI, CS 271 Review: The Minimax Rule Idea: Make the best move for MAX assuming that MIN always

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

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

Chapter 4 Heuristics & Local Search

Chapter 4 Heuristics & Local Search CSE 473 Chapter 4 Heuristics & Local Search CSE AI Faculty Recall: Admissable Heuristics f(x) = g(x) + h(x) g: cost so far h: underestimate of remaining costs e.g., h SLD Where do heuristics come from?

More information

A Novel Multistage Genetic Algorithm Approach for Solving Sudoku Puzzle

A Novel Multistage Genetic Algorithm Approach for Solving Sudoku Puzzle A Novel Multistage Genetic Algorithm Approach for Solving Sudoku Puzzle Haradhan chel, Deepak Mylavarapu 2 and Deepak Sharma 2 Central Institute of Technology Kokrajhar,Kokrajhar, BTAD, Assam, India, PIN-783370

More information

CPSC 217 Assignment 3 Due Date: Friday March 30, 2018 at 11:59pm

CPSC 217 Assignment 3 Due Date: Friday March 30, 2018 at 11:59pm CPSC 217 Assignment 3 Due Date: Friday March 30, 2018 at 11:59pm Weight: 8% Individual Work: All assignments in this course are to be completed individually. Students are advised to read the guidelines

More information

Tic-Tac-Toe and machine learning. David Holmstedt Davho G43

Tic-Tac-Toe and machine learning. David Holmstedt Davho G43 Tic-Tac-Toe and machine learning David Holmstedt Davho304 729G43 Table of Contents Introduction... 1 What is tic-tac-toe... 1 Tic-tac-toe Strategies... 1 Search-Algorithms... 1 Machine learning... 2 Weights...

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

A Group-theoretic Approach to Human Solving Strategies in Sudoku

A Group-theoretic Approach to Human Solving Strategies in Sudoku Colonial Academic Alliance Undergraduate Research Journal Volume 3 Article 3 11-5-2012 A Group-theoretic Approach to Human Solving Strategies in Sudoku Harrison Chapman University of Georgia, hchaps@gmail.com

More information

CMPT 310 Assignment 1

CMPT 310 Assignment 1 CMPT 310 Assignment 1 October 16, 2017 100 points total, worth 10% of the course grade. Turn in on CourSys. Submit a compressed directory (.zip or.tar.gz) with your solutions. Code should be submitted

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

Algorithm Performance For Chessboard Separation Problems

Algorithm Performance For Chessboard Separation Problems Algorithm Performance For Chessboard Separation Problems R. Douglas Chatham Maureen Doyle John J. Miller Amber M. Rogers R. Duane Skaggs Jeffrey A. Ward April 23, 2008 Abstract Chessboard separation problems

More information

arxiv: v2 [math.ho] 23 Aug 2018

arxiv: v2 [math.ho] 23 Aug 2018 Mathematics of a Sudo-Kurve arxiv:1808.06713v2 [math.ho] 23 Aug 2018 Tanya Khovanova Abstract Wayne Zhao We investigate a type of a Sudoku variant called Sudo-Kurve, which allows bent rows and columns,

More information

Recent Progress in the Design and Analysis of Admissible Heuristic Functions

Recent Progress in the Design and Analysis of Admissible Heuristic Functions From: AAAI-00 Proceedings. Copyright 2000, AAAI (www.aaai.org). All rights reserved. Recent Progress in the Design and Analysis of Admissible Heuristic Functions Richard E. Korf Computer Science Department

More information

Three of these grids share a property that the other three do not. Can you find such a property? + mod

Three of these grids share a property that the other three do not. Can you find such a property? + mod PPMTC 22 Session 6: Mad Vet Puzzles Session 6: Mad Veterinarian Puzzles There is a collection of problems that have come to be known as "Mad Veterinarian Puzzles", for reasons which will soon become obvious.

More information

MA/CSSE 473 Day 14. Permutations wrap-up. Subset generation. (Horner s method) Permutations wrap up Generating subsets of a set

MA/CSSE 473 Day 14. Permutations wrap-up. Subset generation. (Horner s method) Permutations wrap up Generating subsets of a set MA/CSSE 473 Day 14 Permutations wrap-up Subset generation (Horner s method) MA/CSSE 473 Day 14 Student questions Monday will begin with "ask questions about exam material time. Exam details are Day 16

More information

It Stands to Reason: Developing Inductive and Deductive Habits of Mind

It Stands to Reason: Developing Inductive and Deductive Habits of Mind It Stands to Reason: Developing Inductive and Deductive Habits of Mind Jeffrey Wanko Miami University wankojj@miamioh.edu Presented at a Meeting of the Greater Cleveland Council of Teachers of Mathematics

More information

Latin squares and related combinatorial designs. Leonard Soicher Queen Mary, University of London July 2013

Latin squares and related combinatorial designs. Leonard Soicher Queen Mary, University of London July 2013 Latin squares and related combinatorial designs Leonard Soicher Queen Mary, University of London July 2013 Many of you are familiar with Sudoku puzzles. Here is Sudoku #043 (Medium) from Livewire Puzzles

More information

Taking the Mystery Out of Sudoku Difficulty: An Oracular Model

Taking the Mystery Out of Sudoku Difficulty: An Oracular Model Taking the Mystery Out 327 Taking the Mystery Out of Sudoku Difficulty: An Oracular Model Sarah Fletcher Frederick Johnson David R. Morrison Harvey Mudd College Claremont, CA Advisor: Jon Jacobsen Summary

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

ProCo 2017 Advanced Division Round 1

ProCo 2017 Advanced Division Round 1 ProCo 2017 Advanced Division Round 1 Problem A. Traveling file: 256 megabytes Moana wants to travel from Motunui to Lalotai. To do this she has to cross a narrow channel filled with rocks. The channel

More information

CS/COE 1501

CS/COE 1501 CS/COE 1501 www.cs.pitt.edu/~lipschultz/cs1501/ Brute-force Search Brute-force (or exhaustive) search Find the solution to a problem by considering all potential solutions and selecting the correct one

More information

LMI Monthly Test May 2010 Instruction Booklet

LMI Monthly Test May 2010 Instruction Booklet Submit at http://www.logicmastersindia.com/m201005 LMI Monthly Test May 2010 Instruction Booklet Forum http://logicmastersindia.com/forum/forums/thread-view.asp?tid=53 Start Time 22-May-2010 20:00 IST

More information

5CHAMPIONSHIP. Individual Round Puzzle Examples SUDOKU. th WORLD. from PHILADELPHIA. Lead Sponsor

5CHAMPIONSHIP. Individual Round Puzzle Examples SUDOKU. th WORLD. from  PHILADELPHIA. Lead Sponsor th WORLD SUDOKU CHAMPIONSHIP PHILADELPHIA A P R M A Y 0 0 0 Individual Round Puzzle Examples from http://www.worldpuzzle.org/wiki/ Lead Sponsor Classic Sudoku Place the digits through into the empty cells

More information

Twenty-fourth Annual UNC Math Contest Final Round Solutions Jan 2016 [(3!)!] 4

Twenty-fourth Annual UNC Math Contest Final Round Solutions Jan 2016 [(3!)!] 4 Twenty-fourth Annual UNC Math Contest Final Round Solutions Jan 206 Rules: Three hours; no electronic devices. The positive integers are, 2, 3, 4,.... Pythagorean Triplet The sum of the lengths of the

More information

MA/CSSE 473 Day 13. Student Questions. Permutation Generation. HW 6 due Monday, HW 7 next Thursday, Tuesday s exam. Permutation generation

MA/CSSE 473 Day 13. Student Questions. Permutation Generation. HW 6 due Monday, HW 7 next Thursday, Tuesday s exam. Permutation generation MA/CSSE 473 Day 13 Permutation Generation MA/CSSE 473 Day 13 HW 6 due Monday, HW 7 next Thursday, Student Questions Tuesday s exam Permutation generation 1 Exam 1 If you want additional practice problems

More information

HP-71B Sudoku Solver s Sublime Sequel

HP-71B Sudoku Solver s Sublime Sequel HP-71B Sudoku Solver s Sublime Sequel Valentín Albillo (#1075, PPC #4747) After my original article HP-71B Short & Sweet Sudoku Solver appeared in Datafile V24N2 p22, I went to try it with every Sudoku

More information

Game Mechanics Minesweeper is a game in which the player must correctly deduce the positions of

Game Mechanics Minesweeper is a game in which the player must correctly deduce the positions of Table of Contents Game Mechanics...2 Game Play...3 Game Strategy...4 Truth...4 Contrapositive... 5 Exhaustion...6 Burnout...8 Game Difficulty... 10 Experiment One... 12 Experiment Two...14 Experiment Three...16

More information

Algorithmique appliquée Projet UNO

Algorithmique appliquée Projet UNO Algorithmique appliquée Projet UNO Paul Dorbec, Cyril Gavoille The aim of this project is to encode a program as efficient as possible to find the best sequence of cards that can be played by a single

More information

Outline for today s lecture Informed Search Optimal informed search: A* (AIMA 3.5.2) Creating good heuristic functions Hill Climbing

Outline for today s lecture Informed Search Optimal informed search: A* (AIMA 3.5.2) Creating good heuristic functions Hill Climbing Informed Search II Outline for today s lecture Informed Search Optimal informed search: A* (AIMA 3.5.2) Creating good heuristic functions Hill Climbing CIS 521 - Intro to AI - Fall 2017 2 Review: Greedy

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

Lecture 6: Latin Squares and the n-queens Problem

Lecture 6: Latin Squares and the n-queens Problem Latin Squares Instructor: Padraic Bartlett Lecture 6: Latin Squares and the n-queens Problem Week 3 Mathcamp 01 In our last lecture, we introduced the idea of a diagonal Latin square to help us study magic

More information

A Genetic Algorithm for Solving Beehive Hidato Puzzles

A Genetic Algorithm for Solving Beehive Hidato Puzzles A Genetic Algorithm for Solving Beehive Hidato Puzzles Matheus Müller Pereira da Silva and Camila Silva de Magalhães Universidade Federal do Rio de Janeiro - UFRJ, Campus Xerém, Duque de Caxias, RJ 25245-390,

More information

Chapter 5 Backtracking. The Backtracking Technique The n-queens Problem The Sum-of-Subsets Problem Graph Coloring The 0-1 Knapsack Problem

Chapter 5 Backtracking. The Backtracking Technique The n-queens Problem The Sum-of-Subsets Problem Graph Coloring The 0-1 Knapsack Problem Chapter 5 Backtracking The Backtracking Technique The n-queens Problem The Sum-of-Subsets Problem Graph Coloring The 0-1 Knapsack Problem Backtracking maze puzzle following every path in maze until a dead

More information

Factorization of permutation

Factorization of permutation Department of Mathematics College of William and Mary Based on the paper: Zejun Huang,, Sharon H. Li, Nung-Sing Sze, Amidakuji/Ghost Leg Drawing Amidakuji/Ghost Leg Drawing It is a scheme for assigning

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

Written examination TIN175/DIT411, Introduction to Artificial Intelligence

Written examination TIN175/DIT411, Introduction to Artificial Intelligence Written examination TIN175/DIT411, Introduction to Artificial Intelligence Question 1 had completely wrong alternatives, and cannot be answered! Therefore, the grade limits was lowered by 1 point! Tuesday

More information