Skip to content

Alaa-Younsi/CPlayground-Web-Edition

Repository files navigation

๐Ÿš€ CPlayground - Web Edition

๐ŸŽฏ Live Demo

c-playground-web-edition.vercel.app

Alaa Younsi's Personal Project

A modern web-based interactive C programming learning platform with games, tutorials, calculators, and user management. This is the web version of the original C desktop application, rebuilt with modern web technologies.

Homepage Services Section Blog Section Homepage Services Section Homepage Services Section

๐Ÿ“– About This Project

CPlayground Web Edition is a complete rewrite of my original C-based desktop application into a modern web platform. The original C version (available in another repository) was a command-line application that provided:

  • User authentication with SHA-256 hashing
  • C programming tutorials
  • Interactive games (Number guessing, Tic-Tac-Toe)
  • Basic calculators
  • User profile management

This web version takes all the core functionality and enhances it with:

  • Modern web interface with responsive design
  • Interactive code editor with syntax highlighting
  • Enhanced games with AI opponents
  • Comprehensive tutorials with quizzes
  • Advanced calculators (Matrix, Quadratic solver)
  • User profiles with XP and achievements
  • Admin dashboard for user management

๐Ÿ› ๏ธ Tech Stack

Frontend

  • React
  • TypeScript
  • Tailwind CSS
  • CodeMirror

Build Tools

  • Vite
  • npm

Icons & UI

  • Lucide React

Development

  • Git
  • GitHub

โœจ Features

๐Ÿ” Authentication System

  • Secure user registration and login
  • SHA-256 password hashing using Web Crypto API
  • Persistent sessions with localStorage
  • Email registration support

๐Ÿ’ป Interactive Code Editor

  • Real-time syntax highlighting for C code
  • Code execution simulation
  • Output panel mimicking terminal behavior
  • Save and run functionality

๐ŸŽฎ Games

  • Number Guessing Game: Guess numbers with hints and statistics
  • Tic-Tac-Toe with AI: Play against smart AI with multiple difficulty strategies
  • Real-time game statistics tracking
  • Win/loss tracking integrated with user profiles

๐Ÿ“š Learning Platform

  • C Programming Tutorials:
    • C Language Basics
    • Pointers & Memory Management
    • Data Structures
  • Interactive Quizzes: Test your knowledge with immediate feedback
  • Code Examples: Ready-to-use C code snippets

๐Ÿงฎ Calculator Suite

  • Basic Calculator: Arithmetic operations
  • Quadratic Equation Solver: Shows discriminant and complex roots
  • Matrix Calculator: 2x2 matrix operations (addition & multiplication)

๐Ÿ‘ค User Profiles

  • Personal statistics dashboard
  • XP and leveling system
  • Achievement tracking
  • Activity history
  • Editable user bio

๐Ÿ‘‘ Admin Panel

  • User management system
  • Platform statistics dashboard
  • Data export functionality
  • User activity monitoring

๐Ÿš€ Getting Started

Prerequisites

  • Node.js (v16 or higher)
  • npm or yarn

Installation

  1. Clone the repository

    git clone https://github.com/yourusername/cplayground-web.git
    cd cplayground-web
  2. Install dependencies

    npm install
  3. Run the development server

    npm run dev
  4. Open your browser Navigate to http://localhost:5173

Build for Production

npm run build

The build files will be in the dist directory.

๐Ÿ“ Project Structure

