A full-stack web application where users guess mathematical functions by looking at their graphs. Features daily challenges, multiple difficulty levels, and practice mode.
- Daily Challenges: New challenges every day with 4 difficulty levels
- Difficulty Levels:
- Easy: 1-2 simple terms
- Medium: 2-3 moderate terms
- Hard: 2-3 complex terms with larger coefficients
- Very Hard: 3-4 terms with all function types
- Practice Mode: Unlimited practice at any difficulty
- Create & Share: Make custom challenges and share with friends
- User Statistics: Track your progress and scores
- Persistent Storage: Daily completions and user stats saved in SQLite database
Backend:
- Python/Flask
- SQLite database
- RESTful API
Frontend:
- Vanilla JavaScript
- Desmos Graphing Calculator API
- HTML/CSS with glassmorphism design
graphle/
├── server.py # Flask backend server
├── graphle.db # SQLite database (auto-created)
├── requirements.txt # Python dependencies
├── static/
│ ├── index.html # Main HTML file
│ └── app.js # Frontend JavaScript logic
└── README.md # This file
- Python 3.8 or higher
- pip (Python package manager)
pip install -r requirements.txtCreate the following folder structure:
graphle/
├── server.py
├── requirements.txt
└── static/
├── index.html
└── app.js
Place the files in their respective locations:
server.pyin the root directoryindex.htmlandapp.jsin thestatic/folder
python server.pyThe server will start on http://localhost:5000
Open your browser and navigate to:
http://localhost:5000
GET /api/daily- Get today's daily challenge metadataGET /api/daily/<difficulty>- Get specific difficulty challengePOST /api/daily/check- Check user's daily completionsPOST /api/daily/submit- Submit completed daily challenge
GET /api/practice/<difficulty>- Generate practice function
GET /api/stats/<user_id>- Get user statistics
date(TEXT PRIMARY KEY)easy_function(TEXT)medium_function(TEXT)hard_function(TEXT)very_hard_function(TEXT)
user_id(TEXT PRIMARY KEY)total_score(INTEGER)games_played(INTEGER)easy_completed(INTEGER)medium_completed(INTEGER)hard_completed(INTEGER)very_hard_completed(INTEGER)daily_streak(INTEGER)last_daily_date(TEXT)
user_id(TEXT)date(TEXT)difficulty(TEXT)score(INTEGER)attempts(INTEGER)
Base scores by difficulty:
- Easy: 100 points
- Medium: 200 points
- Hard: 300 points
- Very Hard: 500 points
Penalties:
- -10 points per additional attempt (after first)
- -25 points per hint used
Minimum score: 10 points
Each challenge provides 2 hints:
- Hint 1: Number of terms and function types
- Hint 2: Coefficient ranges and constant offset
Players input functions using:
+,-for addition/subtraction*for multiplication^for exponents (e.g.,x^2)sin(x),cos(x)for trigonometric functionslog(x)orln(x)for natural logarithmsqrt(x)for square root
Example: 5*x^2+10*sin(2*x)-20
Edit the generate_function() method in server.py to add or modify difficulty parameters.
Update the API key in index.html:
<script src="https://www.desmos.com/api/v1.9/calculator.js?apiKey=YOUR_API_KEY"></script>Modify calculator.setMathBounds() in app.js:
calculator.setMathBounds({
left: -50,
right: 50,
bottom: -100,
top: 100
});-
Update API_BASE in
app.js:const API_BASE = 'https://your-domain.com/api';
-
Use Production WSGI Server:
pip install gunicorn gunicorn -w 4 -b 0.0.0.0:5000 server:app
-
Set up CORS properly in
server.pyfor your domain -
Use PostgreSQL instead of SQLite for better concurrency
-
Add SSL/HTTPS for secure connections
✅ Header positioned at 10% from left (not 50%) ✅ User preview line color: #0000FF (solid blue, not dashed) ✅ Increased feedback font size (18px) ✅ Y-axis centered on graph ✅ Improved answer validation (95% similarity threshold) ✅ Readable answer format (not LaTeX)
- Leaderboards
- User authentication
- Social sharing with preview images
- Achievement badges
- Multiplayer mode
- Custom time-based challenges
- Mobile app version
MIT License - Feel free to use for personal projects!
For issues or questions, please open an issue on the project repository.