| Integrating Empirical Methods into Computer Science | |
|
Project Goals Required Skills Lab Repository Related Papers Collaborators Feedback |
||
Empirical Lab RepositoryTitle: Experimentation with Random Sentences Author: Dave Reed, Creighton University, davereed@creighton.edu Possible Courses: CS0, CS1 Empirical Concepts Introduced: Monte Carlo Methods, expected values Computer Science Concepts Used: functional abstraction, generating random values, grammar rules Summary: This assignment involves writing a sequence of JavaScript functions for generating parts of speech, phrases, and entire sentences. The structure of the phrases and sentences are defined by grammar rules. Building upon a provided library of functions, the student will start with simple function definitions and build upon them to obtain the full complexity of sentences. Once he/she has completed the code, the student must reason about its behavior, make predictions as to the length and composition of sentences, and use the code to generate sentences and verify/refute the predictions. Variations: While the assignment is presented in the scripting language JavaScript, it could easily be translated into other program languages, such as C++ and Java. The instructor would need to provide the functionality of the RandomOneOf function, which takes a list of values and returns a randomly selected value from that list.
|