ICS 32 Fall 2018 |??|??|??|??|??|?
ICS 32 Fall 2018
Project #2:?Send Me On My Way
Due date and time:?Friday, October 26, 11:59pm
This project can either done using “pair programming” or individually
There are relatively few interesting programs written in any programming language that are completely self-contained; almost any program you can think of that would fit the description of being “interesting” in some way will either read its input from or write its output to some source external to the program. This is what allows us to use the same program to solve different problems — albeit different problems of the same type — and to use those solutions in other programs.
You’ve no doubt seen, both in previous coursework and in this course, that one way for a program to take external input is to read it from a file. This is the principle at work when you start a word processor like Microsoft Word by double-clicking on a document stored on your hard drive: The word processor is opened, then it reads the document and displays its contents, along with whatever formatting or art is included within it. Of course, word processors would be much less useful if they were incapable of opening existing documents.
However, files aren’t where the story ends. Programs are capable of reading input and writing output in other ways, too, and learning how to use other mechanisms in Python programs pushes out the boundaries around what we can accomplish. Think about the programs you use every day; it doesn’t take long to realize that the ones that hold your interest most strongly, that enable the most exciting outcomes, are those that read their input and write their output by connecting to other computers somewhere else in the world via the Internet. We use many programs every day that do this: web browsers, email clients, mobile applications, multiplayer games, and more. So we should want to be able to do the same in the programs we write in Python.
This project allows you to take a first step into a more connected world by introducing you to the use of?sockets, objects in Python that represent one end of a connection between one program and another — the other might be on the same machine, on another machine in the same room, or on a machine halfway across the world. You’ll learn about the importance of?protocols?in the communication between programs, and will implement a game that you can play either standalone (on your own computer) or via your Internet connection.
Along the way, you’ll also be introduced in more detail to the use of?modules?in Python, and to writing programs that are made up of more than one module, a technique that we’ll revisit repeatedly as the size and complexity of the programs we write begins to increase. You’ll find that the design decisions you make, such as keeping functions small and self-contained, organizing your functions and other code by putting it into appropriate modules, will be an important part of being able to complete your work. Additionally, you’ll use a small library that I’m providing in order to seed your work on the project.
Be sure to look through the??related to sockets and the Internet as we continue covering these topics in lecture; they will provide the background that you’ll need in order to implement that part of your program.