Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Polyominoes (sp?)
#1
This was one of the problems from programming competition I won this year.

A polyominoe is a connected patch of the same letters, they must be connected directly verticaly or horizontally

A A A B B
A B B B C
A A B C C
D D D D C
D D D A B

the bold A's are an example of a polyominoe

You must write a program to count the number of polyominoes in a grid of letters

you take input from a text file (must be test.dat), i.e:

the first number in the file, x, will be the x size of the grid, the second, y, will be the y size. the next x*y data entrys will be upper case letters (the data for the grid)

Code:
5, 5
A, A, A, B, B
A, B, B, B, C
A, A, B, C, C
D, D, D, D, C
D, D, D, A, B

the output for this data would be 6

your program should be able to handle grids of capital letters only, with a size maximum of 32x32

the fastest program will win
COUNT HACKED BY RAZVEEE

RAZVEE IS A SCRIPT KIDDIE- hacker9
Reply


Messages In This Thread
Polyominoes (sp?) - by Lithium - 05-24-2005, 07:06 PM
Polyominoes (sp?) - by Blitz - 05-24-2005, 08:03 PM
Polyominoes (sp?) - by Z!re - 05-24-2005, 08:41 PM
Polyominoes (sp?) - by Meg - 05-24-2005, 08:42 PM
Oopps - by Lithium - 05-24-2005, 10:58 PM
Polyominoes (sp?) - by Neo - 05-25-2005, 04:09 PM
Wow - by Lithium - 05-25-2005, 06:57 PM
Polyominoes (sp?) - by Neo - 05-26-2005, 05:01 AM
Polyominoes (sp?) - by Lithium - 05-26-2005, 09:11 PM
Polyominoes (sp?) - by Pyrokid - 05-27-2005, 02:10 AM
Polyominoes (sp?) - by Lithium - 05-30-2005, 07:24 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)