v50 Steam/Premium information for editors
  • v50 information can now be added to pages in the main namespace. v0.47 information can still be found in the DF2014 namespace. See here for more details on the new versioning policy.
  • Use this page to report any issues related to the migration.
This notice may be cached—the current version can be found here.

40d Talk:Macro design

From Dwarf Fortress Wiki
Jump to navigation Jump to search

Updates to my work in progress[edit]

Wow thats a lot of updates to a page I was building, that had no links to, with no discussion page entries.., and I had to go to bed.

I like most of what has been done except for the following

  • Changing a "Step to Far" to Off-by-one Errors
    • This is the exact opposite of the common off-by-one error of arrays and for loops, while it is an error of just 1, this is misleading I think. Also "off-by-one" is really just a CS term.
  • The Change (labeled " Off-by-one") to make "current" into "initial"
    • This is wrong, as it can occur anywhere in the script not on just the initial movement.
  • In Fast Movement
    • The Concept of the cursor jumping was removed and replaced with " the cursor moves ten squares instead of one". The old Term of "Jumping" gets across the idea of skipping/is-faster than ten squares of movement
  • What was wrong with "(nearly half)"
  • "Troubleshooting"
    • this is a "design" page, not a how to code page. the Original "Problems to avoid" term is more toward the concept of "read this section first and have it in your head while coding". Not to figure out what when wrong after the fact. Hopefully if they design it right the first time, it will work perfectly with no debugging.
  • I think the Second Edge Collision paragraph read a lot better the way it was.
  • "applies to a command" isn't correct.
    • Original didn't have that issue

Over all I'm glad for the help (especially in the conversion to a 3rd person), I just didn't expect it until the page was actively linked some where. I'll make the above changes if I don't see a justification not-to comments. Larek 22:37, 12 November 2009 (UTC)


Heh, yeah, every edit you make shows up in Special:RecentChanges, and there are several people who watch that page. In general, as soon as you click save, people will see your change and look at it, and if it's in the main namespace, they will probably make changes, too. If you want to keep exclusive ownership over something, you can make a user page like User:Larek/Macro design. We'll still see it, but it's considered bad form to edit someone else's personal pages.
  • Why do you say it's the opposite of an off by one error? The programming term is used to describe confusion in loop conditions when iterating over an array. It seems quite analogous to me; maybe you can elaborate.
  • Re: current vs initial, my thought was that it's the starting point for a given series of movement commands. Personally I think that's clear from the context, but I'm open to other ideas.
  • Would you be happy with "the cursor jumps ten squares instead of one"? I wouldn't have a problem with that.
  • I thought "(nearly half)" would be obvious to anyone reading the numbers. In general, if text is unnecessary, then removing it means you get to the next necessary idea faster.
  • You say it's not about debugging, but the first clause was already "When your script doesn't run as planned" before I edited. That sounds like debugging to me. Personally I don't think debugging is inappropriate on a design page; people following along are likely to need debugging strategies unless they somehow do everything perfectly the first time.
  • I thought the edge collision section was missing some key concepts, specifically the possible disparity between changed-area and traversed-area which is the root cause of the problem in the first place. What advantages do you see in its original phrasing?
  • Admittedly, "applies to" is metaphorical. I was trying to express that now instead of (normal jump)(backpedal jump) you have (backpedal jump)(normal jump), since the "backward" movement takes place earlier. I'll try to think of a better phrasing, but please feel free to come up with something yourself.
But welcome to the wiki, and thank you for contributing!
--HebaruSan 00:05, 13 November 2009 (UTC)


Wow, So we have hawks, perched, looking for fresh meat. :)
No it wasn't a personal page, It was a initial work in progress that I hadn't gotten to a first release state yet. I had not Idea that you could do sub-user pages. The heavy editing with no comments through me off a bit too. Water under the bridge.
  • "the opposite of an off by one error", off-by-one is a CS term and I'll use your diagram to hopefully show what I mean.

In the 'normal' world people count like this

 1 2 3 4 5 6 7...
 # # # # # # #...

 They teach that in Kindergarten I think.

However in the World of Bits, CS (arrays, integers, loops etc) count like this

 0 1 2 3 4 5 6...
 # # # # # # #...

   There starting value is 0, so their first(1) operation is dealing with item zero(0).
   Since CS People originally lived in a non bit world, they tend to revert back creating
   and off by one.

In DF macros we don't count, we transition  like this

  1 2 3 4 5 6 ...
 #>#>#>#>#>#>#...

  So at the end of the first(1) operation we are dealing with item Two(2), thus the 
  opposite size of '1' than the CS notion is from the Kindergarten method.
  • The other place I see programmers use off-by-one is that, a lot of loop and data structures (like ques)have initial-case and/or final-case conditions that differ from the main content of the loop or structure. When their code doesn't run right, instead of trying to recalculate the loop variables, they first test to see if they're off by one (in both directions), and see if it works.
    • This is like DF macros, But in the DF case it should be always one to high, hence the name "a step to far". Where in this second use if off-by-one its multi directional. I'm not set on the old name, but I think that implying a direction and not implying guess-and-check is good.
  • I thought current was easier it to understand, instead of a whole bunch of moves each with an initial position. I guess it's more of a flowing concept than a start, stop, start, stop... Doesn't matter too much, it's just a wording opinion.
  • Yes I think the term jump, helps the concept greatly
  • True the text should short and sweet, but we could also write a page that says "do good coding" and thats it. People tend to get "glossy eyed" when you throw a lot of numbers at them. which this article does. I thought reiterating the the count went from 38->11 is god but taking that to 11->6 its Really good too. Sure it's easily notice that they lost 27 steps in the first optimization, and that saving 5 steps isn't bad. But I wanted nearly half in there, to draw attention to the second optimization, That it is saving 45.5% ~= 50% which is big, or at least sounds bigger than just 5.
  • Cool you caught me on my own language. Hey it was a work in progress. Yes I do expect them to do a some debugging, but not debugging the design but mistakes when typing in the code.
    • I think however that the design-not-debug is still a good idea. The Back Peddling part shouldn't be a debug anyway since, if script runs correctly once, most people will stop and call it good. (and not see an issue with their Back Peddling) Its a thing that needs to be thought of during the design. And the Travel length should be "in the designers mind" too.
  • The first way, I thought, was easier to read. You made the long middle sentence even longer with more "big' words. And the original seemed to have a lighter tone.
  • OK Lets see,
    • Original
      • "travels over the same area the previous "_FAST" command covered."
    • Current
      • "now applies to the first "_FAST" command"
    • If the Original is no good how about
      • "now backs up in the space the first "_FAST" command had already traveled."
    • Or something else..
Larek 14:55, 13 November 2009 (UTC)


Take a look at Wikipedia's graphic for "Fencepost" errors, a kind of off-by-one error. It's practically identical to what we're discussing here. Just like you can cover N-1 sections with N posts, you only need to move N-1 times to designate N tiles. If you think the phrase is too technical or obscure, that's one thing, but I don't think there's any question that it's applicable.
I like your "now backs up in the space...". I'll add that now, along with "jump".
--HebaruSan 16:25, 13 November 2009 (UTC)