Skip to content

TheDying0fLight/FairSweeper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FairSweeper

Table of contents


Setup

The game can be run by using the the VS Effekt extension. You have to download the newest version of Effekt and click on the Run button above the main function in the main.effekt file. The game will start in a terminal with instructions on how to play

On Windows some characters won't show correctly in the CLI to fix this you can follow this post (does not work for my Win10 Laptop idk)

Progress

Week 6/7 1.1.2025 - 16.1.2025

Week 4/5 -31.12.2024

Week 3

Week 2

Week 1

  • some simple tests
  • Board
  • CLI interactions
  • print board
  • reveal squares and propagate through field until bombs are nearby
  • working bombs
  • flag squares

Development

All relevant files are contained in the src folder.

Core files:

  • board: The board and solver logic
  • boards: Boards for tests and difficulty presets
  • main: User interaction logic
  • utils: Some helper functions mainly used for board and solver logic

The benchmark.effekt file contains a function to test the speed of the solver and some statistics from previous tests.

test.effekt contains a few tests to test the correctness and speed of solvers

In solver.effekt is a unused and incomplete alternative to the currently used getProbabilities function in board.effekt. There is a possibility to combine the two solver functions for more efficient solution finding.

FFI

Currently only BigInt with some related functions is implemented through FFI it is used when finding possible moves by finding all possible boards. It stores the amount of possible boards on which a mine is placed on relevant fields.

Useful commands

Effekt commands

Run the main file:

effekt src/main.effekt

This (like many other Effekt commands) uses the JavaScript backend by default. To use a different backend, add the --backend <backend> flag.

Run the tests:

effekt src/test.effekt

Open the REPL:

effekt

Build the project:

effekt --build src/main.effekt

This builds the project into the out/ directory, creating a runnable file out/main.

To see all available options and backends, run:

effekt --help

Nix-related commands

While Nix installation is optional, it provides several benefits:

Update dependencies (also runs automatically in CI):

nix flake update

Open a shell with all necessary dependencies:

nix develop

Run the main entry point:

nix run

Build the project (output in result/bin/):

nix build

Example projects using this template

Repository structure

  • .github/workflows/*.yml: Contains the CI definitions
  • src/: Contains the source code
    • main.effekt: Main entry point
    • test.effekt: Entry point for tests
    • lib.effekt: Library code imported by main and test
  • flake.nix: Package configuration in a Nix flake
  • flake.lock: Auto-generated lockfile for dependencies
  • LICENSE: Project license
  • README: This README file

CI

Two GitHub Actions are set up:

  1. flake-check:

    • Checks the flake.nix file, builds and tests the project
    • Runs on demand, on main, and on PRs
    • To run custom commands, add a step using:
      • nix run -- <ARGS> to run the main entry point with the given arguments
      • nix develop -c '<bash command to run>' to run commands in the correct environment
  2. update-flake-lock:

    • Updates package versions in flake.nix
    • Runs on demand and weekly (Tuesdays at 00:00 UTC)

Used Template

Effekt Template

Related

About

A fair version of minesweeper written in effekt

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages