Administrative toolbar

3. The Logic of Programming

Key Concepts

In the chapter you will
- Be introduced to algorithms, loops and programs
- Learn that random numbers are not random in a computer
- See that the order in which you give commands to a computer matters


Introduction

Figure 1. Computer programming. [Source]

A computer is basically a large number of electric switches that are either turned on or off. To program a computer we have to develop a way to communicate in binary code: 0 and 1. Computer languages like Java or C++ do this kind of translation for you. Nevertheless, it is helpful to know that a computer is just a large number of on/off statements. In order to get the computer to do what you want you have to be precise in the commands you give it.

This chapter provides a background to programming before we focus on NetLogo, the programming platform used in this book, in the next chapter.