Bug: CF::MaxShapes

Here you can discuss and share functionality improvements and helper programs to make Context Free better.

Moderators: MtnViewJohn, chris, mtnviewmark

Post Reply
User avatar
kipling
Posts: 91
Joined: Wed Jun 18, 2008 2:36 am

Bug: CF::MaxShapes

Post by kipling »

Code: Select all

CF::MaxShapes=3
startshape S
shape S{
	SQUARE[]
	S[x 1.1]
	}
Please fix. 😀
(Can't seem to attach an image - this used to be possible, but I can only link to an image)

User avatar
MtnViewJohn
Site Admin
Posts: 875
Joined: Fri May 06, 2005 2:26 pm
Location: Mountain View, California
Contact:

Re: Bug: CF::MaxShapes

Post by MtnViewJohn »

The dreaded off-by-one error. Even if fixed you would still see extra shapes in some conditions:

Code: Select all

CF::MaxShapes=3
startshape S
shape S{
	SQUARE[]
	SQUARE[]
	S[x 1.1]
}
will always have an even number of shapes because the maxshapes check is in the wrong place. How crucial is it for CF::MaxShapes to be exact? I can check in another place.

User avatar
kipling
Posts: 91
Joined: Wed Jun 18, 2008 2:36 am

Re: Bug: CF::MaxShapes

Post by kipling »

I wasn't serious about "please fix". So "How crucial" = ε.
I just noticed it when trying to land an exact shape count for the hearts design, so I wrote a MWE.
My workaround in that design is an explicit "-1" in the code.
Yes, everyone should count from 0 to N except when they count from 1 to N-1.

User avatar
MtnViewJohn
Site Admin
Posts: 875
Joined: Fri May 06, 2005 2:26 pm
Location: Mountain View, California
Contact:

Re: Bug: CF::MaxShapes

Post by MtnViewJohn »

Ha ha. I won't fix it then. I wouldn't want to break your work-around. :lol:

Post Reply