CS 242 Spring 2010 : Chess Puzzles

This page last changed on Jun 03, 2010 by cemeyer2.

Week 1 – n Queens

During the first week, students will have to write code that solves the n queens problem.

The problem: How can n queens be placed on an n x n chess board such that no two queens can capture each other.

For this week, students will have to start small and build a generic solution.

Expected work:

  • Student program should be able to take in a number n, we can limit it to < X to make it reasonable
  • Student program should be able to solve the puzzle
  • Student program should be able to graphically display the solution(s) if they exist (for n=2,3 there are none). Solutions can be displayed on the console.

Week 2 – Puzzles of choice

Assuming students wrote a modular and generic solution to week 1, week 2 should be a simple extension. However, if solutions to week 1 were poorly crafted, week 2 will be much more painful. The premise: pick 2-3 puzzles from the list below and extend your week 1 solution to solve them. The puzzles:

  • 14 bishops – given an 8 x 8 chess board, how can 14 bishops be placed such that no two can capture each other
  • 16 kings – given an 8 x 8 chess board, how can 16 kings be placed such that no two can capture each other
  • 8 rooks – given an 8 x 8 chess board, how can 8 rooks be placed such that no two can capture each other
  • Domination – given a number n, what is the minimum number of queens needed such that every square on an n x n chess board can be attacked by a queen
  • queens and knights – given a number n, what is the largest number m such that m queens and m knights can be placed on an n x n chess board where no two pieces can attack each other

Week 2.5 – More puzzles (if needed)

Do the puzzles on the week 2 list that have not been done yet

Week 3 – GUI

Add a GUI to the program. Use some architectural pattern, maybe MVC since we have pushed it in the past.

Document generated by Confluence on Feb 22, 2012 18:15

  1. No comments yet.

  1. No trackbacks yet.