Skip to content

TH060419/CASIO_Game

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CASIO Game & Analysis Dashboard

This project is a web-based game application built with Python (Flask) and JavaScript. It features an interactive game based on a mathematical formula and a comprehensive data analysis dashboard to run simulations and visualize the results.

Features

1. Interactive Game Page (index.html)

  • Interactive Gameplay: Play the game step-by-step or let it run to completion automatically.
  • Custom Start Number: Users can input their own starting number or use the default value.
  • Real-time Visualization: A line chart (using Chart.js) dynamically plots the number's value at each step on a logarithmic scale.
  • Game History: The right-hand panel displays a ranked history of the top 20 successful game results (fewest steps to win) and any failed games. This data persists in the browser's local storage.
  • Clear History: A button is available to clear all historical data.

2. Data Analysis Dashboard (analysis.html)

  • Bulk Simulations: Run 100 or 1000 games at once with a single click.
  • Custom Simulation Parameters: Specify a custom initial number for the bulk runs.
  • Statistical Summary: A detailed table shows key metrics from the simulation results, including:
    • Total games played
    • Win/Loss rates
    • Average, minimum, and maximum steps for winning games
    • Variance of win steps
  • Data Visualization:
    • Histogram: Shows the distribution of the number of steps required for a win.
    • Pie Chart: Visualizes the overall win vs. loss ratio.
  • Persistent Data: All simulation data is stored in the browser's local storage, allowing you to accumulate results over multiple sessions.

File Structure

.
├── app.py              # The Flask backend server that handles game logic and serves pages.
├── index.html          # The main game interface.
├── analysis.html       # The data analysis and visualization dashboard.
├── requirements.txt    # A list of Python dependencies required for the project.
└── start.sh            # An automated script to set up and run the application on macOS/Linux.

How to Run the Project

This project is designed to be easy to run. The start.sh script automates the entire process.

Prerequisites

  • Python 3 installed on your system.
  • A command-line interface (Terminal on macOS/Linux).

One-Click Start (macOS/Linux)

  1. Unzip the CASIO_Game.zip file.
  2. Open your terminal and navigate into the unzipped project folder.
    cd path/to/CASIO_Game
  3. Run the startup script.
    ./start.sh
    This script will automatically:
    • Create a Python virtual environment (venv).
    • Install all the required dependencies from requirements.txt.
    • Start the Flask web server.
    • Open the game in your default web browser at http://127.0.0.1:8080.

To stop the server, simply close the terminal window.

Manual Setup (Windows or if the script fails)

If you are on Windows or prefer to run the project manually, follow these steps:

  1. Open your terminal or Command Prompt and navigate to the project folder.

  2. Create a virtual environment:

    python -m venv venv
  3. Activate the virtual environment:

    • On Windows:
      venv\\Scripts\\activate
    • On macOS/Linux:
      source venv/bin/activate
  4. Install the dependencies:

    pip install -r requirements.txt
  5. Run the application:

    python app.py
  6. Open your web browser and go to the following URL: http://127.0.0.1:8080

About

A web-based CASIO game with a data analysis dashboard.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors