Othello Turtle Extra Credit (20 points) Due Sunday, Nov 29 (really!)

Size: px
Start display at page:

Download "Othello Turtle Extra Credit (20 points) Due Sunday, Nov 29 (really!)"

Transcription

1 Othello Turtle Extra Credit (20 points) Due Sunday, Nov 29 (really!) For the extra credit, you will add turtle to the Othello project you have done. It will require modifying some functions (slightly), as indicated below. Some functions can be left as is, and you will have to write at least 2 functions completely from scratch. Have fun!!! ########################### from random import * import turtle #####Global Variables##### boardmatrix = [] boardsize = 8 p1color='b' p2color ='O' bgcolor = "lightgreen" #your choice here boardx = -175 #the x and y coordinates of the top left corner of the board boardy = 250 squaresize = 50 #size of each square on the board ypiecesx = -175 #used for the writing at the bottom of the turtle board ypiecesy = -210 rad = 20 #radius of the circles on the board currcolor = 'B' #color of current player pct = 1 #number of people players (0 means computer plays itself, 1 means user plays computer) ctofpieces = 4 #This function adds a circle to the turtle board. It takes as input parameters #2 integers - the x and y values (used to place a piece in your board matrix), #and a string - the color of the circle to be placed on the board. It #calculates the correct location and adds a circle to that location in the color #indicated by the input parameter def addpiece(x,y,color): global boardx global boardy global squaresize global circlesize global rad15 #No changes - this function should be the same as the non-turtle version def makemat():

2 #No changes - this function should be the same as the non-turtle version def printmat(): #flippieces (I think I called it countandflippieces in the other lab I got lazy) #This function should be modified slightly so that it flips pieces both in the #board matrix and also on the turtle board def flippieces(t,x,y,flip,dir): #placepiecetu I added the tu at the end so it s clear it s a turtle function #This function needs to be modified. #First, it no longer needs to ask the user to enter the x and y coordinates, #because you will get the x and y coordinates from clicking on the board. #Second, both when a piece is added to the matrix, it must also be added to the #turtle board. Equally, when the player forfeits their turn and the board #matrix is set back to a blank, then the turtle board must also reset the place #where a circle was just placed back to a blank circle. #And finally, the function should write out at the bottom of the turtle board #whose turn it currently is (I made mine say, "Player x, choose your piece" #where x is either O or B). def placepiecetu(t,x,y): #compplacepiece() #This function needs to be modified. #Like above, both when a piece is added to the matrix, it must also be added to the #turtle board. Equally, when the computer forfeits its turn and the board #matrix is set back to a blank, then the turtle board must also reset the place #where a circle was just placed back to a blank circle. #And finally, the function should write out at the bottom of the turtle board #whose turn it currently is (I made mine say, "Player x, choose your piece" #where x is either O or B). def compplacepiece():, #ckwin() #This function needs to be modified slightly to print out who won on the turtle #board as well as to the idle shell

3 def ckwin(p1color): #drawboard() #This function draws the original othello board, with no pieces on it yet. It #will be a matrix of boardsize x boardsize squares, with each square being #squaresize pixels wide. It should place the original 4 squares on the board. #My board started at the location of boardx and boardy, and, after being drawn, #looked like: def drawboard(): global boardx global boardy global squaresize #This just needs to be modified ever so slightly. #There's now a global parameter called "currcolor" that holds a string - the #color of the current player. It needs to be set in this function def getcolors(): global p1color global p2color #This function takes as input parameters the x and y coordinates of where you #clicked on the board. It calculates the corresponding x and y coordinates of

4 #the board matrix, then calls placepiecetu with the current color, and the #matrix's x and y coordinates. It then switches colors. If the number of #of players is 1, it will call the compplacepiece function to have the computer #place a piec on the board. #Note that every time you click on the board, this function gets called. So #you don't need to loop in here. def getxy(x,y): global pct print(x) print(y) matx = abs((int(x) - boardx)//squaresize) maty = abs((boardy - int(y))//squaresize) # print("x on mat: " + str(matx)) #add this back for debugging # print("y on mat: " + str(maty)) placepiecetu(currcolor,matx,maty) if currcolor == 'B': currcolor = 'O' currcolor = 'B' if (pct == 1): compplacepiece() if currcolor == 'B': currcolor = 'O' currcolor = 'B' return #This function either loops 60 times, calling the compplacepiece function with #opposite color each time, so that the computer plays itself, or it calls #turtle.s onscreenclick function to get the x and y coordinate, and set the #parameters with the function getxy to hold those x and y coordinates. If the #pct, or the number of players is set to 1, it will call the compplacepiece #function after each click. def taketurns(): global pct if pct == 0: if p1color == 'B': player = 'player1' currcolor = p1color player = 'player2' currcolor = p2color for x in range(60): compplacepiece() if player == 'player1':

