/-/S'pht-Translator-Active/-/


Re: PID for OS X
Posted By: Ron HunsingerDate: 4/19/13 7:33 p.m.

In Response To: Re: PID for OS X (Mark Levin)

: Thanks to both of you for all this information. I'll try to put in a more
: conforming string recognizer if I find the time.

If you do, I hope you'll fix the bug that makes the program ignore all but the last word of what you type.

I know you want to maintain bug-for-bug compatibility, but when we know what they intended, and it's not doing that but only because of a silly programming mistake, I think their intention should prevail over what last shipped.

(I'm still hoping you'll relent and scatter the spheres around Labyrinth better. That's what the code they wrote tried to do, and it's only failing because of a non-obvious interaction between their RNG and the way they're using it. I also worry that the program may even go into an infinite loop trying to populate Labyrinth. Not counting the edges, a level has 900 cells, about half of which are rock walls in Labyrinth. They tried to scatter across all 900 of those cells, but only actually consider 58 of them. If more than 38 of those 58 are unavailable, they'll loop forever trying to find places for 20 spheres.)

The fix I'm hoping for is a small one. The existing code looks like (using my own names because I don't know the real ones:

void PopulateLabyrinth() {
CellPoint p;
CellInfoPtr cell;
int n;
for (n = 0; n < 20; ++n) {
do {
p.x = Random() % 32;
p.y = Random() % 32;
cell = CellAtPoint(p);
} while ((cell->cellType != kCelltypeOpen) || (cell->firstObject != noObject));
... put a Shocking Sphere at the center of cell (x,y) ... }}

Just change the lines calling Random() to:

t = Random() % 900;
p.x = t / 30 + 1;
p.y = t % 30 + 1;

