140 likes | 257 Views
Knight’s Circuit. Problem. To find a Knight’s circuit of a chess board. Can we visit every square of a chessboard, once and only once, and return to the starting square. . Systematic Search. We could write a brute force search program (e.g. in Java) 64 squares.
E N D
Problem • To find a Knight’s circuit of a chess board. • Can we visit every square of a chessboard, once and only once, and return to the starting square.
Systematic Search • We could write a brute force search program (e.g. in Java) • 64 squares. • From each position 2, 4, 6, 8 or 16 moves!!! • Explosion and implosion of choice of moves.
Invent a new problem • Allow any moves • This problem is trivial • Lets consider restrictive moves.
Horizontal and Vertical • Lets consider once square. • Horizontal or vertical. • Call these straight moves. • Can we find a solution. • Do this as an exercise.
8x8 • Or arbitrary board • EX 8.1 What size boards can we cover with straight moves. • What are the base case and inductive case? • See diagram 8.3
8.2 Supersquares • Imagine dividing into 2 by 2 squares – 8.6 • Knight moves are either straight or diagonal. • Straight moves are either vertical or horizontal to a Supersquare. • Diagonal moves are not straight.
Crucial observation • Observe vertical moves and horizontal moves. • Vertical moves flip around vertical axis, • Horizontal moves flip around horizontal axis.
Notation • Denote v, the operation of flipping around vertical axis. • Denote h, the operation of flipping around horizontal axis. • ; is used to separate actions. • e.g. v;h means??? • Does v;h = h;v • Both are equivalent to c, rotating thru 180 degrees. • There is a 4th operations n do nothing. • (n = no change) • SO v;v = h;h = c;c = n;n • This allows us to simplify a sequence of actions to one action. • Do e.g. 124 on board • In words…
Exercise 8.6 • Construct a 4 by 4 table showing the single operation of each of the rows and cols
Partitioning the board • Suppose a square is labelled n. Other squares can also be labelled. • All squares are labelled into disjoint sets • Two squares having the same colour, means they can be reached from each other by straight Knight moves. • Two squares of different colour cannot be reached from each other by straight moves. • We can construct straight moves for each of the colours • We have 4 disjoint circuits. These need to be combined into one circuit.
Combining circuits • To combine 4 circuits, combine a pair, then combine another pair. • Combine red and blue • Combine green and yellow • Combine red-blue and green-yellow • 8.12