Player "0" - Does it make sense?

Other talk that doesn't fit elsewhere.
This is for General Discussion, not General chat.
User avatar
aubergine
Professional
Professional
Posts: 3459
Joined: 10 Oct 2010, 00:58
Contact:

Re: Player "0" - Does it make sense?

Post by aubergine » 25 Jan 2012, 12:38

Ah, Kanji (IIRC) - now we can have ~400,000 players referenced with a single character! yay!
"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO

Jorzi
Regular
Regular
Posts: 2053
Joined: 11 Apr 2010, 00:14

Re: Player "0" - Does it make sense?

Post by Jorzi » 25 Jan 2012, 12:53

About stating from 0 in programming:
http://xkcd.com/163/
ImageImage
-insert deep philosophical statement here-

User avatar
aubergine
Professional
Professional
Posts: 3459
Joined: 10 Oct 2010, 00:58
Contact:

Re: Player "0" - Does it make sense?

Post by aubergine » 25 Jan 2012, 12:55

<3 xkcd
"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO

User avatar
Iluvalar
Regular
Regular
Posts: 1811
Joined: 02 Oct 2010, 18:44

Re: Player "0" - Does it make sense?

Post by Iluvalar » 25 Jan 2012, 19:09

stiv wrote:

Code: Select all

for i := 0; i++ < count; {
 [do Something]
}
A fine example of Stuff You Should Never Do.
Sometime, i felt it was necessary to distinguish, "NULL" from "UNKNOWN" to respect the third codd rule. You have another solution ?
Heretic 2.3 improver and proud of it.

stiv
Warzone 2100 Team Member
Warzone 2100 Team Member
Posts: 876
Joined: 18 Jul 2008, 04:41
Location: 45N 86W

Re: Player "0" - Does it make sense?

Post by stiv » 25 Jan 2012, 23:11

Sometime, i felt it was necessary to distinguish, "NULL" from "UNKNOWN" to respect the third codd rule.
This has nothing to do with null values and everything thing to do with loops and indexing. Try and focus.
You have another solution ?
Yeah, do not do weird stuff like this lest you find yourself hunted for sport by your co-workers in general, and maintenance programmers in particular. If you want the loop to start at one, start it at one and don't be cute. And no side effects, please.

User avatar
aubergine
Professional
Professional
Posts: 3459
Joined: 10 Oct 2010, 00:58
Contact:

Re: Player "0" - Does it make sense?

Post by aubergine » 25 Jan 2012, 23:22

I tend to iterate through lists backwards just because I like the way the code looks:

Code: Select all

var x= someArray.length;
while (-1<--x) { // "x" marks the spot (:
  // do stuff with someArray[x]
}
I should probably invest in some body armour?
"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO

User avatar
lav_coyote25
Professional
Professional
Posts: 3434
Joined: 08 Aug 2006, 23:18

Re: Player "0" - Does it make sense?

Post by lav_coyote25 » 25 Jan 2012, 23:50

well, from what i have seen here over the last few days, should this topic not be in the lounge? lets face it, its one of those topics where no one can agree, except to disagree. right? :annoyed:

stiv
Warzone 2100 Team Member
Warzone 2100 Team Member
Posts: 876
Joined: 18 Jul 2008, 04:41
Location: 45N 86W

Re: Player "0" - Does it make sense?

Post by stiv » 26 Jan 2012, 03:07

where no one can agree, except to disagree. right?
Cantankerous bunch we are, we pro'lly don't even agree on that!

Personally, I love software archeology. Always interesting to understand "How did this curious situation come about?"

User avatar
aubergine
Professional
Professional
Posts: 3459
Joined: 10 Oct 2010, 00:58
Contact:

Re: Player "0" - Does it make sense?

Post by aubergine » 26 Jan 2012, 06:07

some awesome for loop stuff in javascript: http://javascriptweblog.wordpress.com/2 ... for-loops/
"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO

User avatar
milo christiansen
Regular
Regular
Posts: 749
Joined: 02 Jun 2009, 21:23
Location: Perrinton Michigan

Re: Player "0" - Does it make sense?

Post by milo christiansen » 26 Jan 2012, 18:35

In which the use of for-loops will evolve from the familiar to the slightly nutty. The intent is to demonstrate the flexibility of the construct and the power of the language – not to provide best practice templates
"slightly nutty"? Some of the examples are downright insane!

Cool, but insane :P
In general, if you see glowing, pulsating things in the game, you should click on them.
- Demigod Game Ganual

Cyp
Evitcani
Evitcani
Posts: 773
Joined: 17 Jan 2010, 23:35

Re: Player "0" - Does it make sense?

Post by Cyp » 26 Jan 2012, 18:59

Code: Select all

	int _ = +-~-~-~-~-~-~-~-~-~-~+ 0;
	while (+~-_---~+ 0)
		printf("%d\n", _);

User avatar
aubergine
Professional
Professional
Posts: 3459
Joined: 10 Oct 2010, 00:58
Contact:

Re: Player "0" - Does it make sense?

Post by aubergine » 26 Jan 2012, 19:16

@Cyp how on earth does that resolve to 9876543210 ?

EDIT: Here's the Javascript equivalent of that code if anyone wants to test it in a browser:

Code: Select all

var _ = Number(+-~-~-~-~-~-~-~-~-~-~+ 0);
   while (+~-_---~+ 0)
      document.write(_);
"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO

User avatar
milo christiansen
Regular
Regular
Posts: 749
Joined: 02 Jun 2009, 21:23
Location: Perrinton Michigan

Re: Player "0" - Does it make sense?

Post by milo christiansen » 26 Jan 2012, 19:41

try

Code: Select all

javascript:var _ = Number(+-~-~-~-~-~-~-~-~-~-~+ 0); while (+~-_---~+ 0)document.write(" " + _)
In general, if you see glowing, pulsating things in the game, you should click on them.
- Demigod Game Ganual

User avatar
Saberuneko
Regular
Regular
Posts: 558
Joined: 15 Jan 2010, 18:20
Contact:

Re: Player "0" - Does it make sense?

Post by Saberuneko » 06 Feb 2012, 14:05

milo christiansen wrote:It makes perfect sense to a programmer :P
It does :3

User avatar
Emdek
Regular
Regular
Posts: 1329
Joined: 24 Jan 2010, 13:14
Location: Poland
Contact:

Re: Player "0" - Does it make sense?

Post by Emdek » 06 Feb 2012, 14:58

Not always, AFAIK COBOL starts from 1. ;-)
Nadszedł już czas, najwyższy czas, nienawiść zniszczyć w sobie.
The time has come, the high time, to destroy hatred in oneself.


Beware! Mad Qt Evangelist.

Post Reply