BYU logo Computer Science

To start this assignment, download this zip file.

Homework 1a β€” Introduction to Bit

Preparation

Download the zip file listed above, extract its contents, and put the files into a folder called homework1a, inside of your cs110 folder. Your folder organization should look like this:

file organization for homework 1a

Notice that in this folder you have some Python files and then a directory called worlds. This directory contains worlds that Bit can operate in. When you see a line like this in a Python file:

@Bit.worlds('fix-me')

this tells Bit to use the world called fix-me.start.txt inside of the worlds folder. It uses fix-me.finish.txt to check whether you reached the correct finishing world.

1. Fix me

You are given some code in fix_me.py. Bit starts from a blank 5x3 world:

a blank 5x3 Bit world

Bit should finish with a world that looks like this:

three green squares on the bottom, with one blue square on the top

Run the code in fix-me.py. It will finish with a comparison error. Fix the error so the code runs correctly.

2. Fix me too!

You are given some code in fix_me_too.py. Bit starts from a blank 5x3 world:

a blank 5x3 Bit world

Bit should finish with a world that looks like this:

a mix of red, blue, and green colors

Run the code in fix-me-too.py. It will show an error in the terminal. Fix the error so the code runs correctly.

Note: there are multiple errors in this file

3. Make me smile

You are given some starter code in make-me-smile.py. Bit starts from a 7x6 world with just some eyes:

a blank 5x3 Bit world

Bit should finish with a world that has a completed smile:

a mix of red, blue, and green colors

Write code in make-me-smile.py to complete the smile.

Note: you need the correct finishing position and direction for Bit as well!

4. Picasso

Now it’s your turn! Write a script called picasso.py that draws whatever you want.

Follow the pattern we used in Lab 1a, Exercise 1, which shows how to start from an empty world. Use a world of size 8x8.

You can call your function anything you want, but a good name is picasso :-)

πŸ§‘πŸΌβ€πŸŽ¨

Rules:

  • you have to move/turn/paint at least 20 times

Grading

Turn your Python files in on Canvas, which will link you to Gradescope.

ActivityPoints
fix_me.py5
fix_me_too.py5
make_me_smile.py5
picasso.py5