Skip to content

This project uses SLY library of python to create a customized compiler for the 2048 game.

Notifications You must be signed in to change notification settings

f20180127/2048-Game-engine-and-compiler-using-SLY

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TO PLAY THE 2048 GAME, RUN THE FOLLOWING COMMAND IN TERMINAL FROM THE 2048 FOLDER: 

make run

TO SAVE THE STDERR TO "output.txt" file:

make save

The lexer and parser of the game are customized to allow 16 user operations 
(4 functions - ADD, SUBTRACT, DIVIDE, MULTIPLY and 4 directions - UP, DOWN, LEFT, RIGHT). 

Apart from that cell tiles can be given any value and also named as well with distinct names. 
A value of a tile can also be accessed. 
All the commands are to be typed and the compiler handles the cases when the user types 
arbitrary input/syntax errors by displaying the proper messages on stdout and also stderr.

The correct example commands for the compiler are:-

1.) ADD LEFT. (For moves, Similarly all 16 combinations of moves)
2.) ASSIGN 4 TO 1,1. (For Assigning a cell with a value, Matrix is 1-indexed)
3.) VALUE IN 3,3. (For peeping a cell value)
4.) 1,4 IS ABC. (For adding a name to a tile, names get appended)

About

This project uses SLY library of python to create a customized compiler for the 2048 game.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages