Difference between revisions of "IB Computer Science 1"
From WLCS
Line 2: | Line 2: | ||
'''Agenda:''' | '''Agenda:''' | ||
* Missing demos | * Missing demos | ||
+ | |||
+ | <syntaxhighlight lang="Python"> | ||
+ | import sys, pygame | ||
+ | pygame.init() | ||
+ | |||
+ | width = 600 | ||
+ | height = 400 | ||
+ | dx = 1 | ||
+ | dy = 1 | ||
+ | black = 0, 0, 0 | ||
+ | |||
+ | screen = pygame.display.set_mode((width, height)) | ||
+ | |||
+ | ball = pygame.image.load("ball.gif") | ||
+ | ballrect = ball.get_rect() | ||
+ | |||
+ | while 1: | ||
+ | for event in pygame.event.get(): | ||
+ | if event.type == pygame.QUIT: sys.exit() | ||
+ | |||
+ | ballrect = ballrect.move((dx,dy)) | ||
+ | |||
+ | if ballrect.left < 0 or ballrect.right > width: | ||
+ | dx *= -1 | ||
+ | if ballrect.top < 0 or ballrect.bottom > height: | ||
+ | dy *= -1 | ||
+ | |||
+ | screen.fill(black) | ||
+ | screen.blit(ball, ballrect) | ||
+ | pygame.display.flip() | ||
+ | </syntaxhighlight> | ||
+ | |||
* Comment each line of code from the [http://www.pygame.org/docs/tut/intro/intro.html Pygame Tutorial] | * Comment each line of code from the [http://www.pygame.org/docs/tut/intro/intro.html Pygame Tutorial] | ||
** You comment should be a note of what that line is doing | ** You comment should be a note of what that line is doing | ||
* [http://www.pygame.org/docs/ Pygame Documentation] | * [http://www.pygame.org/docs/ Pygame Documentation] | ||
− | |||
== Tuesday - Monday (11/20/12 - 11/26/12) == | == Tuesday - Monday (11/20/12 - 11/26/12) == |
Revision as of 14:31, 27 November 2012
Contents
Tuesday (11/27/12)
Agenda:
- Missing demos
import sys, pygame
pygame.init()
width = 600
height = 400
dx = 1
dy = 1
black = 0, 0, 0
screen = pygame.display.set_mode((width, height))
ball = pygame.image.load("ball.gif")
ballrect = ball.get_rect()
while 1:
for event in pygame.event.get():
if event.type == pygame.QUIT: sys.exit()
ballrect = ballrect.move((dx,dy))
if ballrect.left < 0 or ballrect.right > width:
dx *= -1
if ballrect.top < 0 or ballrect.bottom > height:
dy *= -1
screen.fill(black)
screen.blit(ball, ballrect)
pygame.display.flip()
- Comment each line of code from the Pygame Tutorial
- You comment should be a note of what that line is doing
- Pygame Documentation
Tuesday - Monday (11/20/12 - 11/26/12)
- Complete Turtle - Graphing Calculator
- Introduction to Pygame
- Wing IDE 101->Edit->Configure Python-> make sure all the settings are default
- Go to Pygame Tutorial
- Download the ball picture
- Walk through the tutorial (NOTE: Line 10 should say "ball.gif")
Monday (11/19/12)
- Demo Turtle - Looping Assignment
- Complete Turtle - Graphing Calculator
Wednesday - Friday (11/14/12 - 11/16/12)
- Order of Operations Redemption Quiz 2
- Demo Turtle - Looping Assignment
- Complete Turtle - Graphing Calculator
Tuesday (11/13/12)
Agenda:
- VA Workplace Readiness Assessment Pre-test (1 hr)
- There are on-screen tools (e.g. calculator) that you can use
Friday (11/9/12)
Warmup:
- Order of Operations Redemption Quiz
- No calculators!
- When you are done, print your score and tell Mr. Bui
Agenda:
- VA Workplace Readiness Assessment Pre-test (1 hr)
- There are on-screen tools (e.g. calculator) that you can use
Wednesday - Thursday (11/7/12 - 11/8/12)
Warmup:
- Execute the code below
- When prompted, use 100 for x and 200 for y
- What does each line do? Analyze!
from turtle import *
setup(200, 400)
screensize(200, 400)
x = numinput("X prompt", "Please enter an x")
y = numinput("Y prompt", "Please enter a y")
goto(x,y)
exitonclick()
Agenda:
- Return 1st Quarter Exams
- 1st Quarter Exam Debrief
- Complete Turtle - Looping Assignment (practice loops with turtle)
- Turtle - Graphing Calculator
Friday - Monday (11/2/12 - 11/5/12)
Agenda:
- 1st Quarter Exam