AP CSP Day 8_9_13-16

AP CSP: The Need for
Addressing
SEPTEMBER 13, 2016
Introduction: Battleship!!

So far we’ve created protocols to send simple binary information(A or B)
and since then we’ve developed more robust protocols to communicate
more specific information(Coordinates/Lines and Text Formats).

In all those protocols we were only communicating with one person
though. Obviously the Internet is not just a single wire with direct
communication between sender and receiver. Today we’re going to play
a game to try and handle this issue.

First we are going to play a game of Battleship but instead of playing
against one person you will play against multiple enemy combatants at
the same time.
Paper Battleship Rules:

You will play in groups of 3(Possibly 4). The board you will be using is 3x3
and for right now we are just using paper and pencil to play.

Ships are two units long. You will draw one ship for each opponent you
face in the “My Board” box. You can not have diagonal ships. The “Their
Board” box is used to mark at which coordinates that you either hit or
missed their ships. Record each hit with an “X” and a miss with an “O”

You can have a different ship placement for each opponent. Good Luck!
Battleship Transition:

Now that we understand the mechanics of the game. We are now going
to continue this game using the Internet simulator. All the reals still apply in
terms of how battleship works but now there is one major change.

You cannot communicate with each other at all unless it is through the
Internet simulator. No talking at all! Figure it out!

No talking! We will continue playing for awhile and then you will get a
chance to talk and collaborate before trying again.
Battleship Protocol Development:

Now that you have struggled for a bit and seen the challenges in playing the game
without communicating, you and your group will develop a protocol that will allow
you to play seamlessly without physical communication.

Think about these questions when developing your protocol:


What protocol have they been using? Did they have a protocol at all?

How can they standardize their communication?

How do they make their message as clear as possible?

How do they make their message as efficient (short/easy to interpret) as possible?
Your protocol makes the game harder to play as a human but the point is to allow
for a computer to do this flawlessly.
Binary Protocol for Battleship:

Now that you have created your own protocol using ASCii characters,
now we are going make this protocol a little more complex. Now you are
going to create an efficient binary protocol for playing battleship.

Let “efficient” mean that your protocol uses the smallest reasonable
number of bits (0s and 1s) to make messages for Battleship that still
contain all of the necessary information for playing the game.

Think about these types of questions when developing your protocol:

How will you standardize the recipient and sender addresses?

Should you encode people’s names or (hint) use a number?

How would a recipient of your message know where address ends and the
other begins?

What other information do you need to include?
Wrap-up:

When creating a binary protocol for Battleship you probably figured you
needed to encode some type of sender and receiver address. It turns out
computers on the Internet are addressed in a similar way to phones for
many of the same reasons. The real addresses used on the Internet are
called “Internet Protocol Addresses” or IP Addresses for short.

For a short activity, figure out your own IP address. The easiest way to
accomplish this is to google “What is my IP address”. That may not be
completely correct since your all connected to the same router. Figure it
out. Also you can head to Wikipedia and learn more about the IPv4
addressing system.
Vocabulary:

IP Address - A number assigned to any item that is connected to the
Internet.

Packets - Small chunks of information that have been carefully formed
from larger chunks of information.

Protocol - A set of rules governing the exchange or transmission of data
between devices.