Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

K game

Haskell Cabal

A fully playable 2048 like game, running in the terminal, built entirely with pure functional programming principles in Haskell.

Demo

GamePlay Demo

About the Project

This project was developed to deepen my understanding of functional programming, immutable state management, and pure functions. It serves as a refactoring exercise, moving away from imperative memory management (C) to a declarative and type-safe architecture (Haskell).

Key Learnings & Architectural Choices:

  • Pure Functions: The core game logic (moving, merging, generating elements)
  • Terminal UI: Handled using brick TUI library

Features

  • Smooth predictable terminal rendering
  • Score tracking and FOV calculation
  • Strict type safety preventing invalid moves

Tech Stack

  • Language: Haskell
  • Build Tools: Cabal
  • Libraries: brick, random, vty

How to run localy

To build and play the game on your machine, ensure you have ghc and cabal installed.

  1. Clone the repository:
git clone https://github.com/RoNiN-shadow/k-game.git
cd k-game
  1. Build the project:
cabal build
  1. Run the game:
cabal run

Controls

  • / Up Arrow - Move Up
  • / Down Arrow - Move Down
  • / Left Arrow - Move Left
  • / Right Arrow - Move Right
  • q - Quit Game

About

A fully playable 2048 like game, running in the terminals in Haskell

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages