diff --git a/README.md b/README.md index 491f5082eec3f8166da3c43c4c75a7ee13826d5c..f8ad409b523d1a69802a97a3e3b3879770742912 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ # 2048 Game -[The Rules](#the-rules) -[The Aim](#the-aim) -[The functions in depth](#the-functions) +- [The Rules](#the-rules) +- [The Aim](#the-aim) +- [The Functions](#the-functions-in-depth) @@ -25,6 +25,7 @@ The aim of the game is to get one of the tiles upto a score of 2048 by combining ## The functions in depth + ### Initilise Function First we set a seed for our random number generator using the system time as the seed. @@ -45,4 +46,8 @@ If there are no empty cells then the game will end. A random number generator will get a random number and devide it by the empty cells variable with the modulo operator then use the remainder of that operation + 1 and put this number in the randomIndex variable. We then use for loops to look through the grid while empty cells increments by one after every cell that isnt occupied and when the empty cells variable becomes the same as the random index it will pass to another if statement. -The final if statement will get a random number and divide it by 2 and the results should be limited to 0 or 1 we then add 1 to the result so that the only results should be 1 or 2 then we multiply that by 2 so that the only result that we should get is 2 or 4 this is then set to the index on the board and the function is exited. \ No newline at end of file +The final if statement will get a random number and divide it by 2 and the results should be limited to 0 or 1 we then add 1 to the result so that the only results should be 1 or 2 then we multiply that by 2 so that the only result that we should get is 2 or 4 this is then set to the index on the board and the function is exited. + +### Print Board Function + +First we use linux system commands to clear the previous grid \ No newline at end of file