Q&A
- I pushed Meetup Scatergories to Tues for time. Be thinking about what groups, like TriPython, Refresh the Triangle, or Girl Develop It, you want to check out. Consider carpooling!
- Any qs?
Take home, ungraded Mid-term
This is exactly the same as the other section of INLS 560. Completing it will get you full credit, and knowing your numerical grade should give you a sense of whether you’ve gotten some of the basics.
This is something that you should treat like a real test to get the most out of. Review Syntax, flow of control, and loops in particular. Trinket does a lot for you in terms of autocomplete and error detection but this will be a paper test with no feedback so make sure you’re not too reliant on those crutches. It is open notes and open book but I encourage you to try it closed notes and closed book.
Time yourself. You should spend no more than one class period, 75 minutes, on this.
The purpose of this test is to increase your meta-cognition, or knowing what you know. It will also help us ensure that both sections of INLS 560 are covering comparable material. There is nothing about Turtle on the midterm, but all of the great projects you’ve done should help you in reading and writing the basic code on the test.
Game Tips
-
You may find the math easier if you
setworldcoordinates
to be positive numbers. -
Within your game word, think of ‘Jobs’ that must be done, such as drawing game elements. These jobs should probably be one by a Turtle object (or by an object of one of your custom classes).
You can then create functions that take objects of a certain type, and perhaps extra arguments such as what ‘level’ you’re on and do the ‘job’. -
If you need a ‘Grid’, make sure that the objects in your game are always placed at multiples of a certain number, say 10. When the user presses up or down, the objects will then only move by this increment, creating the ‘grid’ you want.
-
Use
screen.tracer(0)
to turn animation off. You can then draw things and have them show up instantly by either turning animation back on withscreen.tracer(1)
or update the screen once withscreen.update()
.
Game Concepts
If you need to do something after a certina about of time, use screen.ontimer
, which takes a function name to call
and a number of miliseconds to wait before doing it. If you want something to happen endlessly, you can create
a recursive function that calls itself in a screen.ontimer()
. Think of recursion as starting at the top of the function
again. Here’s a minimal example:
def go():
# do some things, modify variables, check for game state, etc here
screen.ontimer(go, 100) # every .1 seconds, start over
This won’t freeze your program or get you into an inescapable infinite loop. More in our broadcast below.
Hands-on
Join me for a broadcast:
Milestones (10-15 minutes)
Pair up and merge each others’ milestones. Ask questions to help clarify your partner’s plan, especially in light of what we did today.
Nothing to turn in for this! Use it to make sure you know where you’re going and what you’ll be spending time on between now and Tues.