diff --git a/.gitignore b/.gitignore index 586e38965de1fd3f76cc20f30a4c408c1040dac5..7dc6c63b37297be5a17ee83cfe4a51b7bad68f68 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ build/ .vscode -a.out \ No newline at end of file +a.out +rnd \ No newline at end of file diff --git a/README.md b/README.md index 97d7a4d7d911d23e321410b65405a1ef972a2df0..201b4c500b653da909350097953cd71b4bb2ad14 100644 --- a/README.md +++ b/README.md @@ -18,11 +18,9 @@ * You can use w/a/s/d or W/A/S/D to control the game. -* If there is no empty cells left with no valid moves then the game will end.. - -## The Aim -The aim of the game is to get one of the tiles upto a score of 2048 by combining other tiles. +* If there is no empty cells left with no valid moves then the game will end. +* If you get one of the cells to 2048 you win. ## The functions in depth diff --git a/rnd.cpp b/rnd.cpp new file mode 100644 index 0000000000000000000000000000000000000000..58c3d57f9ba709aa2616c668e2d411378a19bf20 --- /dev/null +++ b/rnd.cpp @@ -0,0 +1,40 @@ +#include <iostream> +#include <ctime> +using namespace std; + +int main() { + +int avg2 = 0; +int avg4 = 0; + +int Loop; + +srand(time(0)); + +for (Loop = 0; Loop < 100; Loop++) +{ + +int random = rand(); +cout << random << endl; + +int randomaftr = rand() % 2; +cout << randomaftr << endl; + +int randpone = randomaftr + 1; +cout << randpone << endl; + +int randmtwo = randpone * 2; +cout << randmtwo << endl; + +if (randmtwo == 2) +{ + avg2++; +} +if (randmtwo == 4) +{ + avg4++; +} +} + +cout << "After " << Loop << " loops, We have resulted in 2 a total of " << avg2 << " times and 4 " << avg4 << " times."; +} \ No newline at end of file