Read without ads and support Scribd by becoming a Scribd Premium Reader.
 
Backtracking Algorithms inMCPLusing Bit Patterns and Recursion
by 
Martin Richards
 mr@uk.ac.cam.clhttp://www.cl.cam.ac.uk/users/mr/
Computer LaboratoryUniversity of CambridgeFebruary 23, 2009
Abstract
This paper presents example programs, implemented in MCPL, that use bit pat-tern techniques and recursion for the efficient solution of various tree search prob-lems.
Keywords
Backtracking, recursion, bit-patterns, MCPL, queens, solitaire, pentominoes,nonograms, boolean satisfiability.
 
CONTENTS 
i
Contents
1 Introduction 12 The Queens Problem 2
2.1 The queens program . . . . . . . . . . . . . . . . . . . . . . . . . 4
3 Solitaire Problems 5
3.1 Triangular solitaire . . . . . . . . . . . . . . . . . . . . . . . . . . 53.2 The triangular solitaire program . . . . . . . . . . . . . . . . . . . 83.3 A more efficent algorithm for triangular solitaire . . . . . . . . . . 103.4 The more ecient program . . . . . . . . . . . . . . . . . . . . . . 133.5 Conventional solitaire . . . . . . . . . . . . . . . . . . . . . . . . . 163.6 The conventional solitaire program . . . . . . . . . . . . . . . . . 17
4 The Pentominoes Problem 18
4.1 Pento . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184.2 The pento program . . . . . . . . . . . . . . . . . . . . . . . . . . 204.3 Pento3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234.4 The Pento3 program . . . . . . . . . . . . . . . . . . . . . . . . . 254.5 The Pento4 program . . . . . . . . . . . . . . . . . . . . . . . . . 274.6 Pento6 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 314.7 The program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 324.8 The two player pentomino game . . . . . . . . . . . . . . . . . . . 354.9 Exploring the move tree . . . . . . . . . . . . . . . . . . . . . . . 364.10 The program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
5 The Cardinality of 
D
3
48
5.1 The program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
6 Nonograms 51
6.1 Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 536.2 Observation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 556.3 The program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
7 Boolean Satisability 63
7.1 Longitudinal arithmetic . . . . . . . . . . . . . . . . . . . . . . . 647.2 Comment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 667.3 The program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
Search History:
Searching...
Result 00 of 00
00 results for result for
  • p.
  • Notes
    Load more