Design of Large Programs
Design of Large Programs CS 351L
Popular in Course
Popular in ComputerScienence
This 11 page Class Notes was uploaded by Trent Dare on Wednesday September 23, 2015. The Class Notes belongs to CS 351L at University of New Mexico taught by Joel Castellanos in Fall. Since its upload, it has received 21 views. For similar materials see /class/212200/cs-351l-university-of-new-mexico in ComputerScienence at University of New Mexico.
Reviews for Design of Large Programs
Report this Material
What is Karma?
Karma is the currency of StudySoup.
You can buy or earn more Karma at anytime and redeem it for class notes, study guides, flashcards, and more!
Date Created: 09/23/15
Digital Snowflake Milestone 2 CS 351 Design of Large Programs Instructor Joel Castellanos email ioelunmedu Web httpcsunmeduioe Office Farris Engineering Center FEC room 321 Lab Instructor David Godinez email dgodinezcsunmedu 222009 Digital Snowflake Custom Milestone 2 I Milestone 2 includes some very specific implementation directives that were not part of the original assignment I This is designed to help you I Custom Option I If you have a different idea of how you want to reach the original specifications then I am very open to working and encouraging that L L t If this is the case then speak now or go with the l flow L Digital Snowflake Milestone 2 l Generation 0 hardcode the cell seed crystal two rows of 7 cells each I A cell crystallizes on every prism face with each of the following patterns on each generation divisible by the indicated number l A cell crystallizes on every basal face every generation divisible by 30 regardless of neighborhood around that face I Run for 91 generations Generation 0 to 1 Visit Each Crystal Cell The top layer of the Seed Crystal 2500 has 7 crystal cells During the update from Gen 0 to 248 249 248 Gen 1 each of these 7 cells and 249 a the 7 underneath them must be checked to see if a crystal grows on any one of the cell39s 8 faces Since the update is synchronous it does not matter which crystal cell we visit first Assume that the first cell we visit is 249248500 Generation 0 to 1 Cell 249 248 500 When looking to see if any of a cell39s six prism faces forms a new crystal only that neighborhood of six faces needs to be considered The prism faces of cell 249 248 500 are marked with the letters A through F Prism faces C D and E of cell 249 248 500 are not empty Therefore nothing new can happen on those faces During the update of cell 249 248 500 we only ask the question Does a crystal grow on any of the 8 faces of this cell 14 Face of Cell 249 248 500 Face A is a 11 face of cell 249 248 500 because circling cell 249 248 500 in either a clockwise or counterclockwise direction crosses one empty cell before hitting a crystal cell ln milestone 2 the growth rate for a 11 face is 1 This means that a crystal will grow on every 11 face during every generation that is divisible by 1 Since every number is divisible by 1 11 faces always grow Therefore on the update from generation 0 to 1 a crystal will 6 grow in cell 249 247 500 02 Faces of Cell 249 248 500 From the cell on face B circling cell 249 248 500 in one direction comes in direct contact to a crystal cell Circling in the other direction crosses two empty cells before hitting a crystal cell Therefore cell 250 247 500 is a 02 face of cell 249 248 500 Similarly cell 248 247 500 on face F is also a 02 face of cell 249 248 500 Milestone 2 has no rule for 02 faces Therefore this update of cell 249 248 500 will not cause growth on B or F Summery of 249 248 500 Update 8 Of the six prism faces of 249 248 500 C D and E already have crystals A is a 11 face and grows in generation 1 B and F are 02 faces and cell 249 248 500 does not cause them to grow This does not mean that nothing can grow in the cell that is on face B of 249 248 500 during this generation The cell on face B of 249 248 500 may also be on some other type of face of some other crystal cell which causes it to grow Growth in Generation 1 249247 grows because it is on a 11 face of 249248 251248 grows because it is on a 11 face of 250248 251250 grows because it is on a 11 face of 250249 249251 grows because it is on a 11 face of 249250 247250 grows because it is on a 11 face of 248249 247248 grows because it is on a 11 face of 248248 9 No other cells are on faces that grow during generation 1 Joel39s Algorithm Part 1 I Keep an ArrayList of Cells I Also keep booleanH cellLattice l Each generation examine each Cell in the active ArrayList l method getNeighborCoordinateList given a set of coordinates returns the coordinates of the 6 cells adjacent to the prism faces and the two cells adjacent to the two basal faces I For each cell consider crystallization on each of the 8 faces I If the face already has a cell then move to the next face I Count the clockwise and counter clockwise number of open faces I Characterize the face by min and max distance to an crystal face 1O Joel39s Algorithm Part 2 I If when visiting each face of a cell no open cells were found then delete the cell from the active cell ArrayList I As each cell is visited an ArrayList of crystallization coordinates is built This list may contain many repeated sets of coordinates I After each active cell has been visited for growth then walk through the crystallization list verify that booleanl H H cellLattice is still empty if so add the cell Joel39s Algorithm Not 3 Requirement I The last two slides are my implementation ofthe requirements I You do not need to implement the requirements in this way I These are just suggestions I The ArrayList of active cells and the 3D boolean lattice are not requirements Golden Rule of Optimization I Do not do it until you need it I Optimized algorithms are more complicated to create debug read and maintain Results of Generation 0 amp 1 Seed Crystallization by 11 rule Results of Generation 2 amp 3 15 Both generations shown here only have crystallization by the 22 rule Results of Generation 6 amp 7 16 Generation 7 shown the first crystallization by the 13 rule Only the arm tips have the 13 pattern which crystallize every 7th generation Results of Generation 29 amp 30 17 Generation 30 shows the first crystallization on basal faces Results of Generation 73 amp 91 Results of Generation 91 Note Forthis milestone if Total crystallized cells 51032 Total active cells cells with open neighbors 48170 X Range 157 341 Y Range 157 341 Z Range 496 503 you want to use a 3D array you may start the seed out at 220 rather than 500 Drawing Interface No change to the interface used in milestone 1 SnowflakeDraw is been updated to represent the 3D slope of the snowflake39s upper surface with various colors public class SnowflakeDraw extends JFrame Constructor SnowflakeDrawint pixelWidth int pixelHeight Methods public void clearAll public void addCellsArrayListltPoint3igt ideist Each Point3i in ideist contains the 3D hex lattice coordinates of a cell that is newly crystallized Each call to addCells should only contain new cells Second Milestone Grading Rubric 20 points Matches the growth shown on the precious slides 10 points The working version demonstrated in class sleeps for 40 ms between each generation Yours with the same sleep should runs no more than 5X slower 10 points Followed coding standard 10 points Comments and readability Total 50 points
Are you sure you want to buy this material for
You're already Subscribed!
Looks like you've already subscribed to StudySoup, you won't need to purchase another subscription to get this material. To access this material simply click 'View Full Document'