You can maybe improve the real-world performance with some assumptions or problem knowledge. But O(1) seems kind of unlikely with a search approach.
You can maybe improve the real-world performance with some assumptions or problem knowledge. But O(1) seems kind of unlikely with a search approach.
It's not even a valid name
It's not even a valid name
The bigger horizontal margins are only needed because players hit different angles on different hardware. And then it's no wonder the downwards movements are whiffed, as the zones are so small they force a precise base switch.
The bigger horizontal margins are only needed because players hit different angles on different hardware. And then it's no wonder the downwards movements are whiffed, as the zones are so small they force a precise base switch.
c=0
loop:
c += 3*(n-2*i)
if (x < c) return i
i++
This is the version that I started out with, that works for uneven cases like x=5. The idea is to iteratively add the number of nodes in each shell and check if the index has been reached yet. Then return the counter of the current shell.
c=0
loop:
c += 3*(n-2*i)
if (x < c) return i
i++
This is the version that I started out with, that works for uneven cases like x=5. The idea is to iteratively add the number of nodes in each shell and check if the index has been reached yet. Then return the counter of the current shell.
i=0
c=0
loop:
inc = 3*(n-2*i)
if (inc == 0):
c += 1
if (x < c) return i
return "x out of bounds"
c += inc
if (x < c) return i
i++
The special case handling is making the loop more ugly ;-;
i=0
c=0
loop:
inc = 3*(n-2*i)
if (inc == 0):
c += 1
if (x < c) return i
return "x out of bounds"
c += inc
if (x < c) return i
i++
The special case handling is making the loop more ugly ;-;
(I only call them advanced because beginners usually dont use them)
(I only call them advanced because beginners usually dont use them)
spiff.rit.edu/classes/phys...
spiff.rit.edu/classes/phys...
My wild guess is 1/3, since I remember that number was relevant in pyramids, but dunno c:
My wild guess is 1/3, since I remember that number was relevant in pyramids, but dunno c:
The only areas of improvement I can think of:
- tools to make software cheaper/'safer'
- mapping the algorithm to hardware as efficiently as possible
- changing the algorithm (as in your routing example)
The only areas of improvement I can think of:
- tools to make software cheaper/'safer'
- mapping the algorithm to hardware as efficiently as possible
- changing the algorithm (as in your routing example)
I see that hasn't changed in 43 years.
I see that hasn't changed in 43 years.
Afaik Lua arrays are actually dictionaries and it doesn't care if you use 0 or 1 as the first index.
www.lua.org/pil/11.1.html
Afaik Lua arrays are actually dictionaries and it doesn't care if you use 0 or 1 as the first index.
www.lua.org/pil/11.1.html