Make a zero-based version of Snap!

Idea for someone :slight_smile:

Make a fork of Snap! that uses zero-based indexing instead of 1-based :slight_smile:

So instead of taking in Scratchers and getting them to use Snap!, we could attract JavaScript or Python or even C programmers who think the 1st item in a list is called the zeroth one :slight_smile:

#TongueInCheekPost :slight_smile:

interesting idea

Untitled script pic (17)

challenge accepted

Can we have it by Christmas please? :slight_smile:

And, as a practical note - fork from the dev branch :slight_smile:

where can i find that?

I think if you don't know where that is then your possibly not the person for the task

This is really a project for someone who's had some experience in playing around with the Snap! source code

i'm just not used to the branch system but i figured it out (i'm blind and couldn't see the "branches" button)

Fair enough :slight_smile:

The site can be a bit obscure :slight_smile:

Apart from the obvious stuf like making the numbers reporter default to 0 to 9 instead of 1 to 10 and other stuff, one thing that occurs to me is that Snap! often returns 0 if it doesn't find anything

Or it returns the "empty string" which will get interpreted as 0 so that may be a bit tricky to deal with

Good Luck :slight_smile:

These are the only blocks that are affected, I suppose:

untitled script pic 181

They are easily rewritable in Snap! itself, e.g.:

The only difficulty I expect is what INDEX OF () IN () should return signifying β€œnot found” (it’s 0 now, but that will be taken)

I think our posts crossed in the ether :slight_smile:

Quite a bit could be done without source alteration but that's a different exercise from what I was thinking.

But more Snappish of course :slight_smile:

But I meant this as an exercise for some young snapper cause a lot of them want to make mods but sometimes there isn't a particular useful goal of doing so

And they often stop.

But if @coder_07 stops half-way, then it could be picked up by someone else and carried on

It'll be interesting to see where this goes :slight_smile:

i just had a new idea: keep the old lists, but also add the new 0-based ones

NO :slight_smile:

But you can do what you want :slight_smile:

My original idea is to make Snap! look exactly the same but that indices start at 0 and not 1 as most other languages do

For example - if you do the Advent of Code challenges, a lot of puzzles will assume the language your programming in is Zero-based. And therefore doing them in Snap! adds an extra overhead to solving them

well, i was thinking just keep them in dev for... you know... compatibility
and name the new ones "array" instead of "list" to avoid confusion with the old blocks

whoops, i think i broke something

this is cool however, why?

my image or the 0-based lists?

the 0 based lists, i mainly want to know what the motivation behind this is. the main post isnt very descriptive in that reguard