git: 18c77415cbe2 - main - games/mastermind: traditional console-based mastermind game

From: Robert Clausecker <fuz_at_FreeBSD.org>
Date: Mon, 28 Oct 2024 12:44:12 UTC
The branch main has been updated by fuz:

URL: https://cgit.FreeBSD.org/ports/commit/?id=18c77415cbe281f35cfba61905305e0706dad3bd

commit 18c77415cbe281f35cfba61905305e0706dad3bd
Author:     Qiang Guo <bigdragonsoft@gmail.com>
AuthorDate: 2024-10-25 20:39:55 +0000
Commit:     Robert Clausecker <fuz@FreeBSD.org>
CommitDate: 2024-10-28 12:41:57 +0000

    games/mastermind: traditional console-based mastermind game
    
    This is a traditional console-based Mastermind game. The rules are as follows:
    1. The game will generate a 4-digit color/number code
    2. The range of colors/numbers is from 1 to 8
    3. The player has 10 chances to guess the code
    4. After each guess, the system will provide hints:
       - Green plus sign (+) indicates both color and position are correct
       - Red minus sign (-) indicates the color is correct but the position is wrong
    5. The player needs to gradually guess the correct code based on the hints
    6. During the game, you can enter 'r' at any time to switch display mode
       (color blocks/numbers)
    7. During the game, you can enter 'q' at any time to exit the game
    
    WWW: https://github.com/bigdragonsoft/mastermind
---
 games/Makefile             |  1 +
 games/mastermind/Makefile  | 27 +++++++++++++++++++++++++++
 games/mastermind/distinfo  |  3 +++
 games/mastermind/pkg-descr | 11 +++++++++++
 4 files changed, 42 insertions(+)

diff --git a/games/Makefile b/games/Makefile
index f1374694258d..9b56d520fed1 100644
--- a/games/Makefile
+++ b/games/Makefile
@@ -613,6 +613,7 @@
     SUBDIR += mangband
     SUBDIR += marblemarcher
     SUBDIR += mari0
+    SUBDIR += mastermind
     SUBDIR += masterserver
     SUBDIR += maxr
     SUBDIR += meandmyshadow
diff --git a/games/mastermind/Makefile b/games/mastermind/Makefile
new file mode 100644
index 000000000000..6c44e78d3d47
--- /dev/null
+++ b/games/mastermind/Makefile
@@ -0,0 +1,27 @@
+PORTNAME=	mastermind
+DISTVERSION=	0.1.0
+CATEGORIES=	games
+
+MAINTAINER=	bigdragonsoft@gmail.com
+COMMENT=	Traditional console-based Mastermind game
+WWW=		https://github.com/bigdragonsoft/mastermind
+
+LICENSE=	BSD3CLAUSE
+LICENSE_FILE=	${WRKSRC}/LICENSE
+
+USE_GITHUB=	yes
+GH_ACCOUNT=	bigdragonsoft
+
+CFLAGS+=	-std=c99
+
+PLIST_FILES=	bin/mastermind \
+		share/man/man6/mastermind.6.gz
+
+do-build:
+	${CC} ${CPPFLAGS} ${CFLAGS} ${LDFLAGS} -o ${WRKSRC}/mastermind ${WRKSRC}/mastermind.c ${LIBS}
+
+do-install:
+	${INSTALL_PROGRAM} ${WRKSRC}/mastermind ${STAGEDIR}${PREFIX}/bin/
+	${INSTALL_MAN} ${WRKSRC}/mastermind.6 ${STAGEDIR}${PREFIX}/share/man/man6/
+
+.include <bsd.port.mk>
diff --git a/games/mastermind/distinfo b/games/mastermind/distinfo
new file mode 100644
index 000000000000..9b7189c5c3d6
--- /dev/null
+++ b/games/mastermind/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1729888458
+SHA256 (bigdragonsoft-mastermind-0.1.0_GH0.tar.gz) = 88d3ea65b8b2a7c1089cd429e5c9d817c56428140be91527991c7968f967753b
+SIZE (bigdragonsoft-mastermind-0.1.0_GH0.tar.gz) = 87698
diff --git a/games/mastermind/pkg-descr b/games/mastermind/pkg-descr
new file mode 100644
index 000000000000..3b0feac91fc8
--- /dev/null
+++ b/games/mastermind/pkg-descr
@@ -0,0 +1,11 @@
+This is a traditional console-based Mastermind game. The rules are as follows:
+1. The game will generate a 4-digit color/number code
+2. The range of colors/numbers is from 1 to 8
+3. The player has 10 chances to guess the code
+4. After each guess, the system will provide hints:
+   - Green plus sign (+) indicates both color and position are correct
+   - Red minus sign (-) indicates the color is correct but the position is wrong
+5. The player needs to gradually guess the correct code based on the hints
+6. During the game, you can enter 'r' at any time to switch display mode
+   (color blocks/numbers)
+7. During the game, you can enter 'q' at any time to exit the game