Tl20N Posted February 12, 2011 Share Posted February 12, 2011 (edited) I read to chapter two of Robert M's tutorial. I understand the idea behind binary, and was following along nicely. Until he gave the formula to figure out the number of bits needed in a given number of variations within a game. Here it is: The fomula for the number of combinations possible given N bits is: combinations = 2 ^ N = (2 to the power of N) So an enumeration of W items will require a minimum of: N = log2 (W) Exercises: ------------ Here are some real world examples of enumeration from Atari 2600 games. For each item calculate the minimum bits the program must use to keep track of the particular piece of information. 1. The catridge combat has 27 game variations, what is the minimum number of bits the combat program can use to keep track of the current variation? 2. The 112 game variations for Space Invaders. 3. The Atari 2600 Display is 160 pixels horizontally by 192 pixels vertically (NTSC) To position a player on the screen you must enumerate its horizontal and vertical position. How many bits are needed to store the horizontal and vertical positions of the player? 4. In Surround the "arena" is 40 blocks wide by 20 blocks high. Each block in the playfield is either filled or empty. How many bits are needed to remember the status of the playfield? How many bits are needed to remember the horizontal and vertical position of each player? I will post the answers in 24 hours. And even when he posted the answers, it went over my head. I don't understand the formula at all. Could someone please explain this to me? Edited February 12, 2011 by Tl20N Quote Link to comment Share on other sites More sharing options...

GroovyBee Posted February 12, 2011 Share Posted February 12, 2011 I'm not familiar with the tutorial but the formula :- N=log2(W) can be rewritten as :- N=log10(W)/log10(2) Which should be solvable on any scientific calculator. Quote Link to comment Share on other sites More sharing options...

diogoandrei Posted February 12, 2011 Share Posted February 12, 2011 N = log2 (W) It's something like this (some one corrects me if needed!): We have a logarithm on base 2 and variables N (number of bits) and W. So, if W is number of combinations, try reading the formula like this: What power will bring 2 (log on base 2) to come close to the value W? So, if I have N = log2 (8 ) What power will bring 2 close to 8? It's 3, because 2 to the power of 3 is 8. One more... N = log2 (32 ) 2 to the power of what number (N) will give us 32? Answer is 5. Being N the number of bits, that would take 5 bits. Quote Link to comment Share on other sites More sharing options...

GroovyBee Posted February 12, 2011 Share Posted February 12, 2011 Don't worry, Tl20N contacted me via PM and its been resolved. Quote Link to comment Share on other sites More sharing options...

diogoandrei Posted February 13, 2011 Share Posted February 13, 2011 cool Quote Link to comment Share on other sites More sharing options...

## Recommended Posts

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Note:Your post will require moderator approval before it will be visible.