The immediate effect is that x and y will never be set to 0 or 31, but such cells contain rock and would be rejected anyway. The important effect is that with the RNG they're using, the values returned by successive calls are strongly correlated. Getting x and y from different parts of a single random number decouples them from that correlation. I've run simulations using this code, and the results are quite good. (Don't worry. Because of the vagaries of randomness, you still get, shall I say interesting(?), clusters of spheres. It will still sometimes be exciting.)

Their original code only looks at cells where y==x/2 or y==x/2+16. I once suggested generating each of x and y as Random() % 30 + 1, which turns out to be some better but not by much. (It considers only 270 cells out of 900 instead of 58 out of 900.) Simulations show it's actually pretty bad. I no longer recommend it.

The important point is that the code they wrote shows clearly that they intended the spheres to scattered. Their intent should (IMHO) prevail over what they happened to ship last.

[ Post a Reply | Message Index | Read Prev Msg | Read Next Msg ]
Pre-2004 Posts

Replies:

PID for OS XGodot 4/9/13 7:02 a.m.
     Re: PID for OS Xtreellama 4/9/13 7:39 a.m.
     Re: PID for OS XMark Levin 4/9/13 8:28 a.m.
           Re: PID for OS XDestiny 4/9/13 8:49 a.m.
           Re: PID for OS XHopper 4/9/13 10:03 a.m.
                 Re: PID for OS XMark Levin 4/9/13 10:28 a.m.
           Re: PID for OS Xlucas93 4/9/13 3:08 p.m.
           Re: PID for OS XYossarian 4/9/13 3:59 p.m.
           Re: PID for OS Xselbstmord 4/11/13 7:40 a.m.
                 Re: PID for OS XPresident People 4/11/13 3:00 p.m.
                       Re: PID for OS Xukimalefu 4/11/13 11:38 p.m.
                             Re: PID for OS XPerseusSpartacus 4/12/13 12:04 a.m.
     Re: PID for OS XPerseusSpartacus 4/9/13 8:25 p.m.
     Re: PID for OS Xukimalefu 4/10/13 12:17 a.m.
           Re: PID for OS XGodot 4/10/13 12:34 a.m.
                 Re: PID for OS Xukimalefu 4/10/13 12:36 a.m.
                 Re: PID for OS XMark Levin 4/10/13 6:08 a.m.
                       Re: PID for OS XGodot 4/10/13 6:29 a.m.
                             Re: PID for OS XGodot 4/10/13 6:32 a.m.
                       Re: PID for OS XHopper 4/10/13 7:31 a.m.
                             Re: PID for OS XMark Levin 4/10/13 8:20 a.m.
     Re: PID for OS XPerseusSpartacus 4/10/13 9:22 a.m.
           Re: PID for OS XHopper 4/10/13 11:07 a.m.
                 Re: PID for OS XPerseusSpartacus 4/10/13 11:21 a.m.
     Re: PID for OS XMrM12LRV 4/10/13 2:29 p.m.
           SPOILER ALERT! You need to find thisukimalefu 4/11/13 2:08 a.m.
     Re: PID for OS XRon Hunsinger 4/15/13 7:53 p.m.
           Re: PID for OS XMark Levin 4/16/13 6:54 a.m.
                 Re: PID for OS XRon Hunsinger 4/16/13 5:21 p.m.
                       Re: PID for OS XMark Levin 4/16/13 6:00 p.m.
                             Re: PID for OS XRon Hunsinger 4/16/13 7:50 p.m.
                                   Re: PID for OS XMark Levin 4/16/13 8:46 p.m.
                                   Re: PID for OS XHopper 4/17/13 6:11 a.m.
                                         Re: PID for OS XMark Levin 4/17/13 7:16 a.m.
                                               Re: PID for OS XHopper 4/17/13 8:14 a.m.
                                         Re: PID for OS XRon Hunsinger 4/18/13 1:01 a.m.
                                               Re: PID for OS XRon Hunsinger 4/18/13 1:09 a.m.
                                               Re: PID for OS XHopper 4/19/13 7:32 a.m.
                                                     Re: PID for OS XMark Levin 4/19/13 8:28 a.m.
                                                           Re: PID for OS XRon Hunsinger 4/19/13 7:33 p.m.
                                         Re: PID for OS XRon Hunsinger 4/18/13 3:11 a.m.
                 Re: PID for OS XHopper 4/17/13 7:01 a.m.
                       Re: PID for OS XMark Levin 4/17/13 7:12 a.m.
                             Re: PID for OS XHopper 4/17/13 7:50 a.m.
     Re: PID for OS XPerseusSpartacus 4/18/13 8:14 p.m.
           Re: PID for OS Xukimalefu 4/19/13 2:41 a.m.
           Re: PID for OS XRon Hunsinger 4/19/13 4:10 a.m.
                 Re: PID for OS XPerseusSpartacus 4/19/13 6:31 p.m.
                       Re: PID for OS XRon Hunsinger 4/19/13 7:55 p.m.
                             Re: PID for OS Xtreellama 4/20/13 5:11 a.m.
                             Re: PID for OS XPerseusSpartacus 4/20/13 9:38 a.m.
     Re: PID for OS Xbakudd 4/22/13 6:39 a.m.
     PID 1.2 releasedMark Levin 5/6/13 8:49 p.m.
           Re: PID 1.2 releasedGodot 5/6/13 10:47 p.m.
                 Re: PID 1.2 releasedHopper 5/7/13 10:31 a.m.
           Re: PID 1.2 releasedukimalefu 5/7/13 1:45 a.m.

[ Post a Reply | Message Index | Read Prev Msg | Read Next Msg ]
Pre-2004 Posts

 

 

Your Name:
Your E-Mail Address:
Subject:
Message:

If you'd like to include a link to another page with your message,
please provide both the URL address and the title of the page:

Optional Link URL:
Optional Link Title:

If necessary, enter your password below:

Password:

 

 

Problems? Suggestions? Comments? Email maintainer@bungie.org

Marathon's Story Forum is maintained with WebBBS 5.12.