Nifty Assignments - ACM Digital Library

advertisement
Nifty Assignments
Nick Parlante, Julie Zelenski
Josh Hug
(moderators)
Stanford University
Princeton University
nick.parlante@cs.stanford.edu
zelenski@cs.stanford.edu
John DeNero
University of California, Berkeley
denero@cs.berkeley.edu
jhug@cs.princeton.edu
Antti Laaksonen
University of Helsinki
ahslaaks@cs.helsinki.fi
Frank McCown
Harding University
fmccown@harding.edu
John Nicholson
Austin Peay State University
nicholsonja@apsu.edu
Arto Vihavainen
University of Helsinki
avihavai@cs.helsinki.fi
Kevin Wayne
Princeton University
wayne@cs.princeton.edu
Analyzing the Google Books Dataset (CS1) Josh Hug
Categories and Subject Descriptors
K.3.0 [Computers and Education]: General.
The Google books Ngram dataset provides, among other things,
a tabulation of the number of times that any particular English
word appeared in any known volume in any particular year
since the 1500s. For example, "thou" appeared 23,166 times in
1805.
General Terms
Algorithms, Design, Languages
Keywords
Education; assignments; homeworks; examples; repository;
library; nifty; pedagogy
In the first part of this assignment, students create something
like the Google Ngram Viewer, allowing them to visualize the
relative popularity of a specified set of words over a specified
time interval, e.g. "God" is dead (as of the 1850s), but he's
seemingly staging a comeback. To this end, students read an
input .csv file and build a simple associative array per word and
use these mappings to draw basic plots.
Abstract
A great CS assignment is a delight to all, but the path to one can
be most roundabout. Many CS students have had their
characters built up on assignments that worked better as an idea
than as an actual assignment. Assignments are hard to come up
with, yet they are the key to student learning. The Nifty
Assignments special session is all about promoting and sharing
the ideas and ready-to-use materials of successful assignments.
In the second part of this assignment, students explore aggregate
properties of an entire dataset, including the frequencies of
English letters, the distribution of word frequencies (revealing
the surprising Zipf's law), and the average length of words in
books, allowing us to crudely probe the hypothesis that we're all
getting a little bit dumber. This necessitates a more sophisticated
associative array that stores the entire input file.
Each presenter will introduce their assignment, give a quick
demo, and describe its niche in the curriculum and its strengths
and weaknesses. The presentations (and the descriptions below)
merely introduce each assignment. A key part of Nifty
Assignments is the mundane but vital role of distributing the
materials – handouts, data files, starter code – that make each
assignment ready to adopt. The Nifty Assignments home page,
http://nifty.stanford.edu, gathers all the assignments and
makes them and their support materials freely available.
This assignment is intended to be a two week assignment, and
was originally built as a highly scaffolded introduction to
associative arrays, string processing, high level (CSV) file I/O,
and visualization for novice programmers. The difficulty can be
tweaked by varying the degree of scaffolding, and there are
ample opportunities for exploring additional properties of the
dataset.
If you have an assignment that works well and would be of
interest to the CSE community, please consider applying to
present at Nifty Assignments. See the nifty.stanford.edu home
page for more information.
Game of Sticks (CS1) Antti Laaksonen, Arto Vihavainen
For this nifty assignment, we approach a traditional game in a
very novel way. Game of Sticks is a turn-based game that starts
with a heap of sticks on a board. On each turn, the player has to
take one, two or three sticks from the heap, and the player who
clears the board loses the game.
Permission to make digital or hard copies of part or all of this work for
personal or classroom use is granted without fee provided that copies
are not made or distributed for profit or commercial advantage and that
copies bear this notice and the full citation on the first page.
Copyrights for third-party components of this work must be honored.
For all other uses, contact the Owner/Author. Copyright is held by the
owner/author(s).
SIGCSE '14, March 5-8, 2014, Atlanta, Georgia, USA.
ACM 978-1-4503-2605-6/14/03.
http://dx.doi.org/10.1145/2538862.2538995
In this assignment the students first implement game of sticks as
a two-player game and then craft a simple AI that is able to
learn from its mistakes. Once the AI has been implemented, the
students study the learning process of the AI and derive an
optimal strategy. In addition, the students can be asked to give a
mathematical proof on why the strategy works.
621
favorite. The project has an exhaustive suite of test cases that we
distribute to our students. There is ample room for extension
beyond the required questions.
The main strength of this assignment is that it acts as an
introduction to AI that can learn from its mistakes, and also
shows that often there is little magic behind learning algorithms
— one just has to start small. In our context the assignment has
been a hit; many are awed by the fact that, in their first semester
of studies, they can produce an AI that is able to learn how to
beat them (and their friends) at a game.
Segregation Simulation (CS1) Frank McCown
Racial segregation has always been a pernicious social problem
in the United States, extending into our schools, churches, and
neighborhoods. Why is it such a difficult problem to eradicate?
This nifty assignment has students implement the economist
Thomas Schelling’s segregation model which gives some
insight as to why people often choose to self-segregate even
when they do not have an explicit desire to do so. This
fascinating program models how individuals move about from
location to location until they settle in a place where they are
surrounded by similar individuals.
Purple America (CS1) - Kevin Wayne
Write a program to visualize U.S. national or statewide election
results, coloring each region in a combination of red, green, and
blue to illustrate the fraction of votes won by the Republican,
Indepenent, and Democratic political party candidates. The
visualization is a mashup of geometric data of state and county
boundaries (from the U.S. Census Bureau) and election results
(from David Leip's Atlas of U.S. Presidential Elections). The
results reveal that the U.S. is not as polarized as some political
pundits would have us believe.
CS1 students can write this program knowing only 2D arrays
and console I/O although more visually appealing programs
might take advantage of a programming language’s graphics
capabilities. This assignment has also been given to
upperclassmen who used HTML5 and jQuery to create visually
appealing interfaces. The project parameters can be altered
easily to increase or decrease the level of implementation
difficulty for students.
In this assignment, students build several simple data structures
to model the geometric and election return data (e.g., polygons,
counties, states, and elections). We provide the data in easilyparsable text files. By combining about 100 lines of good code
with the prepared data, students produce striking election-map
visualizations.
This assignment also features numerous opportunties for
embellishment, extension, and exploration:
Schelling’s model of segregation gives instructors an
opportunity to discuss a real societal problem that students are
naturally interested in. The assignment gives students the
chance to implement a program which is visually compelling
and one that produces an often unintuitive result.
• Design a different color palette.
• Visualize the change in votes from one election to the next.
• Apply a different map projection, such as Albers, Mercator,
or Gall-Peters.
Image Stacking and the Pesky Tourist (CS2)
- John Nicholson
• Find, parse, screen scrape, scrub, and incorporate data from
elections in other countries.
Image Stacking and the Pesky Tourist are two related
assignments used to introduce basic image-processing
techniques. They rely on the text-based PPM image format, and
help students learn to manage multiple files inside one program.
These assignments are targeted towards students who have been
introduced to reading and writing files and are ready to be
introduced to basic file formats such as the PPM format.
Students are able to create programs that solve real-world
problems and have strong visual feedback.
• Create an interactive GUI that reports election results for a
region, as the user hovers over it.
Object-Oriented Tower Defense (CS1) John DeNero, Tom Magrino, and Eric Tzeng
Students build a game called Ants Versus SomeBees, a Python
clone of the popular Plants Versus Zombies mobile puzzle
game. The game logic is chosen to illustrate a breadth of objectoriented programming concepts such as inheritance, method
overloading, and class attributes. An extra credit question
probes the interaction of the Python object system and higherorder functions.
The Image Stacking assignment introduces image averaging in
which multiple noise-filled images of the same object are
averaged together to create a new noise-free image. An image
from the Hubble telescope is processed by the instructor to
create a set of noisy images, which mimic the noise that occurs
when photographing long-range objects. Students then create a
noise-free image of the celestial object by averaging the noisy
images together. That the student's code can transform a bunch
of bad images into one great image has the feeling of magic.
The niftiest aspect of the project is that students start developing
the game logic as a command-line tool, testing specific
interactions interactively, one turn at a time. Then, they can
play the same game with a graphical interface provided to them.
Playing the game graphically prints out method invocations
used, so that students can trace issues with their implementation
back to specific method definitions without using a visual
debugger or blanketing their source code with print statements.
The Pesky Tourist assignment demonstrates a related noise
removal technique, the median filter, in which the median value
for each pixel from multiple images is used to create a noisefree image. The noise in this case is a tourist who keeps
blocking a statue. Students are given a series of photos of a
statue, with the tourist in a different position in each image.
When students apply the median filter to these images, the final
image only shows the statue with the tourist being completely
removed.
Graphics are themed by university logos. By default, the Cal
ants defend their colony from the Stanford bees. Instructors can
customize the graphics to any pair of NCAA Division 1 teams
or other uploaded images using our project generator.
Among four projects in Berkeley's introductory programming
course, CS 61A, 56% of students listed this project as their
622
Download