Skip to content

hamidriaz1998/solitaire-svelte

Repository files navigation

Solitaire Game

A modern implementation of the classic Solitaire (Klondike) card game built with Svelte, TypeScript, and TailwindCSS. This project features a clean design with smooth animations, drag-and-drop gameplay, and a complete scoring system.

Solitaire Game Screenshot

Features

  • 🎮 Classic Solitaire gameplay
  • 🎯 Complete scoring system
  • ⏱️ Game timer
  • 🔄 Undo/Redo functionality
  • 🖱️ Drag-and-drop card movement
  • 💫 Smooth animations
  • 🎨 Modern UI with TailwindCSS

Getting Started

Prerequisites

This project is built using Deno with Vite and Svelte. While the application will run with Node.js, Deno is required for running tests.

Required:

  • Deno 2.0.0 or higher
  • Node.js 18 or higher
  • npm, pnpm, or yarn package manager

Optional:

  • VS Code with Deno extension for the best development experience

Installation

  1. Clone the repository:
git clone https://gitlab.com/hamidriaz1999/csc200m24pid10.git
cd solitaire
  1. Install dependencies:
deno install
deno install --allow-scripts=npm:svelte-preprocess@5.1.4
# or
npm install
# or
pnpm install
  1. Start the development server:
deno task dev
# or
npm run dev
# or
pnpm dev
  1. Open your browser and navigate to http://localhost:5173

Building for Production

To create a production build:

deno task build
# or
npm run build
# or
pnpm build

Game Rules

Objective

The goal is to move all cards to the foundation piles, building up each suit from Ace to King.

Scoring System

  • Moving cards from waste to foundation: +10 points
  • Moving cards from waste to tableau: +5 points
  • Moving cards from tableau to foundation: +10 points
  • Turning over a tableau card: +5 points
  • Moving cards from foundation to tableau: -15 points
  • Recycling the waste pile: -100 points

Technology Stack

  • Frontend Framework: Svelte
  • Language: TypeScript
  • Styling: TailwindCSS
  • Build Tool: Vite
  • Testing: Deno Test

Project Structure

solitaire/
├── src/
│   ├── components/      # Svelte components
│   ├── gameLogic/      # Game logic classes
│   ├── shared/         # Shared states
│   ├── DataStructures/ # Custom data structures
│   └── tests/          # Test files
├── public/             # Static assets
└── ...config files

Testing

Tests are written using Deno's built-in test framework. Make sure you have Deno installed before running tests.

The project includes comprehensive tests for the game logic and data structures. To run the tests:

deno test

Dependencies

Main Dependencies

  • Svelte
  • TypeScript
  • TailwindCSS

Development Dependencies

  • Deno or Node
  • Vite
  • PostCSS
  • Autoprefixer

Todos

  • Make the design responsive for mobile devices

  • Migrate to Svelte 5

  • Additional features

    • Add hints
    • Save game state to localStorage
    • Implement high score system

About

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors