WEEK01: intro to python, unix, cs21
-----------------------------------
M: Welcome to CS 21, about the course, etc
OVERVIEW:
- write lots of computer programs, learn some CS along the way
- learn PYTHON programming language
- labs/programs due every week
- meant for students without any CS/programming experience
- attending lab sessions and ninja sessions is optional
- you can also go to any lab session you want
ALGORITHM EXAMPLE:
can you solve rubik's cube? http://www.rubiks.com
can you write out a list of step-by-step instructions that
anyone could follow, that would allow them to solve rubik's cube??
an algorithm is like a recipe or list of instructions to follow
Here's an algorithm for solving rubik's cube:
rubik's cube algorithm
is it the "best" algorithm??
what do we mean by "best"??
is it the fastest algorithm?
is it the simplest algorithm?
is it in a form that the computer could understand?
TIC-TAC-TOE:
if I were writing a computer program to play the game of
tic-tac-toe (with a user), here's what it might look like:
draw the empty board
keep doing this over and over:
ask user to choose a spot
draw user's mark on board
check if the game is over: if yes, go to "print winner" line below
computer picks spot
draw computer's mark on board
check if the game is over: if yes, go to "print winner" line below
go back to "ask user" line above
print the winner, game over...
can you think up an algorithm that the
computer could follow to pick it's spot???
how do we "check if the game is over"???
what do we ask the user to input to choose their spot??
a number? some text ("upper left")?
notice that the above pseudo-code only has 4 basic components:
INPUT (ask user to choose...)
OUTPUT (draw board, draw mark on board, print winner)
LOOPING (keep doing this over and over...)
BRANCHING (if game over, go to ...)
the tic-tac-toe program will also need a DATA STRUCTURE: some
way to represent the board and it's current state (which spots
are taken and what marks are in those spots). the ALGORITHM
ties it all together.
COURSE INFO:
intro to cs, learning to program, learn to develop and
analyze algorithms (lots of problem solving)
who should you take this course: students new to CS and programming
(if you've already done some programming, CS31 or CS35 might be
better for you)
what to expect
- class builds on previous week's work
- does require work (lab time)
- help is available (ninjas)...but START EARLY
- my teaching style (learn by doing)
- why python?
http://xkcd.com/353
http://sebsauvage.net/python/snyppets/#beginner
unix login and first python program (print "hello")
- cs account
- let me know if name not correct
- prox tags
- passwd
- dock and terminal program and unix prompt
- logging out, ssh access (putty, mac)
LAB0: vimtutor, using unix, update21, handin21