Code is being modified when I post it

Announcements, comments, ideas, feedback, and "How do I... ?" questions
Post Reply
perito
Posts: 2
Joined: Tue Mar 25, 2008 12:20 pm

Code is being modified when I post it

Post by perito »

I solved problem 15 using Java coding and I posted my code, and I was reviewing it to compare it with other answers and my code was modified...
it seems its remove consecutive [][] which mean 2-dimensional array in Java
I removed the [ CODE ] tags but it still did the same thing :S
this is my original code

*************************************
if (i==1) path[j]=i;
else if (i==paths/2) path[j]=2*path[j][i-1];
else path[j]= path[j][i-1] + path[j-1];
finalPath=j;
}
}
for(int i=1;i<43;i++)
routes+=path[finalPath];
*************************************

this is what its changing to

*************************************
if (i==1) path[j]=i;
else if (i==paths/2) path[j]=2*path[j][i-1];
else path[j]= path[j][i-1] + path[j-1];
finalPath=j;
}
}
for(int i=1;i<43;i++)
routes+=path[finalPath];
*************************************
User avatar
euler
Administrator
Posts: 5094
Joined: Sun Mar 05, 2006 4:49 pm
Location: Cheshire, England
Contact:

Re: Code is being modified when I post it

Post by euler »

The problem is that is being interpreted as a BBCode for italics. Other variables to watch out for are = bold, [r] = red, [g] = green. You can see all the custom tags here: http://projecteuler.net/forum_tags.htm.
Image
impudens simia et macrologus profundus fabulae
perito
Posts: 2
Joined: Tue Mar 25, 2008 12:20 pm

Re: Code is being modified when I post it

Post by perito »

can I turn it off somehow?
or should I never use the varaible i again :?
User avatar
daniel.is.fischer
Posts: 2400
Joined: Sun Sep 02, 2007 11:15 pm
Location: Bremen, Germany

Re: Code is being modified when I post it

Post by daniel.is.fischer »

You could choose other variables for array indexing (e.g. replace all open-bracket-i-close-bracket with [i1] or ) or include spaces [ i ]. Probably the former is preferable.
Il faut respecter la montagne -- c'est pourquoi les gypa&egrave;tes sont l&agrave;.
User avatar
euler
Administrator
Posts: 5094
Joined: Sun Mar 05, 2006 4:49 pm
Location: Cheshire, England
Contact:

Re: Code is being modified when I post it

Post by euler »

This does all raise the more general question, Do we need formatting tags at all? Should I remove the tags: , , [r], and [g], or should I replace them with something more explicit, like, [italic], [bold], [red], [green]?

After all, the main purpose of that forum is to discuss the method and, when necessary, post code. So do we need to italicise or embolden at all? I can see the benefits of these, and I know members have previously used red and green in their expositions. If we did change them to the more specific tag names I could do a database wide search and replace on the old tags so that those posts still view correctly.
Image
impudens simia et macrologus profundus fabulae
User avatar
Tommy137
Posts: 238
Joined: Sun Feb 24, 2008 6:02 pm
Location: Cologne, Germany
Contact:

Re: Code is being modified when I post it

Post by Tommy137 »

Isn't it possible to turn them off in between

Code: Select all

-tags?
Image
User avatar
daniel.is.fischer
Posts: 2400
Joined: Sun Sep 02, 2007 11:15 pm
Location: Bremen, Germany

Re: Code is being modified when I post it

Post by daniel.is.fischer »

I think having a means for adding emphasis is good. Make that [italics] by all means, 'italics' is very unlikely to be an array index 8-)
Il faut respecter la montagne -- c'est pourquoi les gypa&egrave;tes sont l&agrave;.
User avatar
euler
Administrator
Posts: 5094
Joined: Sun Mar 05, 2006 4:49 pm
Location: Cheshire, England
Contact:

Re: Code is being modified when I post it

Post by euler »

That was a nightmare! I've fixed the problem. hk reminded me that I solved this problem once before, but could I remember? Talk about re-inventing the wheel... it was only after I figured out the problem that it all came back to me. Typical!

Anyway, the good news is that all formatting tags no longer render as formatting tags between the [ code ] tags and will appear as they are typed.
Image
impudens simia et macrologus profundus fabulae
Post Reply