7 Ways to Solve Minesweeper

Опубликовано: 07 Февраль 2026
на канале: Exercism
4,097
95

We look at 7 different solutions to Exercism's Minesweeper exercise - exploring solutions using nested loops, clever use of min/max to simplify bounds checking, functional pipelines and using two-dimensional matrices in Julia, C++, F#, Rust, Ruby, Crystal, and Java.

Kick back and enjoy 30mins of learning with Jeremy and Erik, then go solve the exercise in your favourite way on Exercism.

Solve the exercise at: https://exercism.org/exercises/minesw...
Join #48in24 at: https://exercism.org/challenges/48in24

Featured solutions:
https://exercism.org/tracks/cpp/exerc...
https://exercism.org/tracks/java/exer...
https://exercism.org/tracks/rust/exer...
https://exercism.org/tracks/crystal/e...
https://exercism.org/tracks/julia/exe...
https://exercism.org/tracks/fsharp/ex...
https://exercism.org/tracks/ruby/exer...

Timestamps:
00:00:00 Introduction
00:00:45 C++: for loops and indexing
00:06:25 Java: for loops with StringBuilder and min/max for simplified bounds checking
00:10:31 Rust: functional pipeline using map, filter and neighbor deltas
00:15:51 Crystal: function pipeline and string translate method to replace chars
00:20:07 Ruby: Starting with the mines
00:24:46 Julia: convert to 2D matrix and iterate over mines and update neighbors
00:31:07 F#: use Array2D type and extra padding for easy bounds checking
00:39:26 Conclusion