Update Foxsays w/ README

This commit is contained in:
2025-09-13 21:22:37 -04:00
parent 3998dd807d
commit 6e7db90d1c
5 changed files with 113 additions and 4 deletions

101
Foxsays/README.md Normal file
View File

@@ -0,0 +1,101 @@
# Coding 1: What the Fox Says
This is a fairly easy warmup coding homework designed to get you used to the
mechanics of the questions/homework assignments for this class.
Remember when this went viral?
[Ylvis - The Fox (What Does The Fox Say?) [Official music video HD]](https://www.youtube.com/watch?v=jofNR_WkoCE)
## The Problem
Motivated by solving the ancient mystery you are going to figure out exactly
what the fox says from a transcript of a recording of animal sounds from the
forest. You are working with a team of scientists who have already figured out
what sounds all of the other animals make. Your task is to filter out the known
forest sounds to determine once and for all, what does the fox say?
## Input
The input consists of one line of forest noises given as a series of words
separated by spaces. The next line of input is a number n describing how many
known animal sounds there are. The next n lines describe n animal sounds given
in the format "_[animal name] goes [noise]_".
## Output
The output consists of two lines, the first is the list of sounds in order
uttered by our shy, sly fox. The last line lists the names of any other animals
heard in the recording in the order in which they were first heard with no
animal repeated (the scientists asked you for this for research purposes). The
first line should be formatted "_what the fox says: [whatever the fox did
say]_". The last line should be formatted "_also heard: [space separated list of
animals also heard in order they were heard]_". There should be NO spaces
following the last thing the fox says and the last animal name (just a new line
character).
<table>
<tr>
<td>Sample Input</td>
<td>Sample Output</td>
</tr>
<tr>
<td><pre>toot woof wa ow ow ow pa blub blub pa toot pa blub pa pa ow pow toot<br>5<br>dog goes woof<br>fish goes blub<br>elephant goes toot<br>seal goes ow<br>horse goes neigh</pre></td>
<td><pre>what the fox says: wa pa pa pa pa pa pow<br>also heard: elephant dog seal fish</pre></td>
</tr>
</table>
## Your Task
Your task is to implement two versions of the program solving the code above.
The first version (**cs412_foxsays_list.py**) should **only use** list data
structures. The second version (**cs412_foxsays_dict.py**) must utilize
maps/dictionaries and set data structures to speed up your code as much as
possible.
Gradescope is checking for dictionaries to NOT be in the first version and for a
dictionary to be in the second version.
## Test Cases
Example input/output:
### Test #1:
- Input file: [foxsays_t1_in.txt](./inputs/foxsays_t1_in.txt)
- Output file: [foxsays_t1_exp.txt](./outputs/foxsays_t1_exp.txt)
### Test #2:
- Input file: [foxsays_t2_in.txt](./inputs/foxsays_t2_in.txt)
- Output file: [foxsays_t2_exp.txt](./outputs/foxsays_t2_exp.txt)
There is a unittest file that you can download
([foxsays_unittest.py](./foxsays_unittest.py)) and use to test your program. See
the programming guidelines (located here in canvas:
[CS412_CodingAssignmentGuidelines.pdf](https://canvas.jmu.edu/courses/2112008/files/180153311?wrap=1))
which specifies how to structure your program and also how to use the unittest
file.
You can use a diff program to compare your output to these examples before
submitting to [Gradescope](http://www.gradescope.com/).
## Code Templates for this class
Your python code must utilize this template:
[cs412_code_template.py](../cs412_code_template.py)
## Turning it in
Turn in these two files (cs412_foxsays_list.py and cs412_foxsays_dict.py) to
Gradescope. Here are some larger test files to see how fast your program runs:
- [foxsays_tleader_in.txt](./inputs/foxsays_tleader_in.txt) and
[foxsays_tleader_exp.txt](./outputs/foxsays_tleader_exp.txt)
## Leaderboard/Speed Check
Your code will be checked for speed and a leaderboard posted within Gradescope.
## Acknowledgments
Problem from Kattis are used under their educational license.

View File

@@ -0,0 +1,2 @@
what the fox says: wa pa pa pa pa pa pow
also heard: elephant dog seal fish

View File

@@ -0,0 +1,2 @@
what the fox says: fox makes sounds
also heard:

File diff suppressed because one or more lines are too long

View File

@@ -1,18 +1,20 @@
"""
name: Your name(s) here
name: Your name(s) here
Honor Code and Acknowledgments:
Honor Code and Acknowledgments:
This work complies with the JMU Honor Code.
This work complies with the JMU Honor Code.
Comments here on your code and submission.
Comments here on your code and submission.
"""
# All modules for CS 412 must include a main method that allows it
# to imported and invoked from other python scripts
def main():
# your code here
pass
if __name__ == "__main__":
main()