5 player = 'player2' currcolor = p2color player = 'player1' currcolor = p1color ckwin(p1color) if p1color == 'B': currcolor = 'B' turtle.onscreenclick(getxy) compplacepiece() currcolor = 'O' turtle.onscreenclick(getxy) def main(): global ypiecesx global ypiecesy global cpiecesx global cpiecesy global pct wn = turtle.screen() # set wn to the window object wn.bgcolor("lightgreen") # set the window background color wn.title("othello") # set the window title turtle.speed(70) turtle.color("black") turtle.penup() turtle.goto(-97,260) turtle.pendown() turtle.setheading(0) turtle.write("othello",font = ("Arial",40)) drawboard() getcolors() makemat() x = 0 if p1color == 'B': player = "player1" currcolor = p1color player = 'player2' currcolor = p2color pct = int(turtle.textinput("title Window","How many players?(0,1,or 2)"))

6 taketurns() if ctofpieces == 63: ckwin(p1color) main()

Lab 4: Due Sunday, Nov 22

Lab 4: Due Sunday, Nov 22 Lab 4: Due Sunday, Nov 22 Part 1(15 pts): Finish the class project so that it works. For this, you can continue to work with your group, but everyone should turn it in individually. Turn this in separately

More information

Draw beautiful and intricate patterns with Python Turtle, while learning how to code with Python.

Draw beautiful and intricate patterns with Python Turtle, while learning how to code with Python. Raspberry Pi Learning Resources Turtle Snowflakes Draw beautiful and intricate patterns with Python Turtle, while learning how to code with Python. How to draw with Python Turtle 1. To begin, you will

More information

Lab 2: Booleans, Strings, Random Numbers, Recursion, Variables, Input function

Lab 2: Booleans, Strings, Random Numbers, Recursion, Variables, Input function Lab 2: Booleans, Strings, Random Numbers, Recursion, Variables, Input function Due: Mar13 (Note that this is a 2-week lab) This lab must be done using paired partners. You should choose a different partner

More information

Lab 2: Booleans, Strings, Random Numbers, Recursion, Variables, Input function

Lab 2: Booleans, Strings, Random Numbers, Recursion, Variables, Input function Lab 2: Booleans, Strings, Random Numbers, Recursion, Variables, Input function Due: Mar25 (Note that this is a 2-week lab) This lab must be done using paired partners. You should choose a different partner

More information

Word Prediction Project Due Sunday, May 1

Word Prediction Project Due Sunday, May 1 Word Prediction Project Due Sunday, May 1 For this project you may work with a partner, or you may work alone. Either way you are responsible for getting the project finished and in on time. If you choose

More information

ECS Baruch Lab 3 Spring 2019 Name

ECS Baruch Lab 3 Spring 2019 Name ECS 102 - Baruch Lab 3 Spring 2019 Name I. You can't ask a computer to do something you can't do. Now it is your turn to step through a program, without a computer. DO NOT ENTER THIS PROGRAM ON THE COMPUTER.

More information

Problem 1.1 (3 pts) :Python uses atomic data types and builds up from there. Give an example of: a. an int b. a double c. a string

Problem 1.1 (3 pts) :Python uses atomic data types and builds up from there. Give an example of: a. an int b. a double c. a string Lab 1: Due Sunday, Feb 28, midnight This is a paired programming lab: In this lab you will work in pairs. In lab, you will choose your partner for the next two weeks. Get your partner s name and email

More information

Computer and Programming: Lab 1

Computer and Programming: Lab 1 01204111 Computer and Programming: Lab 1 Name ID Section Goals To get familiar with Wing IDE and learn common mistakes with programming in Python To practice using Python interactively through Python Shell

More information

LO: To recreate Matisse s Snail in Python

LO: To recreate Matisse s Snail in Python Name: LO: To recreate Matisse s Snail in Python Step 1: Open the Python editor IDLE and make a new document by pressing ctrl-n. Make sure you type the Python code in the blank new document and not in the

More information

Control Flow: Loop Statements

Control Flow: Loop Statements Control Flow: Loop Statements A loop repeatedly executes a of sub-statements, called the loop body. Python provides two kinds of loop statements: a for-loop and a while-loop. This exercise gives you practice

More information

Open GL Framework For A Computer Graphics Course

Open GL Framework For A Computer Graphics Course Open GL Framework For A Computer Graphics Course Programmer: Daniel Odle Sponsor / Advisor: Dr. Morse University of Evansville 4-26-03 Table of Contents Introduction 3 Statement of Problem 3 Design Approach

More information

Python, Part 2 CS 8: Introduction to Computer Science Lecture #4

Python, Part 2 CS 8: Introduction to Computer Science Lecture #4 Python, Part 2 CS 8: Introduction to Computer Science Lecture #4 Ziad Matni Dept. of Computer Science, UCSB A Word About Registration for CS8 This class is currently FULL The waitlist is CLOSED 4/13/17

More information

The Beauty and Joy of Computing 1 Lab Exercise 9: Problem self-similarity and recursion - Python version

The Beauty and Joy of Computing 1 Lab Exercise 9: Problem self-similarity and recursion - Python version The Beauty and Joy of Computing 1 Lab Exercise 9: Problem self-similarity and recursion - Python version Objectives By completing this lab exercise, you should learn to Recognize simple self-similar problems

More information

CS100 Spring 2017 Final

CS100 Spring 2017 Final CS100 Spring 2017 Final May 11, 2017 There are 13 questions on this test. Record your answers to the first 10 questions by circling a letter below. Answer questions 11, 12 and 13 on the attached pages.

