feat: added input (player_one and player_two now can place on board)

This commit is contained in:
DarthMooMancer
2025-09-02 10:58:08 -04:00
parent 169d39d974
commit 000bc7811a
9 changed files with 108 additions and 13 deletions
+27 -1
View File
@@ -1,6 +1,32 @@
#ifndef ELEMENTS_HPP
#define ELEMENTS_HPP
// Add code here
struct Point {
Point();
Point(int row, int col) : m_row(row), m_col(col) {};
int m_row;
int m_col;
void assign(int row, int col);
void to_string();
};
struct Player {
Player(char symbol, bool turn) : m_symbol(symbol), m_turn(turn) {};
char m_symbol;
bool m_turn;
};
struct Tile {
Tile(int row, int col) : m_pos(row, col), m_symbol(' '), _delete(false) {};
char m_symbol;
Point m_pos;
bool _delete;
};
struct Border {
Border(int row, int col, char symbol) : m_pos(row, col), m_symbol(symbol) {};
char m_symbol;
Point m_pos;
};
#endif
+2 -2
View File
@@ -1,7 +1,7 @@
#ifndef GLOBALS_HPP
#define GLOBALS_HPP
constexpr int ROW = 10;
constexpr int COL = 10;
constexpr int ROW = 5;
constexpr int COL = 5;
#endif
+3 -3
View File
@@ -1,10 +1,10 @@
#ifndef INPUT_HPP
#define INPUT_HPP
// #include "elements.hpp"
#include "elements.hpp"
struct Input {
char m_getch = ' ';
void get_input(bool &running);
int m_getch = 0;
void get_input(bool &running, Tile (&tile_list)[9], Player &player_one, Player &player_two);
};
#endif // INPUT_HPP
+2 -2
View File
@@ -3,10 +3,10 @@
#include <array>
#include "globals.hpp"
// #include "elements.hpp"
#include "elements.hpp"
struct Window {
std::array<std::array<char, COL>, ROW> m_board = {};
void update_display();
void update_display(Tile (&tile_list)[9], Border (&border_list)[16]);
};
#endif