I set up a git repository for all my classes I've taken since
commit a0ab077fb343bff9b6a3f7814e15e20c47e513b9
Author: Peter Chinetti <peter@chinetti.me>
Date: Sun Feb 3 01:39:19 2013 -0600
The repository can be found at my server as a flattened checkout of HEAD. Some of the classes/projects I'm most proud of are:
CS 480: Artificial Intelligence
Random Number Generator Seed Reverser
In a project for this class, we were given a "market simulation" that would generate 10000 "products" with a buy price, a sell price, and a "broken" flag. Your code could choose to either buy or pass on the product. If the "broken" flag was false, and you choose to buy the product generated income = sell-buy. If the flag was true, and you choose to buy the product, you lost the buy price. We were also given a global rate of failures, so we could compute the expected value of the product, maximize profit, blah blah blah, easy introductory project.
But seriously, that's so boring. A much more fun solution would be to use the buy price and sell price to reverse what the random number generator seed must be, then just know if the product was going to be bad or not and buy if it wasn't.
I did that in my code below and in my class repo here.
public int findSeed(double target,int count){ /*This is cool. Seeds are at most 32 bits wide (int), which we have further restricted to 0-9999 * (last 4 digits of A#). * doubles are 64 bits wide, with 46 of the bits available for the fractional component. * * Due to the reduced search space, and low likelyhood of having neighboring doubles map to * seeds [46bits->32bits], you can reverse the random number generator to find the seed. * * A confounding factor is that the doubles coming in (price and value) must be divided to find the * Random number that was generated by the generator. * This introduces floating point error, which can throw off the reverser. * To fix this, I search for the nearest double that maps back, and use that as the seed. * * Because that worked, I did not work on covering the corner cases of equidistant doubles. */ double [] seedList = buildSeedList(2); int index = -1; double minDiff = Double.POSITIVE_INFINITY; for(int i = 0; i< 10000; ++i){ if(Math.abs(seedList[i]-target)<minDiff){ minDiff =Math.abs(seedList[i]-target); index = i; } } print("seed found: "+index); return index; } public double[] buildSeedList(int steps){ /*Just here to build a list to iterate through */ double [] list = new double[10000]; for(int i = 0; i < 10000; ++i){ Random r = new Random(i); int temp_steps = steps; while(temp_steps-->0){ list[i] = r.nextDouble(); } } return list; }
ECE 485: Computer Organization and Design
RISC Processor VHDL Implementation
This class was about the design of CPUs, especially RISC style CPUs. The final project was the implementation and writeup of a subset of RISC instructions. This is my report on the project.
ECE 441: Microcomputers
Serial Control Terminal in Motorola 68k Assembly
Although I was disappointed that this class did not cover a more modern processor (ARM), the final project for this class was pretty cool. We had to implement a serial terminal in assembly and give the terminal some basic commands. My implementation ended up being about 950 lines long, and my report on the project was 49 pages long (fortunately there were many flow-charts and code listings). You can find it here