Skip to content

iankoex/Pesapal

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pesapal

This is my submission to The Pesapal Developer Challenge.

I have attempted to solve Problem 3 and Problem 4.

Installation

The solutions are in the form of an app that runs on macOS and iOS.

A binary that is signed for development can be found in the releases tab. You will be required to trust the app in > Preferences > Privacy and Security.

The app was created on Xcode 14.2 (14C18) but should be compatible with previous versions of Xcode. The app runs on macOS v.11 or later and on iOS 14 or later.

First clone the project to your mac. Open Pesapal.xcodeproj. On Xcode's sidebar go to Pesapal then Targets > Pesapal > Signing & Capabilities. On Signing & Capabilities create your signing certificate and run the project.

Signing & Capabilities

Problem 3 A distributed system.

Once the app is running, it will start a server on port 8080. Confirm that the server is running by clicking Test on Browser on the app or by visiting Port 8080. If for some reason the server is not running click Start Server button.

Once the app connects to the server, it will connect to the socket automatically. The different clients are represented by windows of the app. Create a new window by pressing CMD + N. The new window should also connect to the socket and will be allocated the next available rank.

A side note for iOS: Since we can't create multiple windows of the same app on iPhone, the solution can only be tested on Mac or iPad. The iOS app will still start a server and connect to the socket.

To send commands press the Send Command button. Clients with a lower rank will exceute the command by showing:

Running Commmand from participant x with rank x

Once a client disconnects (Click on the red Disconnect button), the socket promotes the clients accordingly.

The following is a demo with Four particpants:

Screen.Recording.mp4

Problem Four: A Boolean logic interpreter

On the side bar click on the problem four tab.

The view on problem four consists of a textfield and a submit button and a history of the expressions and evaluations excecuted.

The Synatx

The syntax uses the Swift standard syantax for Boolens and Logical operators.

  1. true for true
  2. false for false
  3. && for AND
  4. || for OR
  5. ! for NOT

Usage

On the text field type the expession you want to evaluate such as true && true.

The text field supports initialisation of variables using the syatax let x = true or let y = !true.

After initialising a variable you can evaluate expressions such as true || x, x && y, !y && true

If you try to evaluate an expression with variable that has never been initialised such as k && true, you will get an error.

The following is a demo of the same:

Problem.4.Screen.Recording.Demo.mp4

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Languages