Java-Gaming.org
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
Featured games (78)
games approved by the League of Dukes
Games in Showcase (408)
games submitted by our members
Games in WIP (293)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  What's the next number in the sequence  (Read 1950 times)
0 Members and 1 Guest are viewing this topic.
Offline Riven
« League of Dukes »

JGO Overlord


Medals: 439
Projects: 4


Hand over your head.


« Posted 2006-11-15 22:49:01 »

I was writing this LOD algorithm and found a certain sequence of values (by trial and error) for culling
the quads in the center, to make place for a higher LOD. Ofcourse the numbers became too hard to
narrow down in the following LODs, so I needed the formula!

So far for the introduction-story, which can be forgotten right away.


For this who like silly math assignments...


Give me the next 2 numbers of this sequence.

1  
2, 6, 26, 114, ..., ..., etc


It's a nasty one, and took me 15 minutes. Now I wonder what others come up with Smiley

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Projects: Revenge of the Titans, Titan Attacks, Droid Assault, and Ultratron
Offline zero

Junior Member





« Reply #1 - Posted 2006-11-15 23:49:56 »

one solution should be:

2^(2*n+1) - 2^(n+1) + 2   for n elem |N_0

sorry, I'm to lazy to put in n=4,5

took me also about 15min without a calculator (5 min for the formula and 10 min proof Undecided)

would have been faster but I thought of 2^prim(2+n) - .. because you sad it's a nasty one ;-)
Offline Riven
« League of Dukes »

JGO Overlord


Medals: 439
Projects: 4


Hand over your head.


« Reply #2 - Posted 2006-11-16 00:20:30 »

I started with 1 instead of 0 (because of how the algorithm works).

1  
2  
|N_0 = 2^(2*n+1) - 2^(n+1) + 2
|N_1 = 2^(2*n-1) - 2^n + 2


Saves 1 addition Wink


I solved it during a chat-session about something else, got kinda hard to concentrate.

This is the first time I encountered a numeric-sequence that wasn't too obvious...


I hope it enjoyed your neurons a bit.

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Projects: Revenge of the Titans, Titan Attacks, Droid Assault, and Ultratron
Games published by our own members! Check 'em out!
Try the Free Demo of Titan Attacks
Offline ChrisM

JGO Coder


Medals: 1
Projects: 1


END OF LINE.


« Reply #3 - Posted 2006-11-16 00:51:57 »

OUCH!  Just stubbed my brain....

-Chris

Offline tusaki

Junior Member




In a mad world only the mad are sane.


« Reply #4 - Posted 2006-11-16 01:16:01 »

that's a nice formula.

now I want an explanation how it works Grin
Offline Riven
« League of Dukes »

JGO Overlord


Medals: 439
Projects: 4


Hand over your head.


« Reply #5 - Posted 2006-11-16 01:35:32 »

Well.... if I'd say that it's top-secret, I'd lie.

Consider a grid of cells,
with inside it, another grid of smaller cells,
with inside it, another grid of smaller cells,
with inside it, another grid of smaller cells,
etc.

Which 'center cells' inside the LOD should be culled to prevent overlap?
That's what this formula calculates.

BTW, the placement of the lower LOD-grids, is corrected (snapped) by:

1  
2  
3  
4  
5  
6  
7  
8  
for (int lod = 0; lod < lods; lod++)
{
   for (int k = 0; k <= lods; k++)
   {
      x -= (((xCameraTile >> k) & 1)) << k;
      z -= (((zCameraTile >> k) & 1)) << k;
   }
}


If there would be a direct formula for that one... I'd be thrilled, but I wouldn't really need it Smiley


I create this kind of black-magic code (for me at least) by writing out the LOD-math for a few levels,
then searching for patterns, transforming it into formulas, where the formula's don't make much
sense to me, to be honest. In the documentation I write how I created them.

I just don't have the time to examin what really happens. Not really interested either Tongue

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Projects: Revenge of the Titans, Titan Attacks, Droid Assault, and Ultratron
Offline Falken

Senior Newbie




biggidy bong


« Reply #6 - Posted 2006-11-16 01:42:33 »

Great. Now for your next challenge.
Could you tell me the next 7 numbers in this sequence... http://www.lottery.co.uk/euro-millions.htm  Cheesy
Offline Riven
« League of Dukes »

JGO Overlord


Medals: 439
Projects: 4


Hand over your head.


« Reply #7 - Posted 2006-11-16 01:44:30 »

4, 8, 15, 16, 23, 42 and the age of your imaginairy friend.

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Projects: Revenge of the Titans, Titan Attacks, Droid Assault, and Ultratron
Offline Falken

Senior Newbie




biggidy bong


« Reply #8 - Posted 2006-11-16 02:05:43 »

LOL. Thanks.  If I win, you can have my Oceanic flight tickets to Los Angeles. Grin
Offline darkprophet

Senior Member




Go Go Gadget Arms


« Reply #9 - Posted 2006-11-16 02:51:33 »

Oh god...not Lost! Its haunting me to this day...

* darkprophet closes ears and runs shouting BLAH BLAH BLAH BLAH BLAH BLAH BLAH

Friends don't let friends make MMORPGs.

Blog | Volatile-Engine
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
 
Browse for soundtracks for your game!

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

The invasion has landed! On Mars! And you're there to beat 'em!
cubemaster21 (143 views)
2013-05-17 21:29:12

alaslipknot (151 views)
2013-05-16 21:24:48

gouessej (182 views)
2013-05-16 00:53:38

gouessej (175 views)
2013-05-16 00:17:58

theagentd (184 views)
2013-05-15 15:01:13

theagentd (169 views)
2013-05-15 15:00:54

StreetDoggy (214 views)
2013-05-14 15:56:26

kutucuk (239 views)
2013-05-12 17:10:36

kutucuk (237 views)
2013-05-12 15:36:09

UnluckyDevil (242 views)
2013-05-12 05:09:57
Complex number cookbook
by Roquen
2013-04-24 12:47:31

2D Dynamic Lighting
by Oskuro
2013-04-17 16:46:12

2D Dynamic Lighting
by Oskuro
2013-04-17 16:45:57

2D Dynamic Lighting
by Oskuro
2013-04-17 16:23:20

Noise (bandpassed white)
by Roquen
2013-04-05 17:36:01

Noise (bandpassed white)
by Roquen
2013-04-03 16:17:38

Java Data structures
by Roquen
2013-03-29 13:21:12

Topic Request
by kutucuk
2013-03-22 21:42:01
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!
Page created in 0.128 seconds with 20 queries.