Skip to content

Akka HTTP web service app that ingests and allow users to query big graphs.

Notifications You must be signed in to change notification settings

trakyari/HW3-CS-441

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HW3 UIC CS 441 Fall 2023

Arijus Trakymas

[email protected]

AWS EC2 deployment video

How to run

AWS EC2

Create a AWS EC2 instance, set machine instance to Amazon Linux 2023.

Generate a ssh keypair.

SSH into the machine.

ssh <ec2-user>@<aws-ip>

where ec2-user is usually ec2-user and aws-ip can be found in AWS.

Install OpenJDK 11

sudo yum install java-11-amazon-corretto-headless

Copy over uber jar, and input files

scp .\target\scala-2.13\HW3.jar <ec2-user>@<aws-ip>:<aws-directory>
scp Netgraph.ngs <ec2-user>@<aws-ip>:<aws-directory>
scp Netgraph.ngs.perturbed <ec2-user>@<aws-ip>:<aws-directory>

Run the program

java -jar HW3.jar

Run tests

sbt clean compile test

How to use

Import the postman collection found in the root directory into Postman.

The different endpoints allow you to interact with the game.

The ID's for the players are listed below in the design.

Design

The goal of this project is to create a Policeman / Thief game in which the policeman and thief are players that play on the graphs that have been generated by NetGameSim. The premise is that the players move around on these graphs and can win if they met some conditions. The thief can win if they get to a node where their is valuable data (valuableData is true). The policeman can win if they end up at the same node as the thief. Lastly, either player can lose if they end up at a node where they cannot make any other moves, in this case the other player wins automatically.

The resource here then is the players of the game. If we imagine the player is a resource, we can then can also imagine different actions the player can do. The player can get available nodes to visit. The player can move to an adjacent node.

Therefore, the basic design of the REST service would be:

Players can

  • GET adjacent nodes given a player ID (ID is known beforehand), if the user requests an a player ID that is not valid, they will be told to pick a valid user ID. If the request is valid, then the user will receive the nodes that are adjacent to the player ID in a list where the nodes are represented by their ID. Each node will also contain a confidence score which tells the player about whether the node or the edges that lead to it were not perturbed.
  • POST a node to move using a node ID that was provided by the GET request, if the node the player attempts to move to does not match an ID of a neighboring node then the player is informed that the move they performed is not legal and to try again. There are a few outcomes that can result from the user moving to a new node.
    • If the player is a thief then upon arriving to this new node if the node contains valuable data and no policeman then they will be informed they have won.
    • Otherwise if there is a policeman they will be informed they have lost.
    • If they are a thief and no policeman and valuable data exist, nothing happens.
    • If they are a policeman and there is a thief present, they win.
    • If either player moves to the node and there are no more adjacent nodes, they automatically lose.

Players

By default, the policeman is a player with ID 1 while the thief has an ID of 2.

Traversing the graph

If the player queries about adjacent nodes and decides to move to a node that does not exist in the original graph, then the player is told that the node they picked was in fact not a valid node and that they lost their turn.

About

Akka HTTP web service app that ingests and allow users to query big graphs.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages