Comments (5)
It also happens when you change the root directory of the run
~/Downloads/2048.cpp
▶ cd build
~/Downloads/2048.cpp/build
▶ ./2048.out
/\\\\\\\\\ /\\\\\\\ /\\\ /\\\\\\\\\
/\\\///////\\\ /\\\/////\\\ /\\\\\ /\\\///////\\\
\/// \//\\\ /\\\ \//\\\ /\\\/\\\ \/\\\ \/\\\
/\\\/ \/\\\ \/\\\ /\\\/\/\\\ \///\\\\\\\\\/
/\\\// \/\\\ \/\\\ /\\\/ \/\\\ /\\\///////\\\
/\\\// \/\\\ \/\\\ /\\\\\\\\\\\\\\\\ /\\\ \//\\\
/\\\/ \//\\\ /\\\ \///////////\\\// \//\\\ /\\\
/\\\\\\\\\\\\\\\ \///\\\\\\\/ \/\\\ \///\\\\\\\\\/
\/////////////// \/////// \/// \/////////
Welcome to 2048!
1. Play a New Game
2. View Highscores and Statistics
Enter Choice: 2
/\\\\\\\\\ /\\\\\\\ /\\\ /\\\\\\\\\
/\\\///////\\\ /\\\/////\\\ /\\\\\ /\\\///////\\\
\/// \//\\\ /\\\ \//\\\ /\\\/\\\ \/\\\ \/\\\
/\\\/ \/\\\ \/\\\ /\\\/\/\\\ \///\\\\\\\\\/
/\\\// \/\\\ \/\\\ /\\\/ \/\\\ /\\\///////\\\
/\\\// \/\\\ \/\\\ /\\\\\\\\\\\\\\\\ /\\\ \//\\\
/\\\/ \//\\\ /\\\ \///////////\\\// \//\\\ /\\\
/\\\\\\\\\\\\\\\ \///\\\\\\\/ \/\\\ \///\\\\\\\\\/
\/////////////// \/////// \/// \/////////
SCOREBOARD
----------
No saved scores.
STATISTICS
----------
+--------------------+------------+
| Best Score | 140732826948896 |
| Game Count | 1 |
| Number of Wins | -1837137648 |
| Total Moves Played | 140734694615213 |
| Total Duration (s) | 3.25939e-311 |
+--------------------+------------+
Press any key to exit:
from 2048.cpp.
So there are two things for it to work properly (and show meaningful values):
- The
data/
folder containing thestatistics.txt
andscores.txt
files needs to be placed in the in the directory where the command is run from. The code is such that it looks for thedata
folder in the directory where the command was run from. This is a caveat and proper checks need to be implemented to ascertain first whether the files exist or not. I'll take this up. - Even if the files exist, if they are empty (in the first run, when you have not played any game) the program will not be able to assign values to existing variables, which ideally should have been assign to values in the file. Thus, garbage values are shown.
Thanks for bringing this to notice, I'll work towards a solution.
from 2048.cpp.
Thank you for your quick reply.
Personally, I think the data/
folder should be put together with the executable file, and the data/
folder should be created when the program is running
There are two benefits
- Unrelated to where the command is run from, for example, I run the executable file through a soft link, it's very important when I put a soft link to
/usr/local/bin/
- Facilitate transplantation
from 2048.cpp.
That's a great suggestion. I'll certainly implement it soon. Thanks a lot 😄
from 2048.cpp.
Fixed by #28
from 2048.cpp.
Related Issues (20)
- Replace enum with enum class HOT 2
- Question: Create build script to make installation easier? HOT 3
- Allow user to go back to main menu from high score screen HOT 1
- Allow user to go back to main menu when choosing game board size HOT 5
- Error with .clang-format HOT 1
- Multi-language support HOT 5
- Remove `build` empty directory in source tree.
- Add option to forfeit/quit an active game session HOT 5
- score and statistics wrong HOT 5
- Encoding problem
- error: no viable overloaded '='
- Add Travis CI as an automated pre-check for all Pull Requests.
- when load the saved game board, best score is not visible
- A simpler way to build without meson or cmake HOT 1
- New ci failure HOT 3
- my cmake can't run it HOT 3
- Always occur segmentation fault after I enter the gameboard size HOT 2
- Strange characters when running app HOT 1
- My collage project.
- Incorrect statistics saved at the end of the game
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from 2048.cpp.