News for hackers. Stuff that matters.
Re:I open sourced my game along with a tutorial on how to ma... by OkayPhysicist on Monday July 06, 2020 @04:19AM (#23745763)
It replaces the standard [0,len()) with an [1,len()], though, which correspondingly makes other tasks easier. Plus it matches normal mathematical vector indexing.

In the end, in a language where you aren't doing pointer arithmetic, the sides are pretty even. We just tend to side with tradition, because it's easier to.

Re:I open sourced my game along with a tutorial on how to ma... by sergeykish on Monday July 06, 2020 @05:46PM (#23753169)
I found it uncomfortable when drawing on screen:

   y = margin + (i - 1) * lineheight
Re:I open sourced my game along with a tutorial on how to ma... by wruza on Tuesday July 07, 2020 @09:14AM (#23758845)

  y = 1 + ...
if y is 1-based too (which feels even more uncomfortable). But it would be nice to have such functions out if the box:

  canvas.linear_index(x, y, stride)
  vbox.y1_for(margin, spacing, height, i)
  vbox.y2_for(margin, spacing, height, i)
And then you have "integer at the center of a pixel" vs "integer at the top-left of a pixel" differences, which should be taken into account by these functions too. Stroke 1: y+0.5, y+height-1. Stroke 2: y+1, y+height-2. Fill: y, y+height.

Pixel geometry is hard on its own.