Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/yoyolicoris/qmul-ecs713-fp-final
My individual coursework of the module ECS713P Functional Programming, QMUL.
https://github.com/yoyolicoris/qmul-ecs713-fp-final
concurrent-programming functional-programming haskell-exercises
Last synced: 21 days ago
JSON representation
My individual coursework of the module ECS713P Functional Programming, QMUL.
- Host: GitHub
- URL: https://github.com/yoyolicoris/qmul-ecs713-fp-final
- Owner: yoyolicoris
- License: other
- Created: 2024-01-10T09:10:26.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2024-02-20T17:02:10.000Z (9 months ago)
- Last Synced: 2024-10-25T21:57:03.031Z (23 days ago)
- Topics: concurrent-programming, functional-programming, haskell-exercises
- Language: Haskell
- Homepage:
- Size: 178 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Simple chatting simulator
## How to run
Assuming *Haskell Stack* is installed, run the following commands:
```bash
git clone https://github.com/yoyololicon/qmul-ecs713-fp-final.git
cd qmul-ecs713-fp-final/
stack build# Run the simulation with ten users and 100 messages
stack exec fp-final-exe 10 100
```After the last command, you should see something like this:
```
Progress: 100/100
Summary:
User Frank received 8 messages (5 unread) and sent 8 messages (4 has been read).
User Wendy received 15 messages (8 unread) and sent 14 messages (6 has been read).
User Oscar received 6 messages (5 unread) and sent 13 messages (5 has been read).
User Mallory received 10 messages (7 unread) and sent 9 messages (5 has been read).
User Walter received 8 messages (6 unread) and sent 7 messages (5 has been read).
User Judy received 9 messages (3 unread) and sent 11 messages (4 has been read).
User Dave received 12 messages (8 unread) and sent 8 messages (5 has been read).
User Trent received 14 messages (2 unread) and sent 12 messages (3 has been read).
User Peggy received 9 messages (9 unread) and sent 8 messages (4 has been read).
User Bob received 9 messages (4 unread) and sent 10 messages (2 has been read).
```## Design
```mermaid
sequenceDiagram
loop
sender ->> main: message
main -->> main: n << n + 1
main ->> receiver: message
receiver -->> receiver: update chatbox
receiver ->> main: ack
main ->> sender: ack
sender -->> sender: update chatbox
critical n == max_n
main --x main: terminate
end
end
```