My Math Forum  

Go Back   My Math Forum > College Math Forum > Applied Math

Applied Math Applied Math Forum

LinkBack Thread Tools Display Modes
April 18th, 2015, 11:16 AM   #1
Joined: Oct 2011

Posts: 4
Thanks: 0

Wink How do I determine how many sides a shape has?

Hello Mathematicians!

I’m hoping you can help a somewhat-mathy person with a puzzle which is stumping me.

I’m developing a computer program where a person can make shapes from squares on a matrix. They do this on a 6x6 grid, which is composed of 36 squares, and the user has the option to turn a square on or off. The user can create a shape by turning some of these cells on. I suppose this works like a “binary matrix”.

What I want to ask the user to do, for example, is create a shape with six sides using four blocks. (They’ll have varied challenges depending on the question, but they’ll involve creating a shape, usually with a certain number of sides, from a certain number of blocks.) They can do this in many different ways, in many positions, and orientations. What I’d like to do is somehow calculate the number of sides a shape has when the user turns on connecting cells.

How do I do that though? How do I tell a computer what to count to determine how many sides a shape has? I’m sure the solution is simple and has a distinguishable pattern but this has been stumping me.

Any assistance to this logic problem will be much appreciated!

Thank you,
Attached Images
File Type: jpg shapes.jpg (15.5 KB, 4 views)
bparker is offline  
April 19th, 2015, 10:27 AM   #2
Math Team
Joined: Apr 2010

Posts: 2,780
Thanks: 361

Some terms (I made them up, if you have any better...):
Let a bar be the side of a square, whether the square is colored or not. So a square has four bars and the 6x6 grid has 84 bars.

Let a bar be dubious if [one adjacent square to it is selected (by the user)] AND [[the other square is not selected] OR [the other square is not there (the bar is on the edge of the grid).]]

Let a side be bars in alignment such that any bar between any two bars on the same line are dubious.

You could create a list of all dubious bars created by the user, then identify the bars that form a side and count the sides. Does this help?
Hoempa is offline  

  My Math Forum > College Math Forum > Applied Math

determine, geometry, logic, matrix, programming, shape, sides

Search tags for this page
Click on a term to search for related topics.
Thread Tools
Display Modes

Similar Threads
Thread Thread Starter Forum Replies Last Post
2D shape with 1 side? caters Geometry 2 March 20th, 2015 05:33 PM
The shape of a parabola maxgeo Algebra 6 December 30th, 2012 09:59 PM
Det. length of sides of polygon from Area and ratio of sides telltree Algebra 0 January 21st, 2010 12:51 PM
What shape is this? computronium Real Analysis 4 June 27th, 2009 06:39 AM
The shape of a parabola maxgeo Abstract Algebra 1 December 31st, 1969 04:00 PM

Copyright © 2019 My Math Forum. All rights reserved.