Number Guessing Game
A fun, lightweight WordPress plugin — guess the secret number with 8 difficulty levels, player stats, and confetti animations. No frameworks, no build step.
by Moudud Ahmed · github.com/akzmoudud/number-guessing-game · website
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/akzmoudud/number-guessing-game/archive/refs/heads/main.zipA fun, colorful number guessing game with 8 difficulty levels, admin settings, player stats, and engaging animations.
Description
Number Guessing Game adds a beautiful, interactive number guessing game to your WordPress site. A floating game button appears on every page, letting visitors play instantly without leaving your site.
Features:
- 8 Difficulty Levels — Beginner (1–10) to Impossible (1–10,000)
- Admin Settings — Enable/disable levels, control guest access from WP Admin
- Smart Try Limits — Based on binary search math, so every game is always solvable
- Player Statistics — Track games played, win rate, streaks, and best scores
- Anti-Cheat — Secret number stored server-side, never exposed to the browser
- Beautiful UI — Custom game logo, dark header, smooth animations, confetti on wins
- Mobile Responsive — Looks great on any device
- Lightweight — No jQuery, no frameworks, pure vanilla JavaScript (~6KB)
- Guest Support — Stats persist via localStorage even without login
- i18n Ready — Fully translatable
Difficulty Levels:
- Beginner: 1–10 (4 tries, 1x multiplier)
- Easy: 1–25 (5 tries, 2x multiplier)
- Medium: 1–50 (6 tries, 3x multiplier)
- Hard: 1–100 (7 tries, 5x multiplier)
- Expert: 1–250 (8 tries, 7x multiplier)
- Master: 1–500 (9 tries, 10x multiplier)
- Legend: 1–1,000 (10 tries, 15x multiplier)
- Impossible: 1–10,000 (14 tries, 25x multiplier)
How It Works:
- Click the floating game button (bottom-right corner)
- Choose a difficulty level
- Guess the secret number using the hints (higher/lower)
- Try to find it within the allowed number of tries
- Check your stats and beat your high score!
Admin Settings:
Go to Settings > Number Game to:
- Enable or disable any of the 8 difficulty levels
- Allow or block guest (non-logged-in) users from playing
Installation
- Upload the
number-guessing-gamefolder to/wp-content/plugins/ - Activate the plugin through the 'Plugins' menu in WordPress
- That's it! The game button appears automatically on your site
- Optionally configure levels and access at Settings > Number Game
Frequently Asked Questions
How are the try limits calculated?
Try limits are based on binary search: ceil(log2(range)). This means every game is mathematically solvable if you use the optimal strategy of always guessing the middle number.
Does it slow down my site?
No. The plugin loads only ~6KB of JavaScript and ~10KB of CSS. No external libraries or CDN calls.
Can visitors cheat?
No. The secret number is stored server-side using WordPress transients. The browser never receives the answer until the game ends.
Does it work without user login?
Yes by default! Guest players get a session ID stored in localStorage. Admins can disable guest access from Settings > Number Game.
Can I disable certain difficulty levels?
Yes. Go to Settings > Number Game and toggle any level on or off.
Changelog
1.0.0
- Initial release
- 8 difficulty levels (Beginner to Impossible)
- Admin settings page (level control, guest access)
- Custom SVG game logo trigger button
- Player statistics tracking with per-level breakdown
- Confetti animations on win
- Mobile responsive design