More information

CS1110 Lab 5: Practice for A4 (Mar 8-9, 2016) First Name: Last Name: NetID:

CS1110 Lab 5: Practice for A4 (Mar 8-9, 2016) First Name: Last Name: NetID: CS1110 Lab 5: Practice for A4 (Mar 8-9, 2016) First Name: Last Name: NetID: The lab assignments are very important. Remember this: The lab problems feed into the assignments and the assignments define

More information

Noughts and Crosses. Step 1: Drawing the grid. Introduction

Noughts and Crosses. Step 1: Drawing the grid. Introduction 6 Noughts and Crosses These projects are for use inside the UK only. All Code Clubs must be registered. You can check registered clubs at www.codeclub.org.uk/. This coursework is developed in the open

More information

Intro to Python Programming

Intro to Python Programming Intro to Python Programming If you re using chromebooks at your school, you can use an online editor called Trinket to code in Python, and you ll have an online portfolio of your projects which you can

More information

Lesson 13: Exploring Factored Form

Lesson 13: Exploring Factored Form Opening Activity Below is a graph of the equation y = 6(x 3)(x + 2). It is also the graph of: y = 3(2x 6)(x + 2) y = 2(3x 9)(x + 2) y = 2(x 3)(3x + 6) y = 3(x 3)(2x + 4) y = (3x 9)(2x + 4) y = (2x 6)(3x

More information

Lab 4 Due April 18 th

Lab 4 Due April 18 th Lab 4 Due April 18 th (100 pts) You may work with a partner if you want. Turn in one version with 2 names on it. Do not forget your partner s name. Or work alone. Your choice. Problem 1 (10 pts): Create

More information

CS 051 Homework Laboratory #2

CS 051 Homework Laboratory #2 CS 051 Homework Laboratory #2 Dirty Laundry Objective: To gain experience using conditionals. The Scenario. One thing many students have to figure out for the first time when they come to college is how

More information

Creating objects TOPIC 3 INTRODUCTION TO PROGRAMMING. Making things to program with.

Creating objects TOPIC 3 INTRODUCTION TO PROGRAMMING. Making things to program with. 1 Outline TOPIC 3 INTRODUCTION TO PROGRAMMING Notes adapted from Introduction to Computing and Programming with Java: A Multimedia Approach by M. Guzdial and B. Ericson, and instructor materials prepared

More information

CONDITION CONTROLLED LOOPS. Introduction to Programming - Python

CONDITION CONTROLLED LOOPS. Introduction to Programming - Python CONDITION CONTROLLED LOOPS Introduction to Programming - Python Generating Random Numbers Generating a random integer Sometimes you need your program to generate information that isn t available when you

More information

Outline. Turtles. Creating objects. Turtles. Turtles in Java 1/27/2011 TOPIC 3 INTRODUCTION TO PROGRAMMING. Making things to program with.

Outline. Turtles. Creating objects. Turtles. Turtles in Java 1/27/2011 TOPIC 3 INTRODUCTION TO PROGRAMMING. Making things to program with. 1 Outline 2 TOPIC 3 INTRODUCTION TO PROGRAMMING Notes adapted from Introduction to Computing and Programming with Java: A Multimedia Approach by M. Guzdial and B. Ericson, and instructor materials prepared

More information

: Intro Programming for Scientists and Engineers Assignment 1: Turtle Graphics

: Intro Programming for Scientists and Engineers Assignment 1: Turtle Graphics Assignment 1: Turtle Graphics Page 1 600.112: Intro Programming for Scientists and Engineers Assignment 1: Turtle Graphics Peter H. Fröhlich phf@cs.jhu.edu Joanne Selinski joanne@cs.jhu.edu Due Date: Wednesdays

More information

We will work with Turtles in a World in Java. Seymour Papert at MIT in the 60s. We have to define what we mean by a Turtle to the computer

We will work with Turtles in a World in Java. Seymour Papert at MIT in the 60s. We have to define what we mean by a Turtle to the computer Introduce Eclipse Create objects in Java Introduce variables as object references Aleksandar Stefanovski CSCI 053 Department of Computer Science The George Washington University Spring, 2010 Invoke methods

More information

Starting. Read: Chapter 1, Appendix B from textbook.

Starting. Read: Chapter 1, Appendix B from textbook. Read: Chapter 1, Appendix B from textbook. Starting There are two ways to run your Python program using the interpreter 1 : from the command line or by using IDLE (which also comes with a text editor;

More information

Exercise 1.1 A First NetLogo Session Turtle commands and properties

Exercise 1.1 A First NetLogo Session Turtle commands and properties Exercise 1.1 A First NetLogo Session NetLogo is an interpreted language meaning you can type commands directly into a command line and see the results. In order to introduce NetLogo we will first type

More information

Midterm #1a Fall minutes

Midterm #1a Fall minutes 15-110 Midterm #1a Fall 2018 50 minutes Name: Andrew ID: @andrew.cmu.edu Section: You may not use any books, notes, or electronic devices during this exam. You may not ask questions about the exam except

More information

Othello Game. First, to learn the rules of Othello and play online, you can go here:

Othello Game. First, to learn the rules of Othello and play online, you can go here: Othello Game As an example of implementing a computer player, let s use the game Othello as an example. We are not using Upthrust because that will be the topic for a homework assignment! First, to learn

More information

nostarch.com/pfk For bulk orders, please contact us at

nostarch.com/pfk For bulk orders, please contact us at nostarch.com/pfk For bulk orders, please contact us at sales@nostarch.com. Teacher: Date/Period: Subject: Python Programming Class: Topic: #1 - Getting Started Duration: Up to 50 min. Objectives: Install

More information

4 + 4 = = 1 5 x 2 = 10

4 + 4 = = 1 5 x 2 = 10 Beginning Multiplication Ask your child... "Have you ever seen a multiplication problem?" Explain: "Instead of a plus ( + ) sign or a minus ( - ) sign a multiplication sign ( x ) is used." Have child to

More information

Geometer's Sketchpad Lab Quadrilateral Properties Due Date: _Friday, November 6, 2015_

Geometer's Sketchpad Lab Quadrilateral Properties Due Date: _Friday, November 6, 2015_ Geometer's Sketchpad Lab Quadrilateral Properties Due Date: _Friday, November 6, 2015_ This project is worth 100 points. The grade will be reduced 10% each day it is late. 1. Complete the steps to CONSTRUCT

More information

TESSELLATION PROJECT DIRECTIONS

TESSELLATION PROJECT DIRECTIONS TESSELLATION PROJECT DIRECTIONS You are to create your own tessellation masterpiece. Your tessellation will be created based on specific criteria. You MUST follow the guidelines given in order to receive

More information

Honors Computer Science Python Mr. Clausen Program 7A, 7B

Honors Computer Science Python Mr. Clausen Program 7A, 7B Honors Computer Science Python Mr. Clausen Program 7A, 7B PROGRAM 7A Turtle Graphics Animation (100 points) Here is the overview of the program. Use functions to draw a minimum of two background scenes.

More information

Detailed guide for learning to program in Python 3

Detailed guide for learning to program in Python 3 Detailed guide for learning to program in Python 3 This is a general guide to assist in learning Python 3. Not all the components here are necessary for teaching or learning programming for Edexcel GCSE

More information

SPRING COMP 141 MIDTERM 2 PRACTICE PROBLEMS

SPRING COMP 141 MIDTERM 2 PRACTICE PROBLEMS 1. Which method could be used to convert a numeric value to a string? a. str b. value c. num d. chr 2. Which of the following statements are true? (circle all that are true) a. When you open a file for

More information

The first print the integer literal 12, the second prints the string comprising the character 1 followed by the character 2.

The first print the integer literal 12, the second prints the string comprising the character 1 followed by the character 2. The Fundamentals 2 Self-Review Questions Self-review 2.1 What are the types of the following literals? 1, 1., 1.0, 1, 1., 1.0, 1, 1., 100000000000000000, 100000000000000000., 100000000000000000.0. int,

More information

ECS Baruch Lab 5 Spring 2019 Name NetID (login, like , not your SUID)

ECS Baruch Lab 5 Spring 2019 Name NetID (login, like  , not your SUID) ECS 102 - Baruch Lab 5 Spring 2019 Name NetID (login, like email, not your SUID) Today you will be doing some more experiments in the shell. Create a file Lab5.txt. In this file you will be asked to save

More information

Squares and Rectangles

Squares and Rectangles 11 CHAPTER Squares and Rectangles Lesson 11.1 Squares and Rectangles Study the figure. Then fill in the blanks. 1. There are right angles. 2. There are equal sides. 3. There are pairs of parallel sides.

More information

CSE 131 Introduction to Computer Science Fall Exam II

CSE 131 Introduction to Computer Science Fall Exam II CSE 131 Introduction to Computer Science Fall 2013 Given: 6 November 2013 Exam II Due: End of session This exam is closed-book, closed-notes, no electronic devices allowed. The exception is the cheat sheet

More information

Haga's Origamics. Haga's Origamics are a series of activities designed to illustrate the science behind simple paper folding.

Haga's Origamics. Haga's Origamics are a series of activities designed to illustrate the science behind simple paper folding. Haga's Origamics Haga's Origamics are a series of activities designed to illustrate the science behind simple paper folding. Activity I : TUPS (Turned-Up Parts) Take a square piece of paper and label the

More information

Spring CS Homework 3 p. 1. CS Homework 3

Spring CS Homework 3 p. 1. CS Homework 3 Spring 2018 - CS 111 - Homework 3 p. 1 Deadline 11:59 pm on Friday, February 9, 2018 Purpose CS 111 - Homework 3 To try out another testing function, check-within, to get more practice using the design

More information

Assignment 3 Functions, Graphics, and Decomposition

Assignment 3 Functions, Graphics, and Decomposition Eric Roberts Handout #19 CS106A October 8, 1999 Assignment 3 Functions, Graphics, and Decomposition Due: Friday, October 15 [In] making a quilt, you have to choose your combination carefully. The right

More information

Understanding the Screen

Understanding the Screen Starting Starting Logo Logo Understanding the Screen Where you will write programs. You can just type methods or commands in here. Ex: t.forward() A Little Logo History What is LOGO? A programming language

More information

Device: PLT This document Version: 1. For hardware Version: 1. For firmware Version: Date: 9 May 2014

Device: PLT This document Version: 1. For hardware Version: 1. For firmware Version: Date: 9 May 2014 Device: PLT-2001 This document Version: 1 For hardware Version: 1 For firmware Version: 5.00 Date: 9 May 2014 Description: LED Matrix Display Driver board PLT-2001v1 datasheet Page 2 Contents Introduction...

More information

CMPSCI 119 Fall 2018 Thursday, November 29, 2018 Midterm #3 Solution Key Professor William T. Verts

CMPSCI 119 Fall 2018 Thursday, November 29, 2018 Midterm #3 Solution Key Professor William T. Verts CMPSCI 119 Fall 2018 Thursday, November 29, 2018 Midterm #3 Solution Key Professor William T. Verts 25 Points What is the value of each expression below? Answer any 25; answer more for extra credit.

More information

NetLogo Lab 3 Tutorial: Finding Peaks

NetLogo Lab 3 Tutorial: Finding Peaks NetLogo Lab 3 Tutorial: Finding Peaks You've already been exposed to the three types of agents you can give commands to in NetLogo: turtles, patches, and the observer. As you start to write your own procedures,

More information

CS 100: Gates and Drawing and Turtles

CS 100: Gates and Drawing and Turtles CS 100: Gates and Drawing and Turtles Chris Kauffman Week 3-1 Logistics HW 2 due Thursday at 11:59pm Code.org plus a few additional exercises HW 3 Python programming Make sure you have access to a computer

More information

Answer Key: CIS 166 Final Exam, Version 3, Spring 2015

Answer Key: CIS 166 Final Exam, Version 3, Spring 2015 CIS 166 Final Exam, Version 3, Spring 2015 1. What will the following code print: s = "haskell::curry::utrecht::glasgow" a = s[0:3] print(a.upper()) names = s.split("::") print(names) b,c,d = names[1],names[2],names[3]

More information

Python Turtle Graphics The Complete Guide.

Python Turtle Graphics The Complete Guide. Turtle Graphics The Complete Guide. coolpythoncodes.com/python-turtle/ by Rapture Godson /0/01 turtle graphics is one of the cool ways to implement your knowledge in before you start writing complex programs

More information

Today in CS161. Lecture #12 Arrays. Learning about arrays. Examples. Graphical. Being able to store more than one item using a variable

Today in CS161. Lecture #12 Arrays. Learning about arrays. Examples. Graphical. Being able to store more than one item using a variable Today in CS161 Lecture #12 Arrays Learning about arrays Being able to store more than one item using a variable Examples Tic Tac Toe board as an array Graphical User interaction for the tic tac toe program

More information

Chapter 7. Polygons, Circles, Stars and Stuff

Chapter 7. Polygons, Circles, Stars and Stuff Chapter 7. Polygons, Circles, Stars and Stuff Now it s time for the magic! Magic? asked Morf. What do you mean, magic? You ve never talked about Logo magic before. We ve talked about shapes, and how you

More information

CSE 3101 Design and Analysis of Algorithms Practice Test for Unit 1 Loop Invariants and Iterative Algorithms

CSE 3101 Design and Analysis of Algorithms Practice Test for Unit 1 Loop Invariants and Iterative Algorithms CSE 0 Design and Analysis of Algorithms Practice Test for Unit Loop Invariants and Iterative Algorithms Jeff Edmonds First learn the steps. Then try them on your own. If you get stuck only look at a little

More information

Generating Vectors Overview

Generating Vectors Overview Generating Vectors Overview Vectors are mathematically defined shapes consisting of a series of points (nodes), which are connected by lines, arcs or curves (spans) to form the overall shape. Vectors can

More information

Spring 2017 CS 1110/1111 Exam 1

Spring 2017 CS 1110/1111 Exam 1 CS 1110/1111 Spring 2017 Exam 1 page 1 of 6 Spring 2017 CS 1110/1111 Exam 1 Bubble in your computing ID in the footer of this page. We use an optical scanner to read it, so fill in the bubbles darkly.

More information

All program statements you write should be syntactically correct. Partial credit is not guaranteed with incorrect use of syntax.

All program statements you write should be syntactically correct. Partial credit is not guaranteed with incorrect use of syntax. With Solutions in Red CS110 Introduction to Computing Fall 2012 Section 2 Exam 1 This is an open notes exam. Computers are not permitted. Your work on this exam must be your own. Answer all questions in

More information

Name 8-6A. 1. What type of quadrilateral is shown below? A Rectangle B Trapezoid C Rhombus D Square. 2. What is true about every rhombus?

Name 8-6A. 1. What type of quadrilateral is shown below? A Rectangle B Trapezoid C Rhombus D Square. 2. What is true about every rhombus? Quick Check 1. What type of quadrilateral is shown below? A Rectangle B Trapezoid C Rhombus D Square 2. What is true about every rhombus? A All angles are equal. B All sides are equal. C Exactly one pair

More information

University of Toronto Mississauga. Flip to the back cover and write down your name and student number.

University of Toronto Mississauga. Flip to the back cover and write down your name and student number. University of Toronto Mississauga Midterm Test Course: CSC258H5 Winter 2016 Instructor: Larry Zhang Duration: 50 minutes Aids allowed: None Last Name: Given Name: Flip to the back cover and write down

More information

Intro to Python & Programming. C-START Python PD Workshop

Intro to Python & Programming. C-START Python PD Workshop Don t just buy a new video game, make one. Don t just download the latest app, help design it. Don t just play on your phone, program it. No one is born a computer scientist, but with a little hard work

More information

In today s lecture we ll have a look at: A simple technique The mid-point circle algorithm

In today s lecture we ll have a look at: A simple technique The mid-point circle algorithm Drawing Circles In today s lecture we ll have a look at: Circle drawing algorithms A simple technique The mid-point circle algorithm Polygon fill algorithms Summary raster drawing algorithms A Simple Circle

More information

Math-2 Lesson 6-3: Area of: Triangles, rectangles, circles and Surface Area of Pyramids

Math-2 Lesson 6-3: Area of: Triangles, rectangles, circles and Surface Area of Pyramids Math- Lesson 6-3: rea of: Triangles, rectangles, circles and Surface rea of Pyramids SM: Lesson 6-3 (rea) For the following geometric shapes, how would you answer the question; how big is it? Describe

More information

AN INTRODUCTION TO SCRATCH (2) PROGRAMMING

AN INTRODUCTION TO SCRATCH (2) PROGRAMMING AN INTRODUCTION TO SCRATCH (2) PROGRAMMING Document Version 2 (04/10/2014) INTRODUCTION SCRATCH is a visual programming environment and language. It was launched by the MIT Media Lab in 2007 in an effort

More information

In this project, you ll learn how to use a turtle to draw awesome shapes and patterns.

In this project, you ll learn how to use a turtle to draw awesome shapes and patterns. Turtle Power Introduction: In this project, you ll learn how to use a turtle to draw awesome shapes and patterns. Step 1: Hello, turtle! We re going to have some fun programming turtles. A turtle is a

More information

Total. Name: Signature: Circle course section: MW 9-11 MW 11-1 MW 6-8 TTh 9-11 TTh 1-3

Total. Name:   Signature: Circle course section: MW 9-11 MW 11-1 MW 6-8 TTh 9-11 TTh 1-3 Name: Email: Signature: Circle course section: MW 9-11 MW 11-1 MW 6-8 TTh 9-11 TTh 1-3 Lehman College, CUNY CMP 167 Final Exam, Version 3, Spring 2015 1. What will the following code print: s = "haskell::curry::utrecht::glasgow"

More information

CISC 1600, Lab 3.2: Interactivity in Processing

CISC 1600, Lab 3.2: Interactivity in Processing CISC 1600, Lab 3.2: Interactivity in Processing Prof Michael Mandel 1 Getting set up For this lab, we will be using OpenProcessing, a site for building processing sketches online using processing.js. 1.1.

More information

CMPSCI 119 Fall 2018 Wednesday, November 14, 2018 Midterm #2 Solution Key Professor William T. Verts

CMPSCI 119 Fall 2018 Wednesday, November 14, 2018 Midterm #2 Solution Key Professor William T. Verts CMPSCI 119 Fall 2018 Wednesday, November 14, 2018 Midterm #2 Solution Key Professor William T. Verts 25 Points What is the value of each expression below? Answer any 25; answer more for extra credit.

More information

CISC 1600, Lab 3.1: Processing

CISC 1600, Lab 3.1: Processing CISC 1600, Lab 3.1: Processing Prof Michael Mandel 1 Getting set up For this lab, we will be using OpenProcessing, a site for building processing sketches online using processing.js. 1.1. Go to https://www.openprocessing.org/class/57767/

More information

Lesson 18: Animation. Computer Programming is Fun!

Lesson 18: Animation. Computer Programming is Fun! Lesson 18: Animation So how do you make your drawings move and change? That's what this section is about. I'd like to introduce you to your new friend, Mr. Timer. A timer gives you the ability to tell

More information

Total. Name: Signature: Circle course section: MW 9-11 MW 11-1 MW 6-8 TTh 9-11 TTh 1-3

Total. Name:   Signature: Circle course section: MW 9-11 MW 11-1 MW 6-8 TTh 9-11 TTh 1-3 Name: Email: Signature: Circle course section: MW 9-11 MW 11-1 MW 6-8 TTh 9-11 TTh 1-3 Lehman College, CUNY CMP 167 Final Exam, Version 2, Spring 2015 1. What will the following code print: s = "objcbjabjmbjl"

More information

Lecture 19: Subclasses & Inheritance (Chapter 18)

Lecture 19: Subclasses & Inheritance (Chapter 18) http://www.cs.cornell.edu/courses/cs1110/2018sp Lecture 19: Subclasses & Inheritance (Chapter 18) CS 1110 Introduction to Computing Using Python [E. Andersen, A. Bracy, D. Gries, L. Lee, S. Marschner,

More information

Permission to copy The CAD Academy

Permission to copy The CAD Academy Use LISP to Program in A+CAD Permission to copy The CAD Academy We are going to create a small program in LISP, a language used in artificial intelligent programs, to interact with our CAD program A+CAD.

More information

Turtle Art User Guide. OLPC Pakistan Documentation Project

Turtle Art User Guide. OLPC Pakistan Documentation Project Turtle Art User Guide OLPC Pakistan Documentation Project Turtle Art Users Guide By OLPC Pakistan Documentation Project. Copyrights 2008 OLPC Pakistan and members of OLPC Pakistan Team Abstract Welcome

More information

Answer Key: CMP 167 Final Exam, Version 4, Spring 2015

Answer Key: CMP 167 Final Exam, Version 4, Spring 2015 CMP 167 Final Exam, Version 4, Spring 2015 1. What will the following code print: s = "List (Processing (John (McCarthy" a = s[0:3] print(a.lower()) names = s.split(" (") print(names) b = names[1] c =

More information

CSE 142, Autumn 2018 Programming Assignment #9: Critters (20 points) Due Tuesday, December 4th, 9:00 PM

CSE 142, Autumn 2018 Programming Assignment #9: Critters (20 points) Due Tuesday, December 4th, 9:00 PM CSE 142, Autumn 2018 Programming Assignment #9: Critters (20 points) Due Tuesday, December 4th, 9:00 PM This assignment focuses on classes and objects. Turn in Ant.java, Bird.java, Hippo.java, Vulture.java,

More information

Structure and Interpretation of Computer Programs Spring 2017 Mock Midterm 1

Structure and Interpretation of Computer Programs Spring 2017 Mock Midterm 1 CS 61A Structure and Interpretation of Computer Programs Spring 2017 Mock Midterm 1 INSTRUCTIONS You have 1 hour to complete the exam. The exam is closed book, closed notes, closed computer, closed calculator,

More information

RETURN X return X Returning a value from within a function: computes the value of variable exits the function and returns the value of the variable

RETURN X return X Returning a value from within a function: computes the value of variable exits the function and returns the value of the variable STUDENT TEACHER CLASS WORKING AT GRADE TERM TARGET YEAR TARGET Pseudocode Python Description BEGIN END Identifies the start of a program Identifies the end of a program READ X, Y, Z input() Identifies

More information

CSCI 101 Midterm Sample Questions

CSCI 101 Midterm Sample Questions CSCI 101 Midterm Sample Questions Note: you may bring one 8.5"x11" double-sided sheet of notes for your use during the exam (handwritten or typed). Otherwise, no notes, computers, calculators, phones or

More information

Processing Assignment Write- Ups

Processing Assignment Write- Ups Processing Assignment Write- Ups Exercise 1-1 Processing is not an elaborate series of points like connect the dots or is it? Can t be cause I got it all wrong when I mapped out each and every point that

More information

Introduction to Python (All the Basic Stuff)

Introduction to Python (All the Basic Stuff) Introduction to Python (All the Basic Stuff) 1 Learning Objectives Python program development Command line, IDEs, file editing Language fundamentals Types & variables Expressions I/O Control flow Functions

More information

PLC Papers Created For:

PLC Papers Created For: PLC Papers Created For: Year 10 Topic Practice Papers: Polygons Polygons 1 Grade 4 Look at the shapes below A B C Shape A, B and C are polygons Write down the mathematical name for each of the polygons

More information

REAL LIFE REAL WORLD Activity: Archeologist Frieze Patterns

REAL LIFE REAL WORLD Activity: Archeologist Frieze Patterns Teacher Page 1 REAL LIFE REAL WORLD Activity: Archeologist Frieze Patterns Topic: Reflections and Translations Grade Level: 7-12 Objective: Use Cabri Jr. to create examples of frieze patterns Time: 30-60

More information

CSSE 120 Introduction to Software Development Practice for Test 1 paper-and-pencil part Page 1 of 6

CSSE 120 Introduction to Software Development Practice for Test 1 paper-and-pencil part Page 1 of 6 CSSE 120 Introduction to Software Development Practice for Test 1 paper-and-pencil part Page 1 of 6 Name: Use this quiz to help you prepare for the Paper-and-Pencil portion of Test 1. Complete it electronically

More information

CS108L Computer Science for All Module 8: Recursion and the Fractal Tree

CS108L Computer Science for All Module 8: Recursion and the Fractal Tree CS108L Computer Science for All Module 8: Recursion and the Fractal Tree Fig 1: Program in its final stage of development. Model Overview: In this NetLogo model, the goal is to create a recursive program

More information

Chapter 13. Turtle Graphics Introduction Turtle Basics

Chapter 13. Turtle Graphics Introduction Turtle Basics Chapter 13 Turtle Graphics 13.1 Introduction Graphical User Interfaces (GUI s) provide a rich environment in which information can be exchanged between a user and the computer. GUI s are not limited to

More information

NetLogo Tutorial Series: Langton's Ant. Nicholas Bennett Grass Roots Consulting

NetLogo Tutorial Series: Langton's Ant. Nicholas Bennett Grass Roots Consulting NetLogo Tutorial Series: Langton's Ant Nicholas Bennett Grass Roots Consulting nickbenn@g-r-c.com July 2010 Copyright Copyright 2010, Nicholas Bennett. All rights reserved. NetLogo Tutorial Series: Langton's

More information

Use lists. Use loops. Use conditionals. Define and use functions. Create and use code modules

Use lists. Use loops. Use conditionals. Define and use functions. Create and use code modules Hunt the Wumpus Objectives Use lists Use loops Use conditionals Define and use functions Create and use code modules Assignment Hunt the Wumpus is a game that has been around in computing for over 40 years.

More information

Functionally Modular. Self-Review Questions

Functionally Modular. Self-Review Questions Functionally Modular 5 Self-Review Questions Self-review 5.1 Which names are local, which are global and which are built-in in the following code fragment? Global names: Built-in names: space_invaders

More information

Answer Key: CIS 166 Final Exam, Version 1, Spring 2015

Answer Key: CIS 166 Final Exam, Version 1, Spring 2015 CIS 166 Final Exam, Version 1, Spring 2015 1. What will the following code print: s = "Ada=>Lovelace=>Charles=>Babbage" a = s[0:3] print(a.upper()) names = s.split("=>") print(names) b,c,d = names[1],names[2],names[3]

More information

CS12020 for CGVG. Practical 2. Jim Finnis

CS12020 for CGVG. Practical 2. Jim Finnis CS12020 for CGVG Practical 2 Jim Finnis (jcf1@aber.ac.uk) This week Solution to last week and discussion Global variables and the model The Main Loop pattern States and the State Machine pattern Random

More information

Introduction to Scratch Programming v1.4 (Second Ed) Lesson 6 Calculator

Introduction to Scratch Programming v1.4 (Second Ed) Lesson 6 Calculator Lesson What you will learn: how to perform simple calculations using Scratch how to use variables how to develop a design how to use the else if function how to create animated buttons Contents Exercise

More information

Day 1: Introduction to MATLAB and Colorizing Images CURIE Academy 2015: Computational Photography Sign-Off Sheet

Day 1: Introduction to MATLAB and Colorizing Images CURIE Academy 2015: Computational Photography Sign-Off Sheet Day 1: Introduction to MATLAB and Colorizing Images CURIE Academy 2015: Computational Photography Sign-Off Sheet NAME: NAME: Part 1.1 Part 1.2 Part 1.3 Part 2.1 Part 2.2 Part 3.1 Part 3.2 Sign-Off Milestone

More information

Maximum and Minimum Slopes Wilfrid Laurier University

Maximum and Minimum Slopes Wilfrid Laurier University Maximum and Minimum Slopes Wilfrid Laurier University Wilfrid Laurier University December 12, 2014 In this document, you ll learn: In this document, you ll learn: how to determine the uncertainties in

More information

Subject : Mathematics Level B1 Class VII Lesson: 1 (Integers)

Subject : Mathematics Level B1 Class VII Lesson: 1 (Integers) Subject : Mathematics Level B1 Class VII Lesson: 1 (Integers) Skill/Competency /Concept Computational Skill Properties of Addition and subtraction of integers Multiplication and division Operation on integer.

More information

There are 2 weeks of fill-in-the-blank s that you can use to promote any related internet marketing products that you like.

There are 2 weeks of fill-in-the-blank  s that you can use to promote any related internet marketing products that you like. Email #1: Subject: The SUPER shortcut to making money online If you've been building a list, you should know that writing emails can be very hard... Especially when you want to write emails that convert

More information

append() function, 66 appending, 65, 97, 296 applications (apps; programs), defined, 2, 296

append() function, 66 appending, 65, 97, 296 applications (apps; programs), defined, 2, 296 Index Note: Page numbers followed by f, n, or t indicate figures, notes, and tables, respectively. Symbols += (addition and assignment operator), 100, 187 + (addition operator), \ (backslash), 240 / (division

More information

Painting your window

Painting your window The Paint event "Painting your window" means to make its appearance correct: it should reflect the current data associated with that window, and any text or images or controls it contains should appear

More information

Graphics Module Reference

Graphics Module Reference Graphics Module Reference John M. Zelle Version 4.1, Fall 2010 1 Overview The package graphics.py is a simple object oriented graphics library designed to make it very easy for novice programmers to experiment

More information

CS16 Final Exam E03, 10S, Phill Conrad, UC Santa Barbara Wednesday, 06/09/2010

CS16 Final Exam E03, 10S, Phill Conrad, UC Santa Barbara Wednesday, 06/09/2010 CS16 Final Exam E03, 10S, Phill Conrad, UC Santa Barbara Wednesday, 06/09/2010 Name: Umail Address: @ umail.ucsb.edu Circle Lab section: 9AM 10AM 11AM Noon Link to Printer Friendly PDF Version Please write

More information

SOLIDWORKS: Lesson III Patterns & Mirrors. UCF Engineering

SOLIDWORKS: Lesson III Patterns & Mirrors. UCF Engineering SOLIDWORKS: Lesson III Patterns & Mirrors UCF Engineering Solidworks Review Last lesson we discussed several more features that can be added to models in order to increase their complexity. We are now

More information

Quick Reference Tables

Quick Reference Tables Quick Reference Tables Chapter 1 Raspberry Pi Startup Command Quick Reference Table Command startx sudo sudo shutdown -h now sudo shutdown -r now Launches the Raspbian desktop environment (GUI). Gives

More information