This is a group assignment. Remember that you should always be working with your partner. You may NOT divide up the work and complete the parts independently. All work you submit must be fully authored by both you and your partner.
Part 1: Word Search Puzzles
A word search puzzle is a game that consists of a list of words and a large table of characters, and the objective is to find every given word in the table. The challenge is that the words may appear horizontally, vertically, or diagonally; similarly, they may appear backwards or forwards. Thus, there are eight possible orientations of a word in the table. To make them especially hard to find, any unused space in the table is filled with random characters.
Below is an example of a word search puzzle.
List of Words:
Table of Letters
Word Search Algorithm
Your task for this part is to describe an algorithm that, when given an arbitrary word search puzzle, will help me successfully find the locations of all the words. Since you do not know much Python yet, your algorithm will be written in English prose and I will execute your algorithm with pencil and paper. The challenge of the problem is that you must assume that I have very limited memory, but I have access to a lot of paper and a pencil.
You may assume that I can do the following things reliably:
- Understand the English alphabet,
- Draw symbols such as alphabetic characters or place special markings on characters (e.g. circling, drawing a line through, or placing a dot above a character or word),
- Use an eraser extremely precisely (e.g. remove a marking from a character),
- Remember a few words or characters in my head, but not more than three,
- Recognize a word or character I am thinking about, and
- Use my fingers to keep track of where I am on the paper and understand concepts such as left, right, up, down, etc.
You may also assume that I know how to copy the list of words and the entire table of characters onto paper so that I can mark on it in future instructions.
Given your algorithm, I should be able to solve any word search puzzle (with any number of words and a board of any size). After executing your algorithm, I should be holding a piece of paper that includes the original table of characters with each of the hidden words circled.
- Start by solving the above word search puzzle yourself and take note of what you are doing to solve it. Now try to formalize that strategy so that it can be used to solve any search problem.
- Since your algorithm will likely need to repeatedly do similar operations, consider decomposing the problem into subroutines to save work. (e.g. a
find_single_wordthat searches for a specific word I am currently thinking of)
- You can name certain parts of the puzzle or marks on the paper using a variable. For example, naming something
cur_wordmight be helpful.
- You can make use of repetition and repeatedly do operations for each element in a set. (e.g.
using a pencil mark to keep track of your place in the row, execute [subroutine] on each character in the row)
Start by downloading the word_search.txt template file. Put the names of all of your partners at the top of the file, and write your algorithm at the bottom of the file.
Part 2: Temperature Converter
Write a Python program named
convert.py that converts temperatures from Fahrenheit to Celsius. When you run the program in Thonny, it should prompt the user for a number, and then print the result. Below is an example of what the interaction might look like:
Enter a temperature in Fahrenheit: 70.0 The temperature in Celsius is: 21.11111111111111
chaos.py code from the Getting Started with Python lab as a template to get started. There are also several examples from the readings that could be helpful.
How to Turn in Your Code
- Once you are finished with the assignment, you should go to https://codepost.io and log into your account.
- Go to the CS 65 course.
- Go to Assignment 2 and upload all of your files.
- After you submit the assignment, you should be able to reopen it and see a Partners tab at the top of the submission page. Send the link to your partner and have them open it while logged in with their account.
- That’s it! You’ve just submitted your assignment.
Important Grading Criteria
Your assignment will be graded according to the following criteria:
- SUBMISSION. Are the files submitted correctly?
- PART 1.
- READABILITY. Is the algorithm clear and easy to understand?
- DETAIL. Is the algorithm written with the appropriate level of detail? Are the instructions of appropriate complexity? (e.g. simple enough for the actor to understand what’s being asked)
- COMPONENTS. Does the algorithm make good use of conditionals, repetition, etc., and/or broken down into helpful subroutines?
- PART 2.
- Is the program named correctly?
- Does it prompt the user with a helpful message?
- Does it work correctly?