Initial author: migf1
Latest version: 0.3a3 (July 21, 2014)
Discussion (Greek): http://goo.gl/b0AZG5
2048cc is a console-clone of Gabriel Cirulli's 2048 game, written in standard ISO C99. It is meant to be source-wise cross-platform across Windows, Unix, Linux, and MacOSX (for the latter 3, you should enable ANSI-colors support on your terminal emulation).
It is put on Github with the hope of attracting more contributors.
Compared to the original game, 2048cc additionally supports:
- skins (color themes)
- undo/redo (it disables best-score tracking)
- replays
- load/save games (via replays)
Currently, 2048cc is also cloning 3 unofficial variants of the original game, namely:
- 5x5 board ( http://2048game.com/variations/5x5.html )
- 6x6 board ( http://2048game.com/variations/6x6.html )
- 8x8 board ( http://2048game.com/variations/8x8.html )
The included zip-file contains a pre-compiled 32bit executable file
for Windows (XP or newer).
It is called: 2048cc_win_x86.exe.
On other platforms, you can compile the sources. See the next 2 sections.
Compiling the sources is pretty straight-forward. Currently, no configuration tools are necessary.
Using the command-line
To compile the sources with the gcc tool-chain, please follow these simple steps (adopt accordingly for other compilers):
-
Extract the zip file anywhere you want in your hard-drive.
-
From the command-line, navigate into the src/ folder.
-
On Windows (e.g. using the mingw or cygwin gcc tool-chain) type:
gcc -std=c99 -s -O3 -D_BSD_SOURCE *.c -o 2048cc.exe
On Unix/Linux/MacOSX type:
gcc -std=c99 -s -O3 -D_BSD_SOURCE *.c -o 2048cc.out
Recent versions of MacOSX do not include the gcc tool-chain
by default, so you may need to install it manually. Please read
this thread for instructions. -
See the next section on how to run the executable file.
Using any IDE/C99-compiler combo
To compile the sources from within an IDE, with any C99 compiler, please follow these simple steps:
- Extract the zip file anywhere you want in your hard-drive.
- Create a new console/terminal project (perhaps call it: 2048cc).
- Add to the project all the .c files found inside the src/ folder.
- Enable C99 support on your compiler.
- Predefine the directive
_BSD_SOURCE
(only tested with gcc). - Build a Release version of the project.
- See the next section on how to run the executable file.
After the compilation is done, move the executable file (either 2048cc.exe or 2048cc.out... see above) out of the src/ folder.
Actually the executable file should be in the same path with the replays/ folder, otherwise you will not be able to load/save replays.
Run the executable, enjoy the game and please report any bugs you may find.
There are 2 playing modes: normal and replay.
Normal-mode
This is the default mode, the one used for playing the game. Use the arrow-keys
on your keyboard to make a move on the board. Use any key displayed with a
right parenthesis after its name in the Main Menu, to issue the corresponding
menu-command. For example, the menu-command S)kin
is issued by hitting the S
key on your keyboard (this particular command cycles through the available color
skins of the game).
Undo/Redo
You may undo one or more moves at any given time, but the penalty will be that best-score tracking gets disabled. Re-doing undone moves will not re-establish best-score tracking. The moves-counter on the lower part of the screen displays the count of the current move. In case one or more Undo has been done, the counter also displays the count of available moves to be redone.
Replay-mode
This mode is entered by issuing the Rep)lay
command, in the Main Menu. Once
inside the replay-mode, a new set of commands is displayed on the lower part
of the screen. They are used for navigating inside the current replay, for
saving/loading replay files, and for returning back to the main menu.
When entering the replay-mode (or when loading a replay-file) the replay is automatically re-winded to the very 1st move. Then you can either navigate manually, or let it play automatically (in that case you will not be able to stop the auto-play... you'll have to wait until it is finished).
Replays do not take into account any Undone moves! That is, the last move in a replay is the one corresponding to your last Undo. However, they do display any available moves to be Redone (when exiting the replay-mode).
While viewing a replay, you can see on the lower-right part of the screen what move was applied to the board in the previous move, along with what move was applied to the current move for yielding the next move. For example, when you see UP|RIGHT, it means that in the previous move the board was played upwards, and that for the next move the board was played toward the right side.
Exiting the replay-mode, sets the game to the last recorded move of the replay, without counting any Undone moves (but, if any, their count will be displayed and you may Redo them if you want to... best-score tracking will be disabled of course).
Load/Save Replay Files
The replay-mode may also be used for saving unfinished games, and load them at a later time to finish them. That's because when loading a replay-file, it overwrites completely the current state of the game.
In order to be able to save and load replay-files, the executable program MUST be in the same path with the replays/ folder. This is hard-coded into the game and most probably it will stay that way until I or someone else implements either a proper GUI, or a a more advanced text-user-interface (using ncurses for example).
With its current primitive text-user-interface, the game doesn't even allow the user to specify a name when saving a replay-file. Instead, a pre-defined name is generated automatically, using a timestamp from the system clock.
It is of the form Day_Month_DD_HHMMSS_Year.sav and it is automatically saved in the replays/ folder. Before loading a replay-file, the contents of the "replays/" folder are listed, and the user has to type-in the name of the file he wishes to load (but without typing the replays/ folder).
To make your life easier, consider renaming manually any replay-files you have saved, before attempting to load them from within the game.
The game is open-source, free software with only 3 limitations:
- Keep it free and open-source.
- Do not attempt to make any kind of profit from it or from any derivatives of it.
- Always re-distribute the original package, along with any software you distribute based on this game.
Use the program at your own risk! I take no responsibility for any damage it may cause to your system.