compsci 201 recitation 6

10
Compsci 201 Recitation 6 Professor Peck Jimmy Wei 2/14/2014 1

Upload: jerry

Post on 16-Feb-2016

99 views

Category:

Documents


0 download

DESCRIPTION

Compsci 201 Recitation 6. Professor Peck Jimmy Wei 2 /14 / 2014. In this Recitation. Markov! Google form : http:// goo.gl / VhLvcW. Markov. If you haven’t yet, snarf Markov Look at the main method in MarkovMain.java - PowerPoint PPT Presentation

TRANSCRIPT

Compsci 201 Midterm 2 Review

Compsci 201 Recitation 6Professor PeckJimmy Wei2/14/2014

1In this RecitationMarkov!Google form:

http://goo.gl/VhLvcW2MarkovIf you havent yet, snarf MarkovLook at the main method in MarkovMain.javaWe will implement a new subclass of AbstractModel called MapMarkovModel, then we will change the main method as follows:

Answer #1public static void main(String[] args) { IModel model = new MarkovModel(); SimpleViewer view = new SimpleViewer(); view.setModel(model);}public static void main(String[] args) { IModel model = new MapMarkovModel(); SimpleViewer view = new SimpleViewer(); view.setModel(model);}3MarkovHere some of the code for the brute() method in MarkovModel; use it to answer #2-5:public void brute(int k, int numLetters) {int start = myRandom.nextInt(myString.length() k + 1);String str = myString.substring(start, start + k);String wrapAroundString = myString + myString.substring(0, k);ArrayList list = new ArrayList();for (int i=0; i