bryanzanr / go-cli

Go-cli reborn on Swift Playground for WWDC 2020

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

GO-CLI

Apple World Wide Developer Conference (WWDC) 2020

Swift Student Challenge

How the Applications Work

The application is a simple ride hailing scenario application. The assumptions that has been made are as follows:

  1. The application is initially a console-based application which can only be executed from the terminal. 2. It was created almost two years ago in Ruby programming language for a Software Engineering Academy selection.
  2. I really like to see my old program or source code and try to modify it in order to give some improvements.
  3. Without any parameters means the application will run with default value.
  4. The Parameter is inserted through many kinds of simple user's input.
  5. Choice of action will be calculated based on those parameters.
  6. The driver's name will be generated by the program using FCFS (First-Come-First-Serve).
  7. The coordinates is zero indexed because of an array.
  8. Price can be modified only by changing the parameter called from main method (hard coded).
  9. Turn right means move 1 level below and turn left means move 1 level above (x / rows).
  10. Nearest driver means have smallest unit of distance (straight line algorithm).
  11. Destination's coordinates must be entered correctly in form of integer.
  12. There're at least 1 driver to accept the order and only 1 user is allowed to make the order.
  13. Route from driver's position to user's position is not included.
  14. Collumns will be more priority routes than rows.
  15. Only drivers that have a name.
  16. Every new run of application will remove the history.

More detailed information can be found on the program source code.

Design Decision:

  • Create main program (MySingle.playground) which processed every input and generate output.
  • Create base map (Grid Class) which represented as rows (X) and collumn (Y).
  • Create object (People Class) which consist of user and drivers.
  • The distance will be generated using Manhattan's Distance Algorithm.
  • Nearest driver will be generated using Straight Lines Distance Algorithm.
  • Every variable is done in Pastel and Camel case.
  • User always inserted as the first Peoples Object (Index 0).
  • Only 1 trip can be confirmed per execution because driver & user position will not change.
  • Drivers and user position also cannot be in the same coordinates.
  • The user's history will be appended and reset if the program exited.
  • History is shown in form of list and route is hidden to minimalize table.
  • Route can be shown through input parameter.
  • String in command will be converted as zero in integer.
  • When using execution's argument, output only until the map is shown.

Getting Started (How to Run the Program)

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.

Prerequisites (How the program was set up)

  1. Navigate to the directory where is the root of this project folder (.playground files).

  2. Still in the directory where is the root of this project, run the app by click the play button in the files.

    Most of the source code are stored in MySingle.playground and resources (if any) are stored in Resources/.

  3. The app is now running! To check that the app is actually running, try to send an action like setting up map size, user coordinates, number of drivers, and their coordinates.

Installing (How the program was run)

  1. Make sure you already installed the latest Xcode.
  2. You can also run through Swift Playground.
  3. For more information you can contact me through e-mail on indonesianproduction@gmail.com.

Built With

Authors

  • Bryanza Novirahman - Apple Developer Academy Indonesia - LinkedIn

Important links

About

Go-cli reborn on Swift Playground for WWDC 2020


Languages

Language:Swift 100.0%