Skip to content

Commit 9b98b3d

Browse files
docs: complete readme docs about the lib
1 parent c5bbdd5 commit 9b98b3d

File tree

3 files changed

+32
-7
lines changed

3 files changed

+32
-7
lines changed

.idea/codeStyles/codeStyleConfig.xml

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# Minesweeper GO
22
A Go implementation of Minesweeper, currently available in terminal. In the future it will also compile for wasm and you can use it in your web projects
3-
## How to play ?
3+
4+
5+
![Minesweeper Game](./docs/img/MinesweeperGo.webp)
6+
## How to play ? 🖥️
47
The game is published for test on windows now. you can [download](https://github.com/AmirMahdyJebreily/MinesweeperGO/releases/tag/win-test) the .exe or you can build your exe :
58
```shell
69
git clone https://github.com/AmirMahdyJebreily/MinesweeperGO.git && cd MinesweeperGO
@@ -17,7 +20,7 @@ enjoy the game
1720

1821
but in the future you can play in Unix and Windows environments (under the terminal).
1922

20-
## Why did I write this code?
23+
## Why did I write this code? 🤔
2124
You might ask, "What unemployed programmer would implement such an old and boring game in Go?" But I have to tell you that first, I am not unemployed, and second, this game is not boring. I develop and maintain this codebase for this two reasons.
2225

2326
First, many programmers in the 90s had fun making games that ran in terminal or DOS environments. Today, there are many engines for making games that make the programmer's job easier and allow the game developer to focus on the game itself, not on how to present a graphical environment on a particular game console.
@@ -28,7 +31,10 @@ Secondly, I myself wanted to check where exactly Go could be run. I used other l
2831
.NET runs wherever you can install its runtime, but the .NET runtime is much heavier than Go and cannot be run on every operating system, and for me, Go is a gateway to other operating systems and environments. I'm trying to install old and new operating systems on virtual machines (probably this one I made myself), and run this program on them to see where exactly go can be. I also have a Nano Pi 2 Fire at home, which does the same thing as a Raspberry Pi, but with a bit less capabilities! I've also ported it to different SBCs and maybe even different Micro Controllers to see exactly how far I can push Go. (TinyGo is a compiler that I hope will help me!)
2932
This page will be updated gradually and I'll upload a YouTube video reporting on this exciting zero!
3033

31-
## How do I make one for myself?
34+
## Why Minesweeper? 💣
35+
Why not?! It's a logical and engaging game that always tells you that something must have left a mark or this number shouldn't be here! If you like challenging your brain, this game will really entertain you!
36+
37+
## How do I make one for myself? 🧑‍💻🧑‍💻
3238
Use the `minesweeperlib` to create your own Minesweeper (as an exercise or to help students, etc.). It's provides just **5 functions** that allow you to create your Minesweeper in any platform (such as a browser):
3339

3440
#### **1. The `GetBoard(cols, rows)` function**
@@ -92,6 +98,10 @@ The last function determines the win/loss status. If you have flagged all the bo
9298

9399
---
94100

95-
## Contribute
101+
## Why do I write its documentation in detail? 📝
102+
Because maybe someone will want to help make this repo's mission come true!
103+
104+
## Contribute ☕
96105
- If you can provide fast and efficient ways to implement game logic, fork the repository and get started 👍
97-
- The game needs to have different themes. Design separate themes for the game 😊
106+
- The game needs to have different themes. Design separate themes for the game 😊
107+
- If you can run the game on a platform that you don't think is common, I'd be happy to put the code you wrote for that platform in the cmd directory and submit a Pull Request so I can merge it 📝

cmd/wasm/main/main.go

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88

99
func JS_GetBoard() js.Func {
1010
var ArgumentError = js.ValueError{
11-
Method: "[MineSweeperLib_Js_Getboard]: Input arguments are not supported\nplease see documents again at",
11+
Method: "[minesweeperlib_JS_Getboard]: Input arguments are not supported\nplease see documents again at (https://github.com/AmirMahdyJebreily/MinesweeperGO/tree/main/cmd/wasm/main)",
1212
Type: types.Int,
1313
}
1414
return js.FuncOf(func(this js.Value, args []js.Value) any {
@@ -21,7 +21,17 @@ func JS_GetBoard() js.Func {
2121
}
2222

2323
func JS_GetRandomBombs() js.Func {
24-
24+
var ArgumentError = js.ValueError{
25+
Method: "[minesweeperlib_JS_GetRandomBombs]: Input arguments are not supported\nplease see documents again at (https://github.com/AmirMahdyJebreily/MinesweeperGO/tree/main/cmd/wasm/main)",
26+
Type: types.Int,
27+
}
28+
return js.FuncOf(func(this js.Value, args []js.Value) any {
29+
if len(args) != 2 {
30+
return ArgumentError.Error()
31+
}
32+
cols, rows := args[0].Int(), args[1].Int()
33+
return minesweeperlib.GetBoard(cols, rows)
34+
})
2535
}
2636

2737
func main() {

0 commit comments

Comments
 (0)