Smรกkrafl is an Icelandic word game built with CoffeeScript, Node.js, and Socket.IO. It's a multiplayer web-based game where players compete to find Icelandic words by swapping letters on a grid.
Originally based on an example from "CoffeeScript: Accelerated JavaScript Development" by Trevor Burnham.
- Objective: Find as many 4+ letter Icelandic nouns as possible
- Rules: Words must be in nominative case, singular, without articles
- Gameplay: Take turns swapping two letters on an 8ร8 grid
- Time Limit: 60 seconds per turn
- Game Length: 10 moves per player
- Scoring: Letter values ร number of words formed in a single move
- Grid: 8ร8 board with weighted Icelandic letter distribution
- Word Validation: Uses comprehensive Icelandic dictionary
- Scoring System: Each letter has a point value, multiplied by word count
- Real-time: Instant move updates and live opponent interaction
- Node.js 0.6.10+
- npm
# Clone the repository
git clone https://github.com/arividar/smaskrafl.git
cd smaskrafl
# Install dependencies
npm install
# Start the server
coffee ssserver.coffee
# Open your browser
# Navigate to http://localhost:3000- Enter your username on the landing page
- Wait for other players to join the lobby
- Click on a player's name to send a game invitation
- Accept/decline invitations to start playing
- Take turns swapping letters to form words
- Game ends after 10 moves each - highest score wins!
Server-Side (ssserver.coffee):
- Express HTTP server for static files
- Socket.IO WebSocket server for real-time communication
- Game session management and player matchmaking
- Turn-based timer system (60 seconds per turn)
Game Logic:
GameManager: Handles multiple games and player managementGame: Individual game state and turn managementPlayer: Player data, scoring, and move validationDictionary: Icelandic word validation and markingGrid: 8ร8 letter grid with swap functionality
Client-Side:
index.html: Login and lobby interfacegame.html: Main game board and UIssclient.coffee: Game client logic and server communicationsslobby.coffee: Lobby management and invitation system
Client โโ Socket.IO โโ Server
โ โ
Login โ Lobby โ Invite โ Game โ Moves โ Results โ End
smaskrafl/
โโโ ssserver.coffee # Main server
โโโ GameManager.coffee # Game session management
โโโ Game.coffee # Individual game logic
โโโ Player.coffee # Player state and scoring
โโโ Dictionary.coffee # Word validation
โโโ Grid.coffee # Game board logic
โโโ client/ # Client-side files
โ โโโ index.html # Landing page
โ โโโ game.html # Game interface
โ โโโ ssclient.coffee # Game client
โ โโโ sslobby.coffee # Lobby client
โโโ nonfetlc.js # Icelandic word dictionary
โโโ package.json # Dependencies
- Backend: CoffeeScript, Node.js, Express v2, Socket.IO
- Frontend: HTML5, CSS3, jQuery, jQuery UI
- Real-time: WebSocket communication via Socket.IO
- Deployment: Heroku-ready with Procfile
The game uses a simple message protocol over WebSockets:
Client โ Server:
login: {playername}- Player authenticationinvite: targetPlayer- Send game invitationinviteResponse: yes/no- Respond to invitationmove: {x1, y1, x2, y2}- Submit letter swap
Server โ Client:
playerList: "p1,p2,..."- Available playersinviteFrom: playerName- Incoming invitationwelcome: gameData- Game start informationmoveResult: moveData- Move outcome and scoringgameOver: {winner}- Game completion
# Letter values (from Player.coffee)
tileValues =
a: 1, 'รก': 4, b: 4, d: 3, 'รฐ': 2, e: 2, 'รฉ': 9, f: 3, g: 2, h: 3,
i: 1, 'รญ': 7, j: 4, k: 2, l: 1, m: 2, n: 1, o: 5, 'รณ': 4, p: 5,
r: 1, s: 1, t: 1, u: 1, 'รบ': 7, v: 3, x: 10, y: 6, 'รฝ': 8,
'รพ': 8, 'รฆ': 6, 'รถ': 6
# Final score = (sum of letter values) ร (number of new words formed)- CLAUDE.md - Developer setup and architecture guide
- GAME_FLOW_DOCUMENTATION.md - Comprehensive game flow documentation
We welcome contributions! Here's how to get started:
- Fork the repository
- Clone your fork:
git clone https://github.com/yourusername/smaskrafl.git - Install dependencies:
npm install - Start development server:
coffee ssserver.coffee - Make your changes
- Test thoroughly (multiplayer functionality requires multiple browser windows/tabs)
- CoffeeScript: Follow existing indentation and naming conventions
- Comments: Add comments for complex game logic
- Console Logging: Use descriptive logging for debugging multiplayer interactions
- Error Handling: Always handle WebSocket disconnections and game state errors
Game Features:
- Spectator mode for watching ongoing games
- Game replay functionality
- Tournament/bracket system
- Player statistics and leaderboards
- Chat system during games
Technical Improvements:
- Upgrade to modern Node.js and Express versions
- Convert CoffeeScript to modern JavaScript/TypeScript
- Add comprehensive test suite
- Improve mobile responsiveness
- Add game state persistence
- Performance optimizations for large player counts
UI/UX Enhancements:
- Modern CSS styling and animations
- Better mobile interface
- Accessibility improvements
- Sound effects and visual feedback
- Dark mode theme
- Create a feature branch:
git checkout -b feature/your-feature - Make your changes and test thoroughly
- Commit with descriptive messages
- Push and create a Pull Request
- Include screenshots/demos for UI changes
Since this is a multiplayer game, testing requires:
- Multiple browser windows/tabs for local testing
- Clear browser storage between tests
- Testing disconnection scenarios
- Validating game state synchronization
The game is Heroku-ready with the included Procfile:
# Deploy to Heroku
heroku create your-app-name
git push heroku master
heroku openNo special environment variables required. The app uses process.env.PORT for Heroku deployment.
This project is open source. Please check the repository for license details.
- Issues: Report bugs and feature requests in GitHub Issues
- Discussions: Use GitHub Discussions for questions and ideas
- Documentation: Refer to the comprehensive documentation in this repository
Smรกkrafl - Bringing the beauty of Icelandic language to interactive word gaming! ๐ฎ๐ฎ๐ธ