GithubHelp home page GithubHelp logo

petervanhoef / graphing-calculator Goto Github PK

View Code? Open in Web Editor NEW
8.0 3.0 1.0 155 KB

My solutions for CS193P Winter 2017 Assignment III: Graphing Calculator

License: MIT License

Swift 100.00%
cs193p winter 2017 calculator assignment-3 graphing-calculator solution

graphing-calculator's People

Contributors

petervanhoef avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

graphing-calculator's Issues

Task 7: Add graphing button

Add a new button to your calculator’s user-interface which segues to your new MVC and graphs what is in the CalculatorBrain at the time the button was touched using the memory location M as the independent variable. For example, if the CalculatorBrain contains sin(M), you’d draw a sine wave. Subsequent input to the Calculator must have no effect on what the graphing MVC is showing (until the graphing button is touched again). Ignore user attempts to graph if the result in the CalculatorBrain is pending (e.g. there is a pending binary operation) at the time.

Extra Credit 6: Show last graph when application first launches

When your application first launches, have it show the last graph it was showing (rather than coming up blank). You could reset the Calculator MVC upon relaunch to the last state it was in as well (which may or may not be the same thing as what the graph was showing). Be careful not to violate MVC in your solution, though (each MVC its its own independent world). The simplest persistence mechanism in iOS is UserDefaults, but only Property Lists can be put there, so you will have to figure out how to get the function you are graphing into a Property List-compatible form. Because of that, you are allowed use the Swift types Any or AnyObject to implement this Extra Credit item.

Task 6: Graphing view must not own data it is graphing

The graphing view must not own (i.e. store) the data it is graphing, even temporarily. It must ask for the data as it needs it, point by point. Your graphing view graphs an x vs. y function, it does not graph an array of points, so don’t pass it an array of points.

Task 8: Support split view

On iPad and in landscape on iPhone 6+ and 7+ devices, the graph must be (or be able to be) on screen at the same time as your existing Calculator’s user-interface (i.e. in a split view). On other iPhones the graph should “push” onto the screen via a navigation controller.

Task 9: Display description of what is being drawn

Anytime a graph is on screen, a description of what it is being drawn should also be shown on screen somewhere sensible, e.g., if sin(M) is what is being graphed, then the string “sin(M)” should be on screen somewhere.

Task 11: Graphing view to support gestures

Your graphing view must support the following three gestures:

  1. Pinching (zooms the entire graph, including the axes, in or out on the graph)
  2. Panning (moves the entire graph, including the axes, to follow the touch around)
  3. Double-tapping (moves the origin of the graph to the point of the double tap)

Task 1: Start with your Assignment 2 code

You must begin this assignment with your Assignment 2 code, not with any in-class demo code that has been posted. Learning to create new MVCs and segues requires experiencing it, not copy/pasting it or editing an existing storyboard that already has segues in it.

Extra Credit 1: Graphing button to reflect if it is possible to graph

Have your graphing button in your main Calculator scene reflect whether or not it is currently possible to graph what has been entered so far (i.e. whether there is a pending result or not). You could just disable it, but maybe a different graphic or something? This is a very easy task, so don’t expect a lot of extra credit for it!

Extra Credit 5: Improve panning performance

Use the information you found above to improve panning performance. Do NOT turn your code into a mess to do this. Your solution should be simple and elegant. There is a strong temptation when optimizing to sacrifice readability or to violate MVC boundaries, but you are NOT allowed to do that for this Extra Credit!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.