Coder Social home page Coder Social logo

sigcatta / myshelfie Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 1.0 390.03 MB

Prova finale Ingegneria del Software 2023

License: Apache License 2.0

Dockerfile 0.07% Java 99.06% CSS 0.87%
ingegneria-del-software mvc polimi polimi-projects politecnico-di-milano software-engineering design-patterns progetto-ingegneria-del-software

myshelfie's People

Contributors

azerbini01 avatar dragonbanana avatar sigcatta avatar simonelucca2 avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

simonelucca2

myshelfie's Issues

Boar Refill Observer

If all the tiles on the board are isolated, the board is to be reffiled at the end of the turn

Server + SocketClientHandler

Server
Below is the list of technical requirements for the server side.

  • Must implement the rules of the game using JavaSE.
  • Must be instantiated only once in order to handle a single game (or multiple games in case the advanced functionality "multiple games" is implemented).
  • Allows various players to take turns using client-side instances connected via sockets TCP-IP.

SocketClientHandler

  • deserializes the data sent by the client and sends them to the commandParser

  • the data consists in a HashMap<String, String> commandMap with the following keys: GAME_ID, NICKNAME, COMMAND_TYPE, COMMAD_DATA

Action

The Action abstract class has the execute abstract method, each command needs it's own action:

  • Each execute method is able to convert the string of parameters into the real type parameters for the model

  • Each execute method is responsible to check if who sent the command can actually execute it (e.g. PICKUP_TILE is only available if the name of the player is equal to the name of the active player in game)

  • Call the corresponding methods in the model

  • CHAT

  • PICKUP_TILES

  • INSERT_TILES

  • CAN_I_PLAY

  • NEW_GAME ~ should create a new game and send NEW_GAME_OK if successfull

Test

Test everything better trying to cover all cases

ScoreBoard

The class has a list of players and it's responsibility is to update each player's score

The class needs to:

  • use common goal methods to update the score at the end of each turn

  • calculate points based on the colors of the tiles in the shelf (at the end of the game)

  • calculate personal goals score (at the end of the game)

  • the player who complets their shelf first gains 1 extra point

  • Testing

Client CommandParser

A class who's job is to parse the client's commands to a Map that will be serialized and sent to the server

the server will then use the map as explained in #67

Full Shelf Observer

If a shelf is full, each player has to finish their turn, then the game is over

Bag & Item Tiles

  • Create the ItemTIle class

  • Test ItemTile

  • Create a bag that contains:

  • a Hashmap with the color of the tile and the number of tiles

  • a method that returns a single random tile from the hashmap

  • Test Bag

colors are: green, yellow, blue, lightblue, pink, white

Schermata del 2023-03-21 17-50-51

Client

Client
Below is the list of technical requirements for the client side.

  • Must be implemented with JavaSE and be instantiable multiple times (one per player), even on the same machine.
  • The graphical interface must be implemented using Swing or JavaFX.
  • In case both a text interface (CLI) and a graphical user interface (GUI) are implemented, on startup, it must allow the player to select the type of interface to use.
    It is assumed that any player who wants to join a game knows the IP address or URL of the server.

When a player connects:

  • If there is no game started yet, a new game is created, otherwise the user joins automatically the game at startup.
  • The player who creates the game chooses the number of players who are part of it.
  • If there is a game starting, the player is automatically added to the game.
  • The game starts as soon as the expected number of players is reached (based on the choice made by the first player when creating the game).
  • handle both the case of players leaving the game and the case of connection failure of network. In both cases the game will have to end (even if it is starting) and all players will come notified.

Pickup validator

Create a class with a single static method that checks if a list of tiles is valid for pickup

Personal Goal Cards

  • Implement support for reading JSON files via a ReadFromJSONFile class

  • Build tests for ReadFromJSONFile

  • Implement a card dealer class with the following methods:

  • public static List getCards(int numOfPlayers);

this method's only purpose is to return numOfPlayers cards when a game is created.

  • Build tests for PersonalCardDealer

  • Create a class for personal goal cards, it needs to have:

  • an HashMap for the colors and their coordinate

  • a method to check if the objectives are completed

  • Build tests for all the methods in PersonalGoals

  • Build all 12 json files

  • Build tests for all 12 files

Schermata del 2023-03-21 17-51-58

