Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
my2048clone
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hamed2.Alsaddi@live.uwe.ac.uk
my2048clone
Commits
8847e109
Commit
8847e109
authored
2 months ago
by
Hamed2.Alsaddi@live.uwe.ac.uk
Browse files
Options
Downloads
Patches
Plain Diff
Some new changes
parent
ec975bc6
No related branches found
No related tags found
1 merge request
!1
Initial commit 2048 clone
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
game.hpp
+25
-0
25 additions, 0 deletions
game.hpp
with
25 additions
and
0 deletions
game.hpp
+
25
−
0
View file @
8847e109
...
...
@@ -7,7 +7,32 @@ public:
void
start
();
private:
static
const
int
SIZE
=
4
;
int
board
[
SIZE
][
SIZE
];
int
score
;
// Initialization
void
initBoard
();
void
addRandomTile
();
// Movement
void
moveLeft
();
void
moveRight
();
void
moveUp
();
void
moveDown
();
// Helper functions
void
transpose
();
void
reverseRow
(
int
rowIndex
);
void
compressRow
(
int
row
[
4
]);
void
mergeRow
(
int
row
[
4
]);
// Logic
bool
checkGameOver
();
bool
hasEmptyCell
();
bool
canMerge
();
// UI
void
printBoard
();
};
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment