Giter Club home page Giter Club logo

2048-cli's Introduction

2048-cli

run on repl.it

A cli version/engine of the game 2048= for your Linux terminal.

Screenshot

There currently are 2 versions that can be run. This includes a straight-forward terminal based version and one using ncurses. To add a new graphical interface, simply create a .c file which implements all the functions in gfx.h and add a Makefile entry.

Get

git clone https://github.com/tiehuis/2048-cli.git
make

By default, termios.h is expected to be present for the standard terminal version, and a VT100 compatible terminal is being used. If a VT100 terminal is not available, simply alter the makefile and remove the '-DVT100' flag. Compiling with ncurses requires the development libraries for it.

On an ubuntu/debian machine for example, these can be obtained via

apt-get install libncurses5-dev

You can also also easily install this on el >= 5 (CentOS, RedHat Enterprise Linux, Scientific Linux, Oracle) and Fedora >= 19 using the package-manager:

sudo yum install 2048-cli[-nocurses]

For el you will need to have the EPEL-repository enabled.

Controls

hjkl and wasd  Default movement keys
q              Quit the current game

Options

-h             Print the program usage.
-H             Print the current highscore.
-C             Disable color support (default).
-c             Enable color support if supported.
-a             Enable animations (default).
-A             Disable animations.
-i             Enable ai without displaying game.
-I             Enable ai and display game.
-r             Reset highscore. Will prompt user.
-s SIZE        Set the size of the playing field.
-b RATE        Set the rate at which blocks spawn per turn.

License

This code is licensed under the MIT License.

2048-cli's People

Contributors

amdmi3 avatar arbu avatar bentley avatar besser82 avatar christopherraa avatar elsyspedromamede avatar fe051 avatar hyperupcall avatar matiasbian avatar paul-arutyunov avatar tiehuis avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

2048-cli's Issues

Please tag a versioned release

Hello!

I'm planning to package this for Fedora and EPEL. Could you please tag a versioned release and keep that updated, when merging new features / improvements?

Cheers,
Björn

Colors for more than just VT100 terminals

It seems colors only are available for VT100 terminals. I'm using a tmux-256color terminal when I'm running tmux and outside of tmux, the terminal is xterm-256color.

I'm trying to think of where I've seen the use of 256 colors or at least 16 colors in C/C++ programming before, because I know it applies to more than just VT100 terminals.

Support needs to be extended for other terminals.

Instructions for building on Ubuntu 14.04

When I tried to build on Ubuntu, it gave me some errors like Fatal error: can't create obj/ai.o: No such file or directory which I created obj directory manually to fix it. And I also had to install some dev package to fix some missing headers via sudo apt-get install libsdl2-dev libncurses5-dev libsdl2-ttf-dev.

Hope the author update the documentation to support ubuntu/debian distribution.

Rename 18n directory

There is a typo. It has to be "i18n".
From wiki:

The terms are frequently abbreviated to the numeronyms i18n (where 18 stands for the number of letters between the first i and the last n in the word internationalization

Compiling error caused by a possible typo and an unrecognized command line option `-Wno-visibility`

Since I figure this would be a simple enough game to run on a Raspberry Pi 3, I downloaded it to my Pi to try it out.

However, I encountered a couple of errors that need fixing.

$ make
cc -Wno-visibility -Wno-incompatible-pointer-types -Wall -Wextra -DINVERT_COLORS -DVT100 -O2 src/ai.c src/options.c src/main.c src/highscore.c src/engine.c src/merge_std.c src/gfx_terminal.c -o 2048
src/gfx_terminal.c: In function ‘gfx_draw’:
src/gfx_terminal.c:59:28: warning: format ‘%zd’ expects argument of type ‘signed size_t’, but argument 3 has type ‘long int’ [-Wformat=]
                 printf("%*zd |", g->print_width, merge_value(g->grid[x][y]));
                            ^
src/gfx_terminal.c: At top level:
cc1: warning: unrecognized command line option ‘-Wno-visibility’

The first item is that typo on line 59 of gfx_terminal.c. Get rid of that z in that 'printf' statement.

The second item is that I've checked with just about every compiler (well, at least GCC and Clang documentation) and there is no such warning as -Wno-visibility. So you can drop that argument.

I'm going to try to make these corrections myself to see if that fixes everything.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.