Challenge from last time
Remember... Suppose you have 9 coins. They are all identical (look, feel, smell, taste, etc.), except one of them is fake and weighs a little more. You also have a binary scale. That is, it can only tell if one side is heavier than the other, but cannot quantify the difference (see picture below). Using the scale only 2 times, how can you find the fake coin? Using scale = putting coins on it and seeing which side is heavier. |
|
Review
Unix commands - how do I ...
- List contents of directory
- Change directories
- Move a file
- Delete a file
- Rename a file
- Delete a directory
- Go to my home directory
- Display the current working directory (ie. where you are)
- Go up a directory (go to the parent directory)
- Make a new directory
- Open up a manual page
8 x 8 Queens problem
In chess a queen can move diagonally, horizontally, or vertically. Furthermore, it can go as far as it wants to in any single move. The challenge of the 8x8 queens problem is "how can you place 8 queens on an ordinary chess board so that no queen can hit any other queen in 1 move?". The image on the right is one possible solution |
Here is what you will do:
- Split up into groups and come up with cool group names!
- Write HTML code (using 1 table) to display a standard 8x8 chess board.
- Half of the squares must be white, the other half black. None of the white squares may share a side with another white square (normal chess board configuration).
-
Display the standard pieces on the chessboard in their initial positions.
Use the img tag to display images for the chess pieces.
Assume that an images folder exists in the same directory as the html code that you're designing. In that directory you have pawn.png, knight.png, bishop.png, rook.png, queen.png, king.png - Okay, so making you write HTML for 64 cells is a little cruel, so just do the 16 cells that represent the initial placement of the white pieces.
- Find 5 solutions to the 8 queens problem and draw them out on paper. There are a total of 12 correct solutions, where 2 are mirrors or rotations of another solution. So there are 10 really interesting solutions. You may NOT use the solution that is expressed in the image at the top of the page.
- Send 1 member of your group up to draw your solutions on the board
A challenge for next time
As everyone knows, knights tell the truth all the time, and liars lie
all the time. At least, this is what evenly behaved knights and liars
do.
Less known is that there are also odd knights, who on odd-numbered days
lie all the time. (On even-numbered days, however, they behave evenly,
and tell the truth.) Also, there are odd liars, who on odd-numbered
days, tell the truth about everything, while they lie the rest of the
days.
Someone said: "Today's the 3rd. Trust me, I'm telling the truth. I'm
odd. I'm not a knight. My eyes are brown."
At first, this seemed illogical, and I thought he couldn't be either a
knight or a liar, even or odd, but after a while the solution dawned on
me and I found the error in my reasoning. What is he?