cplayground-web/
โ”œโ”€โ”€ public/              # Static assets
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ components/      # React components
โ”‚   โ”‚   โ”œโ”€โ”€ CodeEditor.tsx      # Code editor interface
โ”‚   โ”‚   โ”œโ”€โ”€ LoginForm.tsx       # Authentication forms
โ”‚   โ”‚   โ”œโ”€โ”€ SignupForm.tsx
โ”‚   โ”‚   โ”œโ”€โ”€ GamePanel.tsx       # Games interface
โ”‚   โ”‚   โ”œโ”€โ”€ TutorialPanel.tsx   # Learning materials
โ”‚   โ”‚   โ”œโ”€โ”€ CalculatorPanel.tsx # Calculator suite
โ”‚   โ”‚   โ”œโ”€โ”€ ProfilePanel.tsx    # User profiles
โ”‚   โ”‚   โ””โ”€โ”€ AdminPanel.tsx      # Admin dashboard
โ”‚   โ”œโ”€โ”€ types/           # TypeScript definitions
โ”‚   โ”œโ”€โ”€ utils/           # Utility functions
โ”‚   โ”œโ”€โ”€ App.tsx          # Main application component
โ”‚   โ”œโ”€โ”€ index.css        # Global styles
โ”‚   โ””โ”€โ”€ main.tsx         # Application entry point
โ”œโ”€โ”€ index.html           # HTML template
โ”œโ”€โ”€ package.json         # Dependencies
โ”œโ”€โ”€ tsconfig.json        # TypeScript config
โ”œโ”€โ”€ tailwind.config.js   # Tailwind CSS config
โ””โ”€โ”€ vite.config.ts       # Vite configuration

๐Ÿ”ง Key Components Explained

CodeEditor Component

Uses CodeMirror to provide a real code editing experience with syntax highlighting, line numbers, and bracket matching.

Authentication System

Implements the same SHA-256 hashing algorithm from the original C application, adapted for the web using the Web Crypto API.

Game Engine

The Tic-Tac-Toe AI uses a three-tier strategy:

  1. Try to win immediately
  2. Block opponent's winning moves
  3. Make strategic moves (center first, then corners)

Data Persistence

Uses browser localStorage to mimic the file-based persistence from the original C application.

๐Ÿ”— From C to Web: The Journey

Original C Application

  • Built as a single-file C program (cplayground.c)
  • Terminal-based interface
  • File-based data storage (data/users.db)
  • SHA-256 implementation in pure C
  • Compiled with GCC

Web Transformation

  • Frontend: React + TypeScript for type safety
  • Styling: Tailwind CSS for rapid UI development
  • Code Editor: CodeMirror for professional editing experience
  • State Management: React hooks for component state
  • Persistence: localStorage for client-side data storage
  • Authentication: Web Crypto API for SHA-256 hashing

Enhanced Features Added

  1. Modern UI/UX: Gradients, animations, responsive design
  2. Interactive Elements: Hover effects, modals, tooltips
  3. Gamification: XP system, achievements, level progression
  4. Admin Tools: User management, data export, statistics
  5. Learning Materials: Interactive tutorials with quizzes

๐Ÿ“ฑ Responsive Design

The application is fully responsive and works on:

  • Desktop computers (โ‰ฅ1024px)
  • Tablets (โ‰ฅ768px)
  • Mobile phones (โ‰ฅ320px)

๐Ÿ”’ Security Features

  • Client-side SHA-256 password hashing
  • Input validation on all forms
  • Protected admin routes
  • XSS prevention through React's built-in escaping
  • No sensitive data in localStorage (only hashed passwords)

๐ŸŽจ Design Philosophy

  • Dark theme for reduced eye strain during coding sessions
  • Terminal-inspired aesthetics to maintain the C programming feel
  • Consistent color scheme with semantic colors:
    • Blue: Information and actions
    • Green: Success and positive feedback
    • Red: Errors and warnings
    • Purple: Features and special elements
  • Minimalist interface focusing on functionality

๐Ÿค Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

๐Ÿ“„ License

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

๐Ÿ™ Acknowledgments

  • Original Inspiration: My C programming journey that led to the original CPlayground
  • CodeMirror: For the excellent code editor component
  • Lucide Icons: For the beautiful icon set
  • Tailwind CSS: For making styling enjoyable
  • React & TypeScript Communities: For amazing tools and documentation

๐ŸŒŸ Show Your Support

Give a โญ๏ธ if this project helped you!


Built with โค๏ธ by [Alaa Younsi]
Transforming C code into a modern web experience


๐Ÿ”— Related Projects

๐Ÿšง Roadmap

  • Add backend API with Node.js/Express
  • Implement real C code compilation
  • Add multiplayer games
  • Create mobile app versions
  • Add more programming languages
  • Implement social features
  • Add code challenge competitions

Note: This is a frontend-only application. All data is stored locally in the browser. For a production version with backend support, additional development would be needed.

About

A Personal Project by me, A modern web-based interactive C programming learning platform with games, tutorials, calculators, and user management.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages