Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » 5 Sided Shape?
- JH1010
-
76 posts
5 Sided Shape?
I have a list of diagonals in a 43 sided shape each of which has been assigned a colour. My list looks like this (just an example, the colours are random).
1,2,g
1,3,r
1,4,r
…
35,37,r
35,38,g
35,39,g
…
41,42,g
41,43,g
42,43,r
r=red g=green
The numbers are corner numbers.
Is there any way I can check from a list like that whether there would be a 5 sided shape entirely of one colour if the diagonals were drawn in in real life?
1,2,g
1,3,r
1,4,r
…
35,37,r
35,38,g
35,39,g
…
41,42,g
41,43,g
42,43,r
r=red g=green
The numbers are corner numbers.
Is there any way I can check from a list like that whether there would be a 5 sided shape entirely of one colour if the diagonals were drawn in in real life?
Last edited by JH1010 (May 25, 2013 09:49:00)
- ErnieParke
-
1000+ posts
5 Sided Shape?
Yes, there is a way to check for that, though it'd involve a twist on a path-finder, and although I know how to make one, I'm not 100% sure of the script needed at the moment.
With regards,
ErnieParke
With regards,
ErnieParke
- JH1010
-
76 posts
5 Sided Shape?
Thanks. I'll research pathfinders. Yes, there is a way to check for that, though it'd involve a twist on a path-finder, and although I know how to make one, I'm not 100% sure of the script needed at the moment.
With regards,
ErnieParke
- Hardmath123
-
1000+ posts
5 Sided Shape?
You can iterate over each set of 5 diagonals, but that would be silly. Are there only 2 colors? Then I hypothesize there must be at least one such pentagon (I'll try and find a proof).
EDIT: I'm guessing vertices of the pentagon have to be vertices of the 43gon?
EDIT: I'm guessing vertices of the pentagon have to be vertices of the 43gon?
Last edited by Hardmath123 (May 28, 2013 07:25:04)
- JH1010
-
76 posts
5 Sided Shape?
must be at least one such pentagon (I'll try and find a proof).Yes. This problem is a part of Ramsey's theorem. Top mathematicians can't find a proof. My idea was to use my computer program to find one that didn't have a pentagon or go through all of the possible combinations thus proving that they all do. You can iterate over each set of 5 diagonals, but that would be silly. Are there only 2 colors? Then I hypothesize there
EDIT: I'm guessing vertices of the pentagon have to be vertices of the 43gon?
- mwiedmann
-
100+ posts
5 Sided Shape?
Let me see if I understand. You list holds coordinates for the vertices in this polygon? If so, I assume you are drawing the edges in the order they appear in the list?
If this is true, then you can loop go through the list once and check if the item 5 spots later in the list has the same coordinate. This would mean 5 sided shape no? Now the rest of the coordinates would potentially create something else, but those 5 vertices at least create a pentagon.
If this is true, then you can loop go through the list once and check if the item 5 spots later in the list has the same coordinate. This would mean 5 sided shape no? Now the rest of the coordinates would potentially create something else, but those 5 vertices at least create a pentagon.
- xlk
-
100+ posts
5 Sided Shape?
Wouldn't you just have to check that there are 5 points of said colour?
just make a script that goes one item of the list at a time, and if it's of the desired colour, add one to a variable. once it's done, the variable will show how many points of that colour there are, thus how many sides a polygon of that colour and those points can have.
just make a script that goes one item of the list at a time, and if it's of the desired colour, add one to a variable. once it's done, the variable will show how many points of that colour there are, thus how many sides a polygon of that colour and those points can have.
- mwiedmann
-
100+ posts
5 Sided Shape?
Let me see if I understand. You list holds coordinates for the vertices in this polygon? If so, I assume you are drawing the edges in the order they appear in the list?
If this is true, then you can loop go through the list once and check if the item 5 spots later in the list has the same coordinate. This would mean 5 sided shape no? Now the rest of the coordinates would potentially create something else, but those 5 vertices at least create a pentagon.
I think the part I missed here is that the edges may cross each other and then you wouldn't really have a 5 sided shape. Is this the problem you can't solve?
- Discussion Forums
- » Help with Scripts
-
» 5 Sided Shape?