Welcome to GameHourz.com!
FAQFAQ      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

Bug in pMARS

 
   Game Forums (Home) -> Core War RSS
Next:  My downloads are gone???  
Author Message
Jens Gutzeit

External


Since: Jul 24, 2005
Posts: 25



(Msg. 1) Posted: Mon Mar 06, 2006 6:29 am
Post subject: Bug in pMARS
Archived from groups: rec>games>corewar (more info?)

Hi,

either I don't know how EQUs work or I have found
a bug in the parser of pMARS. So far I cound pin
it down to:

;redcode-tiny
;name test
;assert CORESIZE == 800

v3 EQU 3 * (3 / 2 + 1) + 3
v4 EQU (CORESIZE - v3)

dat.f v3, v4

With the settings for tiny pMARS' parses it to:

dat.f $ 9, $ -9

The value for v3 is correct, but v4 is wrong. It should
be

(800 - 3 * (3 / 2 + 1) + 3) = 800 - 3 * 2 + 3 = 797 = -3

The confusing part is, that in the debug output pMARS
seems to correctly replace the v3 in v4:

After pass 1
Instruction (physical line, instr):

( 11) DAT.f 3*(3/2+1)+3,(800 -3*(3/2+1)+3)

Can somebody, who knows more about pMARS' parser,
please confirm it as a bug? And if it isn't a bug, why does
pMARS evaluate it that way?

By the way I found that problem in the warrior "Borkked"
(Tiny Hill at Koenigstuhl).

Regards,

Jens Gutzeit Smile

 >> Stay informed about: Bug in pMARS 
Back to top
Login to vote
Peter Duniho

External


Since: Mar 06, 2006
Posts: 4



(Msg. 2) Posted: Mon Mar 06, 2006 10:28 am
Post subject: Re: Bug in pMARS [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

"Jens Gutzeit" <jens.RemoveThis@jgutzeit.de> wrote in message
news:1141655358.942251.41770@i40g2000cwc.googlegroups.com...
> [...]
> Can somebody, who knows more about pMARS' parser,
> please confirm it as a bug? And if it isn't a bug, why does
> pMARS evaluate it that way?

It seems to me that -9 may be the correct output.

The term "v3" is apparently evaluated prior to being used for "v4". I see
no reason for this to not be a legitimate evaluation, since it more
logically follows what was written.

The way you evaluated the term is consistent with how a C preprocessor would
do it. That is, expanding all terms to their literal value before
performing the calculation. However, I never seen any C code that actually
relies on this behavior. In fact, most experienced C programmers
automatically put parentheses around their #define'd terms to ensure that
they are evaluated atomically.

I don't know what the specification for the language is, and if the
specification dictates that the EQU op be evaluated the same way a C
preprocessor would do it, then you're right, and it's a bug. But if there's
no such requirement, it seems to me that the behavior is a reasonable
choice, given that programmers commonly try to avoid the C preprocessor
default behavior at every opportunity.

As far as the debug output goes, it seems to me that at the very least, that
is buggy. After all, it should indicate what is actually happening,
otherwise it's not very useful as a debugging tool.

Pete

 >> Stay informed about: Bug in pMARS 
Back to top
Login to vote
sayembara

External


Since: Dec 22, 2005
Posts: 38



(Msg. 3) Posted: Mon Mar 06, 2006 1:57 pm
Post subject: Re: Bug in pMARS [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Peter Duniho wrote:
> It seems to me that -9 may be the correct output.
>
> The term "v3" is apparently evaluated prior to being used for "v4". I see
> no reason for this to not be a legitimate evaluation, since it more
> logically follows what was written.

That would be the answer.
pMARS may work like this:

Calculate v3.
v3=....=9
calculate v4.
v4=800-9 = -9
 >> Stay informed about: Bug in pMARS 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
Score Surface for 94nop - Hi, some anonymous person (still called "bvowk" for simplicity ;-) is so kind to provide access to a pile of computers. I have suggested to calculate one score surface for standard settings. It takes roughly 1000 times the time of one "no...

How should pMARS macros work? - (It's actually a followup to my month old thread, Google Groups won't let me post it there.) redcode.ref from my pMARS 0.8.6 distribution says that the assembly takes two passes: one to collect the labels and another to substitute them. However,..

pmars-server tournament mode/options ? - Hello, Does pmars-server have a tournament mode like corewin 2.3 ??? Also what does the output mean ? like: results: 0 1 0 0 0 0 Bye, Skybuck.

KOTH.ORG: Status - ICWS Experimental 94 03/06/06 - Weekly Status on 03/06/06 -=- irc.KOTH.org is up! Meetings held in #corewars -=- Tons of new features on www.KOTH.org/koth.html pages -=- *FAQ* page located at: www.KOTH.org/corewar-faq.html Current Status of the KOTH.ORG ICWS Experimental 94..

KOTH.ORG: Status - MultiWarrior 94 03/06/06 - Weekly Status on 03/06/06 -=- irc.KOTH.org is up! Meetings held in #corewars -=- Tons of new features on www.KOTH.org/koth.html pages -=- *FAQ* page located at: www.KOTH.org/corewar-faq.html Current Status of the KOTH.ORG Multiwarrior 94 CoreWar..
   Game Forums (Home) -> Core War All times are: Ekaterinburg, Islamabad, Karachi, Tashkent (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]