Jump to content
IGNORED

Determining the bits needed


Tl20N

Recommended Posts

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 by Tl20N
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...