January 28, 2017
Python | CIS 211 Project 3: OOP

1/27/2017 planets (1)
CIS 211 Project 3: OOP Due 11:00 P.M. January 27, 2017
Reading: M&R 10.1 ­­ 10.4
Our goal this week is to gain some experience writing class definitions for some simple objects. The classes are part of a solar system simulation. This week we’ll define the objects used in the simulation. Next week we’ll implement the simulation itself, and later in the term we’ll add visualization.
Part 1: Vectors (50 points)
Define a class named Vector. Instances of this class will be Euclidan vectors (https://en.wikipedia.org/wiki/Euclidean_vector (https://en.wikipedia.org/wiki/Euclidean_vector)).
An instance of this class will have three attributes, representing , , and coordinates in space. When a Vector object is created the constructor should be passed three numbers to use as the initial values of the coordinates.
Your class should also have:
accessor functions named x, y, and z, which return the current value of the specified coordinate
a __repr__ function that displays a Vector as a tuple of 3 numbers; use “%.3g” in the format statement so coordinates are shown with 3
significant digits
methods that implement ==, +, ‐, and * operations (see below)
a method named norm that computes the length, or magnitude, of the vector, defined by the equation
a method named clear that sets all coordinates to 0
To see if two vectors are equal, simply see if their , , and components are the same. This will almost certainly fail (due to roundoff errors) when the coordinates are of the size used in the solar system simulation, but it will help test the other operations, and we’ll use small numbers in these tests.
To add or subtract two vectors, make a new vector that has the sum or difference of the components of two existing vectors.
The method that implemements multiplication should implement scalar multiplication: the second operand should be an integer or a float, and the result is a new vector where all components are multiplied by the scalar.

May 29, 2016
Python | Finance | Quantitative Trading

Quantitative Trading Project
April 26, 2016
1 The Task
As part of our program of study, you (and 0, 1 or 2 group partners) will invent, run and analyze a quantitative trading strategy. Such a strategy has the following features:
• Investmentinpubliclytraded(butnotnecessarilyelectronicallytraded) assets
• A “recipe” for evaluating attractiveness of potential trades that – depends on pre-specified classes of information
– Could be followed by anyone, given the recipe and data sources
• A “recipe” for investment sizes, and position entry and exit rules, that
– may link position size to attractiveness

April 22, 2016
Data Mining |Machine Learning | Final Term Project: Option 2 Unsupervised Data Mining (Clustering)

Part 1
Generate a set S of 500 points (vectors) in 3-dimensional Euclidean space. Use the Euclidean distance to measure the distance between any two points. Write a program to find all the outliers in your set S and print out these outliers. If there is no outlier, your program should indicate so. Use any programming language of your choice (specify the programming language you use in the project).
Next, remove the outliers from S, and call the resulting set S’.

Part 2
(1) Write a program that implements the hierarchical agglomerative clustering algorithm taught in the class to cluster the points in S’ into k clusters where k is a user-specified parameter value.
(2) Repeat part 1 and (1) above on two additional different datasets.
Notes on the hierarchical agglomerative clustering algorithm
In determining the distance of two clusters, you should consider the following definitions respectively: 
the distance between the nearest two points in the two clusters, 
the distance between the farthest two points in the two clusters, 
the average distance between points in the two clusters, 
the distance between the centers of the two clusters.
Use the definition that yields the best performance where the performance is measured by the Silhouette coefficient.

April 16, 2016
Programming Assignment 1 Due:Friday: 4/18/16 8PM PST 1

Programming Assignment 1
Due:Friday: 4/18/16 8PM PST 1
1 Overview
Your task is to complete a UDP peer-to-peer client which contacts a registration server to obtain a peer ID. Your peer will also contact the registration server to download a list of available peers you can contact. With this contact list you can send messages between peers.
Your code must work in the UNIX environment.
You may use any programming language you wish, but like the previous programming as- signment, we recommend you use Python as its the supported language in this class.
Remember Postel’s Law/the Robustness Principle: Be conservative in what you send, be liberal in what you accept. Handle errors (for example, malformed messages) as gracefully as you can.

April 4, 2016
game Battleship python implementation

4.1 Overview

Computer games are nearly as old as electronic computers themselves. The first tic-tac-toe game was programmed on an EDSAC vacuum-tube computer. Your job will be to expand the Battleship program started in earlier labs into a fully-playable game.

4.2 The game of Battleship

Wikipedia has a thorough description of the origins of the game of Battleship. For purposes of this assignment, follow the following rules.

1.The game is played between two players (one human and one computer for your program).

2.Each player has an identical set of ships. Each ship has a length, a name (e.g., “submarine”), and a symbol (a letter, e.g., “S”).

October 17, 2015
GMU cs112 solution

This semester you will be writing a program that models elements of recognizing and creating characters. Optical character recognition is an important area of research that allows photographs or printed documents to be digitized; by doing so, these documents are made available for machine-based searching. On the flip side, http://en.wikipedia.org/wiki/CAPTCHAis a system for differentiating between humans and computers: the goal here is to generate a non-machine readable image that a human could identify. CAPTCHA helps reduce the amount of spam on the Internet.

We will implement a highly limited type of image matching, processing, and creation this semester. Rather than write this project at once, we will break the project down into several two-week sub-projects that are due throughout the semester. The rest of this document will detail the first such assignment.


  • None at this time

This final assignment will ask you to write some code that will help you determine if a pixel is part of a number. You will need to copy your project 3, 4, and 5 solutions into the same directory where you save your files for this project.

You will have to do the following for this assignment:

  • Complete the methods of the Banner class.
  • Write a main function in a file called project5.py.

July 6, 2015
Grocery Store Simulation

Assignment 1 – Grocery Store Simulation

Marking scheme posted!

Sample tests posted! (See the unit test file for details.)

Grocery stores often have a difficult task: they must determine how many employees to hire to staff checkout lines during varying levels of customers throughout the day. Too few open lines means customers spend time angrily waiting; too many, and the store loses money paying its employees. It’s also important to get the right mix of regular and express checkout lines, and perhaps even self-serve lines. Which combination is best depends on what kind of customers the store has.

In this assignment, you’ll build an event-driven simulation for a grocery store, which will model customers using different types of checkout lines. Your finished product will be able to set up the simulation with data from file inputs, simulate a sequence of events, and report timing statistics after the simulation is complete that will help determine how successful the checkout line set-up was for that set of customer arrivals.

Simulation description

Read through the following description carefully. Your overall task for this assignment will be to create a program which fulfills the requirements here.

The grocery store

Here we describe all the things that your simulation will keep track of. There are many other things that it won’t keep track of that might be important, such as which customers have children with them and how tired each cashier is, but are beyond the scope of the simulation.
Simulate only what we describe here.

A grocery store must keep track of all customers and checkout lines in the store, giving each customer a unique string identifier.

Customers go to a checkout line to pay for their items. The number of items influences how long it takes for the customer to check out, but what those items are does not, and so the simulation should only keep track of the number of items each customer has.

June 6, 2015
Logic Plan


In this project, your Pacman agent will logically plan his way to the goal. You will write software that generates the logical sentences describing moving, eating, and (predictable) ghosts. You will encode initial states and goals and use logical inference to find action sequences that are consistent with these.

This diagram outlines the different steps of the propositional logic planning process.


As in Projects 0 and 1, this project includes an autograder for you to grade your answers on your machine. This can be run with the command:

python autograder.py

See the autograder tutorial in Project 0 for more information about using the autograder.

The code for this project consists of several Python files, some of which you will need to read and understand in order to complete the assignment, and some of which you can ignore.