- This is one of the standard exercises that all computer science students have to solve at least once in their lifetimes! If you have never played chess, find someone who does or find a book and look up how a Queen moves and threatens in chess. Find out what a chess board looks like.
- Define a matrix (two-dimensional array) of integers in Java. Write a method to put a -1 in every cell of the matrix. You do have a working matrix class, don't you? That would make this really trivial!
- Given two cells in a matrix, (r1, c1) and (r2, c2). How can you determine if
1. the cells are in the same row?
2. the cells are in the same column?
3. the cells are in the same ascending diagonal?
4. the cells are in the same descending diagonal?
- Implement the recursive solution to the Towers of Hanoi so that you can see how recursion works. Use the debugger at the start of class to investigate how the recursion works!
|
|