Server InstructionEncoder

  • send the board
  • send the shef
  • send gameID
  • send errors
  • send players score
  • send player down
  • send chat message

GamesManager

Move the GamesManager class into the controller.

  • The GamesManager class should direct the flow of information from the network to the appropriate game model.
    -The GamesManager class should hold the instances of the socket client to determine the destination of incoming messages.
    -The GamesManager class should contain the necessary logic to assign a single virtual view to a model.
    -The logic to assign a virtual view should be executed upon receiving a command to create a game.
    -After game creation, a method should be called to pass the list of socket clients participating in the game to the virtual view.
    -When a player wishes to join, their socket instance should be added to the virtual view..

EnumCommands

Substitute the commands that are currently String with enums.
The enum class must be equal in the client and server side to avoid compatibility issues

Server Executor

  • bye/disconnection executor ~ needs implementation with the model
  • reconnection

Common Goal Cards

  • Implement a card dealer class with the following methods:

  • public static List getCards();

this method's only purpose is to return 2 cards when a game is created.

  • Create an abstract class for common goals, it needs to have:

  • a stack for point tiles

  • a list for players who already completed the goal

  • a method that returns points

  • Build all 12 extensions of the abstract class

  • refactoring -> each class has to use the same method from either an interface or an abstract class

  • Build tests for all 12 classes

Schermata del 2023-03-21 17-22-49

Schermata del 2023-03-21 17-53-07

Change turn

implement the method ChangePlayerTurn in the class TurnHandler

Shelf

Create the Shelf class, containing:

  • constants describing how bit it is
  • a shlef List<List> variable, containg the tiles
  • isFull(): boolean
  • getTileAt(Point point): ItemTile
  • insertTileAt(Point point, ItemTile tile): void

Disconnection Timeout

If all players but one disconnect, a timer starts and, if at the end of the timer there is still only one player left, that player is the winner and the game ends, if anyone reconnects at any time after the start of the timer, the timer stops and the game continues.
If all players disconnect the game ends

TilesGetter & Shelf

  • test and implement insertTile method in shelf
  • implement ad test TilesGetter

Client InstructionEncoder

  • Create a Mappable interface containing method "HashMap<String, String> map(Stack" method and its implementations, these classes take the string stack passed from the view and convert it to the corresponding command map, they will then call the socket to send the map to the server
  • Add a Javadoc for each command to explain how to use it and what it does

Instructions:

  • - CHAT
  • - PICKUP_TILES
  • - INSERT_TILES
  • - CAN_I_PLAY
  • - BYE
  • - NEW_GAME

Player Class

  • build a Player class + methods

  • test Player class

  • build a ShelfManager class + methods

  • test ShelfManager class

  • build a Shelf class + methods

  • test Shelf class

Server CommandParser

  • Create CommandParser containing a map<String, Executor> and "decodeMessage(String)"method that calls the executor corresponding to the string. The socket will send the message as a map<String, String> and this class is able to call the corresponding executor
  • Add a Javadoc for each command to explain how to use it and what it does

Instructions to parse:

  • CHAT
  • PICKUP_TILES
  • INSERT_TILES
  • PONG
  • CAN_I_PLAY
  • BYE
  • PLAYER_DOWN
  • PLAYER_RECONNECTED
  • NEW_GAME
  • NEW_GAME_OK

JavaDoc

  • Model
  • Controller (Server)
  • Controller (Client)
  • Virtual View
  • Virtual Model
  • View (CLI)
  • View (GUI)
  • Network

ShelfBuffer

  • build a ShelfBuffer class

  • test ShelfBuffer

BUGS

Model

  • test commonGoals

Server:

Client:

Cli:

Gui:

  • Write the error in the join game scene
  • - sometimes the player is not able to join a game because it says that it is already full
  • - the windows must not change dimension when changing scene
  • - The ip address field must take the ip address and have a default one

CLI

  • build a game menu containing:

    • Board
    • personal shelf
    • other players shelfs
    • common and personal goals
  • build the commands the player needs to checkout other players shelfs and goal cards

  • build a command to refresh the console

  • build a starting menu where the player can try to join a game o create a new one

Board Refresher

Section responsible for refilling the table with casual tiles.
Design pattern Command

  • Create class with method refillBoard() : void. The method is responsible for checking the amount of tiles needed to refill the board and refilling it using Command design pattern

  • Test

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.