fix: removed some random things

This commit is contained in:
DarthMooMancer
2025-09-08 12:09:32 -04:00
parent 2f5b6f102c
commit a1867f6701
5 changed files with 3 additions and 38 deletions
-2
View File
@@ -12,7 +12,6 @@ struct Point {
int m_id;
char m_symbol;
bool m_collided;
void to_string();
void assign(int row, int col);
void move();
void check_collision(std::vector<Point> &points_list);
@@ -23,7 +22,6 @@ struct Player {
char m_symbol;
bool m_turn;
void input_tile(int col, std::vector<Point> &points);
// bool check_chain(std::array<std::array<char, COL>, ROW> &m_board);
bool check_chain(std::array<std::array<char, COL>, ROW> &m_board, std::vector<Point> &points_list);
};
-1
View File
@@ -9,7 +9,6 @@
struct Window {
std::array<std::array<char, COL>, ROW> m_board = {};
void update_display(std::vector<Point> &points_list);
bool check_chain();
};
#endif
+2 -10
View File
@@ -2,7 +2,6 @@
#include "globals.hpp"
#include <array>
#include <vector>
#include <iostream>
void Point::assign(int row, int col) {
m_row = row;
@@ -10,15 +9,8 @@ void Point::assign(int row, int col) {
}
void Point::move() {
if(m_row < ROW - 1) {
m_row++;
} else {
m_collided = true;
}
}
void Point::to_string() {
std::cout << "(" << m_row << ", " << m_col << ")";
if(m_row < ROW - 1) m_row++;
else m_collided = true;
}
void Point::check_collision(std::vector<Point> &points_list) {;
+1 -2
View File
@@ -23,8 +23,7 @@ int main() {
if(one.check_chain(window.m_board, points_list)) {
std::cout << "Player 1 wins!" << std::endl;
running = false;
}
if(two.check_chain(window.m_board, points_list)) {
} else if(two.check_chain(window.m_board, points_list)) {
std::cout << "Player 2 wins!" << std::endl;
running = false;
}
-23
View File
@@ -3,7 +3,6 @@
#include <chrono>
#include <thread>
void Window::update_display(std::vector<Point> &points_list) {
for(std::array<char, COL> &row : m_board) { row.fill('.'); }
for(int i = 0; i < points_list.size(); i++) {
@@ -19,25 +18,3 @@ void Window::update_display(std::vector<Point> &points_list) {
}
std::this_thread::sleep_for(std::chrono::milliseconds(200)); // 1000 / fps; 200ms = 5fps
}
bool Window::check_chain() {
char symbol = ' ';
bool d = true;
bool result = false;
for(int i = 0; i < ROW - 1; i++) {
for(int j = 0; j < COL - 1; j++) {
if(m_board[i][j] == ' ') continue;
symbol = m_board[i][j];
d = true;
if(d) {
for(int k = 1; k <= 3; k++) {
if(m_board[i][j + k] != symbol) d = false;
}
if(d) {
result = true;
}
}
}
}
return result;
}