From 4cd0fb1e56998257d8133885df2cf7f7635edef0 Mon Sep 17 00:00:00 2001 From: h45-taylor <harvey.taylor3@live.uwe.ac.uk> Date: Mon, 11 Dec 2023 17:49:20 +0000 Subject: [PATCH] Testing Readme formatting --- .gitignore | 3 +++ 2048.cpp | 30 ++++++++++++++++++++++++++++++ README.md | 19 +++++++++++++++---- game.hpp | 13 +++++++++++++ main.cpp | 7 +++++++ 5 files changed, 68 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index e69de29..1ee1633 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1,3 @@ +build/ +.vscode +Screenshots \ No newline at end of file diff --git a/2048.cpp b/2048.cpp index e69de29..dfbdf74 100644 --- a/2048.cpp +++ b/2048.cpp @@ -0,0 +1,30 @@ +#include "game.hpp" + +#include <iostream> +#include <cstdlib> +#include <iomanip> + +Board::Board() { + //create a 2D array using std::vector using int for boolen values in + board = std::vector<std::vector<int>>(4, std::vector<int>(4, 0)); + STARTER_TILE(); + STARTER_TILE(); +} + +void CREATE_BOARD(){ + std::cout << "-*-*-*-*-*-*-*-*-*-*-*-*-*-*-" << std::endl; //just adds boarder + + for (size_t X = 0; X < board.size(); X++) // This loops through the row or the X axis using board.size to loop the correct amount. + { + for (size_t Y = 0; Y < board.size(); Y++) // This loops throughthe colums or the Y axis + { + int tile = board[X][Y]; + } + std::cout << std::endl; + } + std::cout << "-*-*-*-*-*-*-*-*-*-*-*-*-*-*-" << std::endl; +} + +void STARTER_TILE(){ + +} \ No newline at end of file diff --git a/README.md b/README.md index fb8068a..210d6f4 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,23 @@ # 2048 Game -## In this Code I am going to be recreating [this game](https://play2048.co/) in a linux command line. +[The Rules](#rules) + + + +## In this Code I am going to be recreating the classic[2048](https://play2048.co/) in a linux command line. # The Rules -* If 2 of the same numbers touch they will combine and add up to the value of both added together (e.g. if a 2 block touches another 2 block they will combine and become one 4 block) +* If 2 of the same numbers touch they will combine and add up to the value of both + added together (e.g. if a 2 block touches another 2 block they will combine and become one 4 block). -* You can use the 2 common layouts of cursor keys (arrow keys or wasd) +* You can use the 2 common layouts of cursor keys (arrow keys or wasd). + +* 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 blocks upto a score of 2048 \ No newline at end of file +The aim of the game is to get one of the blocks upto a score of 2048 + +### How its srtuctured + +First of all the board is created and 2 randomly placed and valued numbers are added diff --git a/game.hpp b/game.hpp index e69de29..5b896a8 100644 --- a/game.hpp +++ b/game.hpp @@ -0,0 +1,13 @@ +#pragma once + +#include <vector> + +class Board { +private: +std::vector<std::vector<int>> board; + +public: +Board(); +void CREATE_BOARD(); + +}; \ No newline at end of file diff --git a/main.cpp b/main.cpp index e69de29..e84f1bc 100644 --- a/main.cpp +++ b/main.cpp @@ -0,0 +1,7 @@ +#include "game.hpp" + +int main(){ + Board game; + + return false; +} \ No newline at end of file -- GitLab