Coder Social home page Coder Social logo

hw3-cs-441's Introduction

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.

hw3-cs-441's People

Contributors

trakyari avatar utsavns96 avatar

Watchers

0x1D0CD00D avatar  avatar

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.