St. Perpetua Computer Science 2020–21
Classroom Tools
2021-05-28
No grade 8.
Machine Learning with Teachable Machine
Moving a circle with up/down/left/right signals.
2021-05-21
Machine Learning with Teachable Machine
Using with p5.js
Show what is detected
Move ball up and down
In the above programs, replace the link on line 1 with the link to your model.
2021-05-14
No grade 8.
Python Turtle Graphics
Lesson (Follow this link and scroll down to Let’s Get Started)
2021-05-07
Finish Last Homework
If you already have a note from me on Google Classroom that your homework is complete, you have these options:
- keep adding to your adventure game
- do something else with Python, or with p5.js, Blender or Tinkercad Codeblocks
2021-04-30
Finish Last Homework
If you already have a note from me on Google Classroom that your homework is complete, you have these options:
- keep adding to your adventure game
- do something else with Python, or with p5.js, Blender or Tinkercad Codeblocks
2021-04-23
New Adventure Game
Start here. Let’s study this program, and:
- Change the places (right now they are: airstrip, forest, cave, meadow)
- Add new places
- Add events that can give you inventory items or end the game
2021-04-16
Adventure Game: Improving the User Experience
Let’s make the game easier for the player.
- Let them answer with one letter:
Where to? (B)each, or (G)rocery store?
- Convert responses to lower case:
place.lower()
- Exit the game when they lose:
exit()
2021-03-26
Adventure Game: Adding Randomness
Start here. We’ll add these features in class:
- award a randomly-chosen number of knowledge points (
randint
) - randomize the messages that appear in the various game places (
randint
,choice
, andif
)
Optionally do the assignment in Google Classroom.
2021-03-19
Adventure Game: More Practice with print
, input
and if
2021-03-12
Practice with print
, input
and if
day = 'Friday'
print('Hello, world! Today is', day)
name = input('Hi. Your name? ')
print(name)
answer = input('What is "hello" in Spanish? ')
if answer == 'hola':
print('Right!')
else:
print('Sorry, the answer is "hola"')
Once you are comfortable with those, please make something with p5.js, Python, Blender or Tinkercad Codeblocks.
2021-03-05
Python Dictionaries, Continued
Let’s get everyone to submit a correct program
If you have submitted a correct program, please make something with p5.js, Python, Blender or Tinkercad Codeblocks. Maybe you’d like to show something you make.
(Grade 6, in the classroom, experienced videoconference problems. We barely got through the “Hello, world” warmup.)
2021-02-26
Opening a Door in Unity
Python Dictionaries, Continued
Let’s get everyone to submit a correct program
2021-02-19 Python Dictionaries
2021-02-12
Game Character Generator
Using Python and Flask, make a web app that generates the attributes of a game character.
Grades 6–8 got to version 2 of the project.
2021-02-05
Current Weather Web App, Continued
Show Data on the Web Page
Find weather items from the data below, and add them to your web page.
coord {'lon': -122.1119, 'lat': 37.8961}
main {'temp': 12.59, 'feels_like': 10.04, 'temp_min': 11.67, 'temp_max': 13.33, 'pressure': 1024, 'humidity': 47}
visibility 10000
wind {'speed': 1.16, 'deg': 29}
sys {'type': 1, 'id': 3581, 'country': 'US', 'sunrise': 1612537726, 'sunset': 1612575374}
name Lafayette
In your index.html file you use pairs of braces to extract the elements you want. For example,
{{weather.main.temp}}
gives you the temperature. Can you find main
and temp
in the data
above? {{weather.main.feels_like}}
gives you the “feels like” temperature. Can you find
main
and feels_like
above? How about {{weather.main.humidity}}
?
How would you get the wind speed? That’s in a different section. {{weather.wind.speed}}
gets you wind speed. What about wind direction (measured in degrees)? Sunrise and sunset?
2021-01-29
Last Week’s Assignment
Questions?
Current Weather Web App
We will create a web app to show the current weather, using Python and the Flask web application framework.
2021-01-22
Create a p5.js program on repl.it demonstrating that you’ve met the objectives from 2021-01-08. Provide a link to your program in response to today’s assignment in Google Classroom.
2021-01-08
p5.js, Continued from 2020-11-20
Exercise: Create something with 2D primitives
Log in to repl.it
Go to repl.it. Log in with a Google or other account.
Reference
- Drawing other 2D primitives: rectangles, ellipses, and triangles.
Objectives
- Become comfortable with the 2D (x, y) coordinate system and positioning shapes in it
- Understand stroke and fill
- Be able to place objects where you want them
- Use
width
andheight
so that the result scales correctly when the canvas size is changed - Be able to use the p5.js reference to learn about p5.js
2020-12-18
Holiday-Themed Tinkercad Codeblocks Creations
One on One
Mr. B. will call on students to check on their progress.
2020-12-11
One on One
Mr. B. will call students in random order to work one on one with any of:
- Python
- Blender
- Tinkercad
- Codeblocks
- p5.js on repl.it
- A problem from
The rest of the class can watch or create something of their own.
2020-12-04
Advent of Code
Day 1 Puzzle
This Python code will get us started.
What we’ll learn while solving this problem:
- reading data from a file into a list
- looping over the contents of a list
- a loop within a loop
- adding numbers and comparing the sum to a number
- multiplying numbers
2020-11-20
Grades 6–8
p5.js
Last week we practiced using JavaScript by itself, without p5.js. We now return to using JavaScript with p5.js.
Exercise: Create something with 2D primitives
Log in to repl.it
Go to repl.it. Log in with a Google or other account.
Reference
- Drawing other 2D primitives: rectangles, ellipses, and triangles.
Objectives
- Become comfortable with the 2D (x, y) coordinate system and positioning shapes in it
- Understand stroke and fill
- Be able to place objects where you want them
- Use
width
andheight
so that the result scales correctly when the canvas size is changed - Be able to use the p5.js reference to learn about p5.js
Ideas
- A house
- A lake with cabins surrounding it
- A robot
- A musical instrument
- A person
- Birds in the sky
2020-11-16
Grade 5
Tinkercad Codeblocks
Loops
We’ll create a row of several objects (pyramids, perhaps) by repeating a sequence of blocks. Then we’ll shorten the code by using a loop.
2020-11-13
Grades 6–8
JavaScript Basics, in Coding Rooms
You don’t need to create an account. Please provide your real name instead of “anonymous something”.
- “Printing” to the console
- Creating variables
- Printing numbers, expressions, and variables
- Loops
- Random numbers
2020-11-06
Grades 6–8, Short Schedule
p5.js
See description in 2020-11-20, where we continue.
Exercise: Create something with 2D primitives
If You Already Know All This
If you don’t need this lesson, please explore your own p5.js ideas and projects, or make something with Python, Blender or Tinkercad Codeblocks.
Progress
Grade 6: Technical problems, perhaps due to not using headphones. Little progress.
Grade 7: Got through the corners problem solution, and started on the exercise. Needed to turn off the camera of the person speaking in order hear that person without garbling.
Grade 8: Good discussion in show and tell/ask a CS question. Need to repeat the
corners explanation.
2020-10-30
Grades 6–8
Show and Tell
Ask Your Computer Science Questions
p5.js
Grade 5
No meeting today
2020-10-16
Grades 5–8
Show and Tell
Ask Your Computer Science Questions
p5.js
Review/Introduction
Our p5.js page:
If You Don’t Need the Review
If you don’t need the review, please explore your own p5.js ideas and projects, or make something with Python, Blender or Tinkercad Codeblocks. Maybe you’d like to show something you make.
Rainbow colors program:
let hue = 0
function setup() {
createCanvas(700, 450)
background('black')
colorMode(HSB)
}
function draw() {
noStroke()
fill(hue, 100, 100)
ellipse(mouseX, mouseY, 200, 30)
++hue
if (hue > 360)
hue = 0
}
2020-10-09
Grades 5–8
Mr. B’s Show and Tell
Ask Your Computer Science Questions
One on One, Continued
2020-10-06
Grade 5
See 2020-10-02, Grades 6–8
2020-10-02
Grades 6–8
Mr. B’s Show and Tell
One on One
Mr. B. will call students in random order to work one on one with any of:
- Python
- Blender
- Tinkercad
- Codeblocks
The rest of the class can watch or create something of their own. Ideas (from past lessons):
- Continue the silly sentences program
- Use Python with Blender to create various objects in a scene
- Use Codeblocks with Tinkercad to make something
2020-09-18
Grades 5–8
Mr. B’s Show and Tell
Dice throwing Unity program
Python
- Random numbers
- Loops
- (Grade 5 got to here, but haven’t finished)
Codeblocks
- Random numbers
- Loops
Python in Blender
- Creating multiple objects at random locations
- (Grade 6 got as far as creating a single object)
2020-09-15
Grade 5
Mr. B’s Show and Tell
Something in Blender
- a cube
- subdividing into 27 smaller cubes
- extruding faces to make new parts
- moving a face
- coloring with materials
Python
Python Exercises
- print string literals
- print arithmetic expressions
- almost got to create a loop with
for
Python
Python and Blender
A cube of monkeys
import bpy
s = 7
for x in range(s):
for y in range(s):
for z in range(s):
bpy.ops.mesh.primitive_monkey_add(location=(x * 3, y * 3, z * 3))
2020-09-11
Grades 6–8
Mr. B’s Show and Tell
Something in Blender
Installing Blender
Problems? It’s free.
Tinkercad Alternative
If you aren’t able to run Blender, please make something with Tinkercad Codeblocks during class today.
Python
Python and Blender
Switch to the Scripting workspace (the tab at the top). Click New in the large window that appears to create a space where you can write Python code.
A cube
import bpy
bpy.ops.mesh.primitive_cube_add()
A row of cubes
import bpy
s = 7
for x in range(s):
bpy.ops.mesh.primitive_cube_add(location=(x * 3, 0, 0))
A cube of cubes
import bpy
s = 7
for x in range(s):
for y in range(s):
for z in range(s):
bpy.ops.mesh.primitive_cube_add(location=(x * 3, y * 3, z * 3))
Grade 5
Mr. B’s Show and Tell
Something in Blender
Installing Blender
Problems? It’s free.
Tinkercad
Let’s look at some of your Tinkercad creations.
Python
Let’s do some Python programming together.
from random import choice
nouns = ['girl', 'farmer', 'bicycle']
verbs = ['runs', 'cooks', 'swims']
print(choice(nouns), choice(verbs))
2020-09-04
Grades 6–8
Mr. B’s Show and Tell
Latest Unity project
Tinkercad
Let’s look at some of your Tinkercad creations.
Python
Let’s do some Python programming together.
from random import choice
nouns = ['girl', 'farmer', 'bicycle']
verbs = ['runs', 'cooks', 'swims']
print(choice(nouns), choice(verbs))
2020-08-28
All Grades
- Join your Google Classroom
- Mr. B’s latest fun projects
- Tinkercad
- We can make 3D models and use them in games we create
- Log in
- Using a Google account may be easiest
- Go through tutorials to learn the basics
- Make something (house, animal, vehicle, whatever you like)
- Codeblocks
- Let’s make something together
- You make something else on your own