From bca8e3bce04a63caf5e24c6c4b70c8603756d80f Mon Sep 17 00:00:00 2001 From: KatolaZ Date: Wed, 7 Aug 2019 15:56:11 +0100 Subject: add Makefile, README, manpage --- 2ls10.6 | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ Makefile | 39 +++++++++++++++++++++++++++++++++++++++ README.md | 16 ++++++++++++++++ config.mk | 7 +++++++ 4 files changed, 110 insertions(+) create mode 100644 2ls10.6 create mode 100644 Makefile create mode 100644 README.md create mode 100644 config.mk diff --git a/2ls10.6 b/2ls10.6 new file mode 100644 index 0000000..3c7de23 --- /dev/null +++ b/2ls10.6 @@ -0,0 +1,48 @@ +.TH 2LS10 1 "05/08/2019" "" "Games" +.SH NAME +2ls10 \- small clone of the popular game '2048'. +.SH SYNOPSIS +.PP +2ls10 +.RI [n] +.PP +.SH DESCRIPTION +.PP +2ls10 is a small clone of the popular game '2048'. +.PP +You start on a square grid (4x4 cells by default). At the beginning, two +of the cells contain either a '2' or a '4'. The aim of the game is to +shift the cells around (left, down, up, right), until you get a cell +with a '2048'. +.PP +The classic `h-j-k-l` keys are used to slide cells left, down, up, +right, respectively. +.PP +When you shift the cells in one direction, any two adjacent +cells along that direction that contain the same number are 'merged' +into a single cell containing twice that number. After each movement, +a new number (either a 2 or a 4) is placed in one of the empty cells, +chosen uniformly at random. +.PP +The game ends where there are no more moves left (in which case you +lost), or when there is at least one cell with a '2048' (which counts as +a win). +.PP +It should be clear now why the executable is called `2ls10`. +.SH ARGUMENTS +.TP 5m +.BI [n] +An optional integer +.BI n +(larger than 1 and smaller than 16) can be passed as first argument to +set the size of the grid. The default is n=4. Larger grids are normally +easier to solve. A 4x4 grid is the smallest one where you can get ever a +2048. +.SH BUGS +At difference with the original game, a new ramdom cell is filled even +if the user attempted to shift the cells in a direction where no shifts +are allowed. +.SH AUTHORS +2ls10 is written and maintained by Vincenzo "KatolaZ" Nicosia. You can +use, copy, modify, and redistribute 2ls10 under the terms of the MIT/X11 +license. diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..051bd74 --- /dev/null +++ b/Makefile @@ -0,0 +1,39 @@ +.POSIX: + +include config.mk + +SRC = 2ls10.c +OBJ = ${SRC:.c=.o} + +all: options 2ls10 + +options: + @echo "-+- build options -+-" + @echo "PREFIX = ${PREFIX}" + @echo "CFLAGS = ${CFLAGS}" + @echo "LDFLAGS = ${LDFLAGS}" + @echo "CC = ${CC}" + @echo "-+-+-+-+-+-+-+-+-+-+-" + +2ls10: ${OBJ} + +clean: + @echo cleaning + @rm -f 2ls10 ${OBJ} + +install: all + @echo installing executable to "${DESTDIR}${BINDIR}" + @mkdir -p "${DESTDIR}${BINDIR}" + @cp -f 2ls10 "${DESTDIR}${BINDIR}" + @chmod 755 "${DESTDIR}${BINDIR}/2ls10" + @echo installing manpage to "${DESTDIR}${MANDIR}/man6" + @mkdir -p "${DESTDIR}${MANDIR}/man6" + @cp -f 2ls10.6 "${DESTDIR}${MANDIR}/man6" + @chmod 644 "${DESTDIR}${MANDIR}/man6/2ls10.6" + +uninstall: + @echo removing executable from "${DESTDIR}${BINDIR}" + @rm -f "${DESTDIR}${BINDIR}/2ls10" + @echo removing manpage from "${DESTDIR}${MANDIR}/man6" + @rm -f "${DESTDIR}${MANDIR}/man6/2ls10.6" + diff --git a/README.md b/README.md new file mode 100644 index 0000000..cd1e581 --- /dev/null +++ b/README.md @@ -0,0 +1,16 @@ +2ls10 +===== + +This is a small clone of the popular game '2048', without any +dependency. Check that `config.mk` looks OK, then: + + make + make install + 2ls10 + +COPYING +======= + +`2ls10` is written and maintained by Vincenzo "KatolaZ" Nicosia +. You can use, copy, modify, and redistribute it +under the terms of the MIT/X11 licence. diff --git a/config.mk b/config.mk new file mode 100644 index 0000000..6979813 --- /dev/null +++ b/config.mk @@ -0,0 +1,7 @@ +VERSION = 0.1 +PREFIX = /usr/local +BINDIR = ${PREFIX}/games +MANDIR = ${PREFIX}/share/man + +CFLAGS = -O3 -pedantic -Wall +#CC = cc -- cgit v1.2.3