Math Is Fun Forum
  Discussion about math, puzzles, games and fun.   Useful symbols: ÷ × ½ √ ∞ ≠ ≤ ≥ ≈ ⇒ ± ∈ Δ θ ∴ ∑ ∫ • π ƒ -¹ ² ³ °

You are not logged in.

#1 2009-11-04 08:51:07

talhakosen
Member
Registered: 2009-11-01
Posts: 10

Calculate a block of five in 8 x 8 board ?

Hi all,

I need to know how to write a code with C or C++  which calculates below

8x8 cheesboard how many different ways can you select a block of five neighbour squares?
Two squares are neighbours if they have a common side.
(for 3x3 board  = 49 ways)

image001.jpg

Thanx

Offline

#2 2009-11-26 04:05:08

John E. Franklin
Member
Registered: 2005-08-29
Posts: 3,562

Re: Calculate a block of five in 8 x 8 board ?

I did it out by hand.
Answer is:
(48 * 36) + (48 * 25) + (10 * 16) = 3 088

But for the 3 x 3, I only get 48, not 49.

Here are my calculations in mspaint.exe, zoom in to see at 800% with grid.

View Image: nghbr88.png

Last edited by John E. Franklin (2009-11-26 04:09:56)


igloo myrtilles fourmis

Offline

#3 2009-11-26 04:41:48

mathsyperson
Moderator
Registered: 2005-06-22
Posts: 4,900

Re: Calculate a block of five in 8 x 8 board ?

These are all the shapes that can be made by sticking five squares together.

XXXXX  (5x1, 2)

---

XXXX   (4x2, 8)
X

---

XXXX   (4x2, 8)
 X

---

XXX    (3x2, 8)
XX

---

XXX    (3x2, 4)
X X

---

X
XXX    (3x3, 4)
X

---

X
XXX    (3x3, 8)
 X

---

X
XXX    (3x3, 4)
  X

---

 X
XXX    (3x3, 1)
 X

---

X
XX     (3x3, 4)
 XX

---

XXX    
X      (3x3, 4)
X

---

XXX    (4x2, 8)
  XX

Next to each is the dimensions of the smallest rectangle it will fit into, and the number of different forms it can take via reflection and rotation.

You can work out how many ways each one of these will fit on a chessboard, then add everything up.

For example, the line fits in a 5x1 box. There are (9-5)x(9-1) = 32 ways to place a 5x1 box on a chessboard, and the line can be oriented in two different ways, so altogether there are 64 ways to place a line on a chessboard.

Similarly, the T fits in a 3x3 box and is orientable 4 ways, so the number of ways to place a T on a chessboard is 4x(9-3)x(9-3) = 144.

etc...


Why did the vector cross the road?
It wanted to be normal.

Offline

#4 2009-11-27 06:00:45

John E. Franklin
Member
Registered: 2005-08-29
Posts: 3,562

Re: Calculate a block of five in 8 x 8 board ?

Also, my estimate is a little high because I did 5x5 grids with straight lines inside them moving around, and
then I moved the 5x5 grid around, so some of these will be on top of one another, like the 5x5 to the right with
the inerds to the the left, etc.  So my answer is not exact.

Edit:  @talhakosen,  you are right about the 49 in 3x3, I found the "plus" sign one by doing it over.


xox
ooo
xox

Last edited by John E. Franklin (2009-11-27 06:29:00)


igloo myrtilles fourmis

Offline

#5 2009-11-27 06:59:59

John E. Franklin
Member
Registered: 2005-08-29
Posts: 3,562

Re: Calculate a block of five in 8 x 8 board ?

Here is my latest computation of the 5 neighbors on a chessboard 8 by 8:

(42 * 8) + 64 + (35 * 8) + (35 * 8) + (36 * 4) + 36 + (36 * 8) + (36 * 4) + (42 * 4) + (36 * 4) + (35 * 4) + (36 * 4) = 2 168

See diagram below larger this time to see better.

Note the "plus" sign is the + 36 + above.

And the ooooo long straight is the + 64 + above.

Other shapes are rotated 4 times, hence multiply by 4 or 8 times if the mirror image is involved.

View Image: 5neibor.png

igloo myrtilles fourmis

Offline

#6 2009-11-27 11:41:31

John E. Franklin
Member
Registered: 2005-08-29
Posts: 3,562

Re: Calculate a block of five in 8 x 8 board ?

Oh my, my 2nd to last and 3rd to last drawings of 12, I didn't show the mirror images, so
the equation is short a little, so double those terms:
36 * 8 and add 35 * 8 instead of 36 * 4 and 35 * 4, sorry sad


igloo myrtilles fourmis

Offline

#7 2009-11-27 16:31:59

soroban
Member
Registered: 2007-03-09
Posts: 451

Re: Calculate a block of five in 8 x 8 board ?

.


. .


      *---*---*---*---*---*   *---*---*---*---*
      |   |   |   |   |   |   |   |   |   |   |
      *---*---*---*---*---*   *---*---*---* - *
                                          |   |
      *---*---*---*           *---*       *---* 
      |   |   |   |           |   |
      *---*---* - *---*   *---* - *---*---* 
              |   |   |   |   |   |   |   |
              *---*---*   *---*---*---*---*
      *---*       *---*---*       *---*
      |   |       |   |   |       |   | 
      * - *---*   * - *---*   *---* - *---*
      |   |   |   |   |       |   |   |   | 
      * - * - *   *---* - *   *---* - *---*
      |   |   |   |   |   |       |   | 
      *---*---*   *---*---*       *---*

      *---*---*       *---*       *---*---*
      |   |   |       |   |       |   |   |
      *---* - *---*   * - *---*   *---* - *
          |   |   |   |   |   |       |   |
          * - *---*   *---* - *---*   * - *---*
          | - |           | - | - |   | - | - |
          *---*           *---*---*   *---*---*
      *---*---*---*       *---*
      |   |   |   |       |   | 
      *---* - *---*       * - *
          |   |           |   | 
          * - *           * - *---*---*
          |   |           |   |   |   | 
          *---*           *---*---*---*

Offline

#8 2009-12-31 11:49:58

oghk
Guest

Re: Calculate a block of five in 8 x 8 board ?

hi.

if i solve this problem, i have enter a job. but i didnt solve it.

and then i didnt understand your answer. please again answer and real solve. pls. pls. pls.

Board footer

Powered by FluxBB