Giter VIP home page Giter VIP logo

Comments (5)

comwrg avatar comwrg commented on June 29, 2024

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.

plibither8 avatar plibither8 commented on June 29, 2024

So there are two things for it to work properly (and show meaningful values):

  1. The data/ folder containing the statistics.txt and scores.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 the data 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.
  2. 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.

comwrg avatar comwrg commented on June 29, 2024

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

  1. 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/
  2. Facilitate transplantation

from 2048.cpp.

plibither8 avatar plibither8 commented on June 29, 2024

That's a great suggestion. I'll certainly implement it soon. Thanks a lot 😄

from 2048.cpp.

plibither8 avatar plibither8 commented on June 29, 2024

Fixed by #28

from 2048.cpp.

Related Issues (20)

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.