Skip to content

Niteshthori24198/Arena

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Magical Arena Game CLI Application

This is a Command Line Interface (CLI) based Fight Game application implemented in TypeScript and Node.js. The application allows users to simulate fights between different players. It is designed to be loosely coupled, making it easy to extend with various storage layers (such as databases) or interface layers (such as web-based interfaces) in the future.

Table of Contents

  • Prerequisites
  • Installation
  • Usage
  • Project Structure
  • Interfaces
  • In-memory Implementation
  • Error Handling
  • SnapShots
  • Future Enhancements
  • License

Prerequisites

Before you begin, ensure you have the following prerequisites installed on your machine:

  • Node.js
  • TypeScript

Installation

  • Clone the repository : git clone repo_link

  • Navigate to the project directory :

    cd Swiggy_Assignment
    
  • Install dependencies

    npm i
    

Usage

  • To build the application

    npm run build
    
  • To start the application, run :

    npm run start
    

Follow the on-screen instructions to interact with the CLI and simulate fights between players.

Project Structure

The project is structured as follows :

  • src

    • config
      • constant.ts
      • main.config.ts
    • error
      • illegal.argument.error.ts
      • illegal.state.error.ts
      • resource.absent.error.ts
    • models
      • player.model.ts
    • repository
      • implementation
        • in.memory.player.repository.impl.ts
      • player.repository.ts
    • service
      • implementation
        • game.state.impl.ts
      • game.state.ts
    • ui
      • cli
        • cli.controller.ts
      • controller.ts
    • main.ts
    • .gitignore
    • package.json
    • tsconfig.json
    • README.md
  • src/model : Contains the Player model.

  • src/error : Contains error handling.

  • src/service : Includes the GameService and GameState Implementation.

  • src/repository : Include InMemoryService implementations.

  • src/main.ts: Initializes and starts the application.

Interfaces

  • GameState Entity

Alt text

  • PlayerRepository Entity

Alt text

In-memory Implementation

The application currently uses an in-memory implementation of the GameState interface. To switch to a different implementation (e.g., a database), create a new service class that implements the GameState interface.

Error Handling

All errors and exceptions are properly handled to ensure a smooth user experience. Any unexpected behavior is logged for debugging purposes.

SnapShots

Alt text

Alt text

Alt text

Alt text

Alt text

Alt text

Future Enhancements

  • This application is designed to be easily extensible. Future enhancements could include:

  • Implementing different storage layers (e.g., a database).

  • Adding a web-based interface for a more user-friendly experience.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Arena

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published