How DemiSemi scores your cut

The shoelace formula for area, the Sutherland–Hodgman algorithm for the cut, a binary search for the perfect line: the whole calculation, in plain English.

Measuring area: the shoelace formula

Every DemiSemi shape is a polygon: a list of points connected in order (curves are made of lots of tiny straight segments). To measure its area, we use the shoelace formula, described by Albrecht Meister in 1769 and made famous by Carl Friedrich Gauss.

Go around the corners in order. For each side, multiply the x of the first point by the y of the next one, then subtract the reverse product. Half the total is the area. The name comes from the criss-cross pattern of those products, which looks like a laced-up shoe.

Try it on the square with corners (0, 0), (2, 0), (2, 2) and (0, 2): the four sides give 0, 4, 4 and 0. They add up to 8, and half of that is 4. A square with sides of 2 has an area of 4. It checks out.

Making the cut

Your swipe defines an infinite straight line that splits the plane in two. For each outline of the shape, we keep only the part on one side of that line, using the Sutherland–Hodgman algorithm, published in 1974 for computer graphics.

We measure that part with the shoelace formula, subtract any holes, and divide by the total area. That’s your first half. The second half is whatever’s left.

Finding the perfect cut at your angle

Next, we look for the line parallel to yours that gives an exact 50/50, using a binary search: try a position in the middle of the possible range, check whether that half is too big or too small, keep the right half of the range, and repeat until we’re within a millionth.

The distance between your line and that one is shown in units. The play area is 1,000 units on each side, and the shape fills about four-fifths of it.

From halves to points

How far off you are is the distance between your first half and 50, in percentage points. It’s calculated on the halves you see, rounded to the hundredth, so you’ll never see 50.00 / 50.00 without getting the top tier.

Up to 0.10 off: DEAD ON, 100 points. Past that, you lose 20 points for every point you’re off: CLEAN up to 0.50, NOT BAD up to 2, WONKY up to 5. More than 5 points off is a MISS, worth 0. Being 1.25 off, for example, earns 100 − 20 × 1.25 = 75 points.

The server has the final word

Your phone runs the whole calculation so the reveal can play instantly. But the server redoes it from your line, with exactly the same code, and that’s the result it saves. Nobody can claim a score they didn’t earn, and only your first game of each day counts toward the rankings.

Play

All guides

From the same maker : RicRac. Seven questions a day. Stop the counter as close to the answer as you dare, without going over.

Past days · Guides · How to play · FAQ · About · Privacy · Legal · Credits · Play RicRac · Français