Solutions for the assignments below are implemented in the ShapeGrammar iOS app. I have tried to extract the implementation of each task to separate file/class, so all the other files (classes for views, view controllers, etc.) won't be mentioned here - only the ones containing the essential logic.
-
1. Shape grammar
Create interface for generating and displaying simple shapes using the grammar defined.
- ShapeGrammar App
Xcode project
- ShapeGrammar App
-
2. Preference function
Implement a function that will generate a random shape using your grammar. Next add function that will evaluate generated shape and give it a score depending on preferences.
- ShapeGradingHelper
swift
- ShapeGradingHelper
-
3. Evolutionary algorithm
An algorithm that will generate a number of sample shapes, and with the help of preference function will pick only those with the highest score to crossbreed a new generations of shapes.
- ShapeCrossbreedingHelper
swift
- ShapeCrossbreedingHelper