Git Product home page Git Product logo

murder_mystery_backend's Introduction

Murder Mystery

Welcome to the Murder Mystery project! This README guide will help you get started with setting up and running the project on your local machine.

Getting Started

Follow these steps to set up the project:

1. Setting Up a Virtual Environment

Before you begin, it's a good practice to create a virtual environment to isolate your project's dependencies. If you haven't installed virtualenv, follow these steps to set it up:

# Install virtualenv globally (if not already installed)
pip install virtualenv

# Create a virtual environment named 'env' (you can choose a different name)
virtualenv env

# Activate the virtual environment
# On Windows
env\Scripts\activate
# On macOS and Linux
source env/bin/activate

2. Installing Project Dependencies

With your virtual environment activated, navigate to the project directory and install the required dependencies listed in the requirements.txt file:

# Navigate to the project directory
cd murder_mystery

# Install dependencies
pip install -r requirements.txt

3. Running the Project

#Navigate to the project directory:
cd murder_mystery

#Apply database migrations:
python manage.py migrate

#Start the Django development server:
python manage.py runserver

Frontend Repository

Find the Murder Mystery Frontend repository on GitHub: Murder Mystery Frontend

API Endpoints

The backend exposes the following API endpoints:

  • api/person/: Information about individuals involved in the mystery.
  • api/phone-calls/: Details of phone calls related to the investigation.
  • api/location/: Data on different locations relevant to the case.
  • api/street/: Street-related information.
  • api/bank-account/: Bank account details.
  • api/atm/: Information related to ATMs.
  • api/security-log/: Security log records.
  • api/crime-scene/: Details about the crime scene.
  • api/item/: Items associated with the investigation.
  • api/clue/: Clues that might help solve the mystery.
  • api/airports/: Airport details.
  • api/flights/: Information about flights.
  • api/passengers/: Passenger details.
  • api/interviews/: Records of interviews conducted during the investigation.

Additionally, there is a special endpoint for playing Tic-Tac-Toe with AI:

Tic-Tac-Toe Endpoints

GET /tictoc/list

View logs of player status on the Tic-Tac-Toe board.

POST /tictoc/startnewgame

Start a new Tic-Tac-Toe game (send empty json body)

Initial State Response:

{
    "id": "?",
    "player": "X",
    "action": null,
    "board": "000000000",
    "winner": null,
    "terminal": false,
    "time": "?"
}

POST /tictoc/moveapi

Make a move on the Tic-Tac-Toe board. we should send data to this endpoint like :

{
	"letter":"X",
	"action":"01"
}

letter: The player's turn, which can be "X" or "O".

action: The player's choice of section on the board, where the first digit represents the row index, and the second digit represents the column index.

Note: If letter and the player key in the API are the same (e.g., both "X"), the player goes first; otherwise, the AI goes first.

XO app : Logic of board Value

The board value in the Tic-Tac-Toe responses is a compressed representation of the game board. The compression is achieved using the following Python function:

def compressBoard(board: list):
    res = ''
    for row in range(len(board)):
        for col in range(len(board)):
            match board[row][col]:
                case None: res += '0'  # Empty cell
                case 'X': res += '1'   # Cell occupied by 'X'
                case 'O': res += '2'   # Cell occupied by 'O'
    return res

he function iterates through each cell in the board, representing empty cells as '0', cells with 'X' as '1', and cells with 'O' as '2'. The resulting string provides a concise representation of the game board, indicating the state of each cell and facilitating analysis to determine the winner or the presence of an empty cell.

XO app : Logic of Action

The action value in the Tic-Tac-Toe move represents the player's choice of section on the board. The format of the action is a two-digit string, where the first digit represents the row index, and the second digit represents the column index.

For example:

action: "01" corresponds to the cell in the first row and second column. action: "22" corresponds to the cell in the third row and third column.

XO app : Game Termination and Winner Determination

If the terminal field is True, the game is finished.

If the winner field is null, the game is a draw (equal).

If the winner field is equal to 'X', then 'X' wins.

If the winner field is equal to 'O', then 'O' wins.

murder_mystery_backend's People

Contributors

bnparham avatar kiartante avatar

Stargazers

May Khaleghi avatar

Watchers

 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.