[an error occurred while processing this directive]
Please take advantage of the scheduled lab hours to make progress on PS3.
;;; A board is a pair of the number of rows and the empty squares (define (make-board rows holes) (cons rows holes)) (define (board-holes board) (cdr board)) (define (board-rows board) (car board)) ;;; A position is a pair of a row and column. ;;; ;;; make-position creates an row, col coordinate that ;;; represents a position on the board ;;; e.g. 1,1 ;;; 2,1 2,2 ;;; 3,1 3,2 3,3 (define (make-position row col) (cons row col)) (define (get-row posn) (car posn)) (define (get-col posn) (cdr posn)) (define (same-position pos1 pos2) (and (= (get-row pos1) (get-row pos2)) (= (get-col pos1) (get-col pos2))))Define a procedure on-board? that takes as inputs a board and a position, and outputs true if and only if the position is on the board.
Define a procedure remove-peg that takes as input a board and a position, and produces as output the board with the peg at the input positition removed.
(define (remove-peg board posn) (make-board (board-rows board) _______________________))Define a procedure add-peg that takes as input a board and a position, and produces as output the board with a peg added at the input positition. (Hint: this is much tougher.)
Next, try to solve as much of the problem as you can. You should first think about how to simulate a jump on the board. Then, consider how to find all the possible jumps on a given board. Finally, consider how to search all the possible sequences of jumps to find a winning sequence.
Good luck! And remember, even if you leave two pegs, "you're purty smart".