Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
aeaa076
feat: header file
Apr 11, 2026
0be6396
feat: enums, save/load, and formatter headers
arghaarham Apr 12, 2026
ed0aa5b
feat: config loader, board
Apr 12, 2026
9d0de7d
Merge pull request #1 from Labpro-22/feat/board_config-1
bangedaw Apr 12, 2026
3b83dfd
feat: game engine header
raulinns Apr 12, 2026
434d544
feat: card
miguelsinaga Apr 12, 2026
981c079
feat : implement tile.hpp
manuellthimoty Apr 12, 2026
1c1a45d
feat: implement PropertyTile.hpp
manuellthimoty Apr 12, 2026
438cdaf
feat : implement ActionTile.hpp
manuellthimoty Apr 12, 2026
333883d
Merge pull request #2 from Labpro-22/feat/tile-1
manuellthimoty Apr 12, 2026
5e82267
feat: update player.hpp and add transactionLogger header
Rizelbit Apr 12, 2026
582e2a3
Merge pull request #3 from Labpro-22/feat/player
raulinns Apr 12, 2026
4d4b002
fix: header
raulinns Apr 12, 2026
d058a0d
feat: auction, formatting file
raulinns Apr 12, 2026
6c60d4b
Merge pull request #4 from Labpro-22/feat/card
miguelsinaga Apr 12, 2026
3740433
fix : setting parent of SpecialTile to ActionTile instead of Tile
manuellthimoty Apr 12, 2026
5735d6b
feat: add several atribute and method to class board and configloader…
Apr 12, 2026
f279cf3
feat: TransactionLogger implementation with LogActionType
Rizelbit Apr 18, 2026
4c271e0
feat : implement Tile.cpp
manuellthimoty Apr 20, 2026
e11d257
feat : implemen ProptyTile.cpp (draft)
manuellthimoty Apr 20, 2026
e0d818a
feat: implement card template
miguelsinaga Apr 21, 2026
02bd9f7
feat: GameWindow, SaveLoadManager and driver for testing
arghaarham Apr 21, 2026
4a558b0
feat: add Board.cpp implementation and update Board.hpp, Tile.hpp
Apr 21, 2026
a58036c
refactor: GUI
arghaarham Apr 21, 2026
b35d1b8
refactor: include path
Apr 21, 2026
f3afd4d
Merge branch 'main' into feat/GUI
arghaarham Apr 21, 2026
b24bb0b
Merge pull request #5 from Labpro-22/feat/GUI
arghaarham Apr 21, 2026
574fc77
feat: Player implementation -getWealth()
Rizelbit Apr 21, 2026
9c3c889
Merge branch 'main' into feat/board_config-1
arghaarham Apr 21, 2026
d9203ab
Merge pull request #6 from Labpro-22/feat/board_config-1
arghaarham Apr 21, 2026
a46b496
Merge pull request #7 from Labpro-22/feat/card
arghaarham Apr 21, 2026
f0547e9
Merge pull request #8 from Labpro-22/feat/tile-1
arghaarham Apr 21, 2026
4cb1fdf
feat : ActionTile.cpp (draft)
manuellthimoty Apr 21, 2026
f80e09b
feat :add PropertyTile.cpp (draft)
manuellthimoty Apr 21, 2026
794cfad
refactor: ActionTile.hpp
manuellthimoty Apr 21, 2026
caf1121
refactor : PropertyTile.hpp
manuellthimoty Apr 21, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,9 @@ bin/

# debug information files
*.dwo


/html
/latex

*Doxyfile
Binary file added assets/card_cc_back.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/card_cc_front.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/card_chance_back.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/card_chance_front.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/deed_mortgage.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/deed_property.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/deed_station.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/deed_utility.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/prop_brown.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/prop_darkblue.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/prop_green.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/prop_lightblue.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/prop_orange.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/prop_pink.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/prop_red.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/prop_yellow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/tile_alcohol.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/tile_chance.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/tile_community_chest.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/tile_electric.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/tile_figma.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/tile_free_parking.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/tile_go.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/tile_go_to_jail.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/tile_income_tax.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/tile_irnbru.png
Binary file added assets/tile_jail.png
Binary file added assets/tile_luxury_tax.png
Binary file added assets/tile_servers.png
Binary file added assets/tile_station.png
Binary file added assets/tile_waterworks.png
33 changes: 33 additions & 0 deletions include/core/Auction.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#ifndef AUCTION_HPP
#define AUCTION_HPP

#include "../models/PropertyTile.hpp"
#include "Player.hpp"
#include <vector>

class Auction {
private:
PropertyTile *targetProperty;
std::vector<Player *> activeBidders;
int currentHighestBid;
Player *currentHighestBidder;
int currentBidderIndex;

public:
Auction(PropertyTile *property,
const std::vector<Player *> &initialBidders);

// Run utama
void run();

// Method memasang bid untuk player pada gilirannya
bool placeBid(Player *bidder, int amount);

// Method pass untuk player pada gilirannya
void passTurn(Player *bidder);

// Menentukan pemenang bid dan merubah kepemilikan properti
void delegateProperty();
};

#endif
24 changes: 24 additions & 0 deletions include/core/ConfigLoader.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#pragma once
#include <string>
#include <fstream>
using namespace std;

class ConfigLoader {
private:
static ConfigLoader* instance;
ifstream currentFile;
string currentLine;
int currentParsedIndex;
std::string configFilePath;
bool isConfigValid;
ConfigLoader();
public:
static ConfigLoader* getInstance();
~ConfigLoader();
void loadAllConfigs();
void parsePropertyConfig();
void parseActionTileConfig();
void validateBoardLayout();
void setConfigFilePath(const std::string& path);
bool getIsConfigValid() const;
};
79 changes: 79 additions & 0 deletions include/core/Enums.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
#ifndef ENUMS_HPP
#define ENUMS_HPP

#include <string>

using namespace std;

const int maxPlayer = 4;

// INI BUAT VARIABELS/ATRIBUT YG SCOPENYA UDAH TAU DAN BIAR BEST PRACTICE. JANGAN DI DEFINE DI HPP MASING2! (pake ini ya enumz)
enum class PlayerStatus{
ACTIVE,
JAILED,
BANKRUPT
};

enum class PropertyStatus{
BANK,
OWNED,
MORTGAGED
};

enum class CardTileType{
CHANCE,
COMMUNITY_CHEST
};

enum class TaxType{
PPH,
PBM
};

enum class SpecialTileType{
GO,
JAIL,
FREE_PARKING,
GO_TO_JAIL
};

enum class ChanceCardType{
NEAREST_STATION,
MOVE_BACK_3,
GO_TO_JAIL
};

enum class CommunityChestCardType{
BIRTHDAY,
DOCTOR,
ELECTION
};

enum class SkillCardType{
MOVE,
DISCOUNT,
SHIELD,
TELEPORT,
LASSO,
DEMOLITION
};

enum class GameErrorCode {
NOT_ENOUGH_MONEY = 1,
MAX_CARD_LIMIT = 2,
INVALID_COMMAND = 3,
INVALID_PROPERTY = 4,
GAME_STATE_ERROR = 5
};

enum class LogActionType { // Plis ini beda sama type" yang di class lain yak, ini khusus event yang sedang terjadi aja bukan semacam state suatu objek
ROLL, BUY, RENT, TAX, BUILD, SELL, MORTGAGE,
UNMORTGAGE, CARD, RAILROAD, UTILITY, AUCTION,
FESTIVAL, BANKRUPT, SAVE, LOAD, DOUBLE_ROLL, UNKNOWN
};

string actionTypeToString(LogActionType type);
LogActionType stringToActionType(const string& str);


#endif
54 changes: 54 additions & 0 deletions include/core/Exceptions.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#ifndef EXCEPTIONS_HPP
#define EXCEPTIONS_HPP

#include <exception>
#include <string>
#include "Enums.hpp"

class GameException : public std::exception{
private:
GameErrorCode errorCode;
std::string errorMessage;

public:
GameException(GameErrorCode errorCode, const std::string& errorMessage) : errorCode(errorCode), errorMessage(errorMessage){}

GameErrorCode getErrorCode() const{
return errorCode;
}

std::string getErrorMessage() const{
return errorMessage;
}

const char* what() const noexcept override{
return errorMessage.c_str();
}
};

class NotEnoughMoneyException : public GameException{
public:
NotEnoughMoneyException(int have, int need, const std::string& context) : GameException( GameErrorCode::NOT_ENOUGH_MONEY, "Uang tidak cukup untuk: " + context + ". Punya: " + std::to_string(have) + ", Butuh: " + std::to_string(need)){}
};

class MaxCardLimitException : public GameException{
public:
MaxCardLimitException() : GameException(GameErrorCode::MAX_CARD_LIMIT, "Slot untuk kartu sudah limit! Maksimal 3"){}
};

class InvalidCommandException : public GameException{
public:
InvalidCommandException(const std::string command) : GameException(GameErrorCode::INVALID_COMMAND, "Command " + command + " tidak dikenali!"){}
};

class InvalidPropertyException : public GameException{
public:
InvalidPropertyException(const std::string kode) : GameException(GameErrorCode::INVALID_PROPERTY, "Kode petak " + kode + " tidak dikenali!"){}
};

class GameStateException : public GameException{
public:
GameStateException(const std::string& context) : GameException(GameErrorCode::GAME_STATE_ERROR, "Tidak diperbolehkan melakukan " + context + " sekarang"){}
};

#endif
78 changes: 78 additions & 0 deletions include/core/GameEngine.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
#ifndef GAME_ENGINE_HPP
#define GAME_ENGINE_HPP

#include "../models/Card.hpp"
#include "Enums.hpp"
#include <map>
#include <string>
#include <vector>

class Player;
class Board;
class TransactionLogger;
class PropertyTile;

class GameEngine {
private:
Board *board;
TransactionLogger *logger;
std::vector<Player *> player;

// NOTE: TUNGGU IMPLEMENTASI MIGUEL, MASIH RANCU BANGET MAU DIBAWA KEMANA
// CardDeck<SkillCard> *skillDeck; // Kartu Kemampuan Spesial
// CardDeck<SkillCard> *chanceDeck; // Kartu Kesempatan
// CardDeck<SkillCard> *communityChestDeck; // Kartu Dana Umum

// Jumlah ronde yang sudah dilalui, harus < MAX_TURN (dari file konfigurasi)
int roundCount;

// Indeks ke vektor player, menandakan giliran pemain mana
int currentTurn;

// Jumlah petak yang dilewati = dice1 + dice2
// Streak jika dice1 == dice2
int dice1;
int dice2;

// Bernilai 0 setiap awal giliran, setiap dice1 == dice2, doubleStreak++
int doubleStreak;

public:
GameEngine(Board *board, TransactionLogger *logger);
~GameEngine();

// Permainan baru. Input jumlah pemain, nama pemain. Acak giliran.
// SYARAT: config sudah diload oleh config loader.
void startNewGame();

// Permainan berdasarkan saved game sebelumnya.
// SYARAT: sudah diload oleh config loader.
void startLoadedGame();

// Proses pengocokan dadu hingga doubleStreak = 3, atau dice1 != dice2
void rollDice();

// proses korupsi dadu (ATUR MANUAL HEHE), exception kalau d1, d2 > 6, d1,
// d2 < 0
void rollDice(int d1, int d2);

// Total nilai dadu terakhir
int getDiceTotal() const;

// True jika dice1 == dice2
bool isDouble() const;

// NOTE: PANGGIL FUNGSI FESTIVAL, belum tau implementasinya
// Urutan: Festival, Bagi kartu spesial, reset giliran
void executeTurn();

// Pindahkan currentTurn ke pemain ACTIVE selanjutnya, BANKRUPT gak dihitung
// Tambahkan roundCount, setelah currentTurn, kembali ke indeks 1
void advanceTurn();

// Cek apakah kondisi saat ini sudah ada yang memenangkan pertandingan,
// dipanggil di setiap akhir giliran.
void checkWinCondition();
};

#endif
63 changes: 63 additions & 0 deletions include/core/Player.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#ifndef PLAYER_HPP
#define PLAYER_HPP

#include <string>
#include <vector>
#include "../models/Card.hpp"

using namespace std;

class PropertyTile;
class SkillCard;

enum class PlayerStatus {
ACTIVE,
JAILED,
BANKRUPT
};

class Player {
private:
string username;
int money;
int position;
PlayerStatus status;
vector<PropertyTile*> ownedProperties;
vector<SkillCard*> handCards;

int jailTurnsLeft;
int doubleStreak;
bool hasUsedCardThisTurn;
bool shieldActive;
public:
Player(string username, int startingMoney);

void move(int steps);
void goToJail();
void declareBankruptcy();
void resetTurnFlags();

int getWealth() const;
string getUsername() const;
int getMoney() const;
int getPosition() const;
PlayerStatus getStatus() const;
const vector<SkillCard*>& getHandCards() const;
const vector<PropertyTile*>& getOwnedProperties() const;

void addCard(SkillCard* card);
void removeCard(int index);
void addProperty(PropertyTile* property);
void removeProperty(PropertyTile* property);

void setShieldActive(bool active);
void incrementDoubleStreak();
void decrementJailTurn();

// Operator Overloading
Player& operator+=(int amount);
Player& operator-=(int amount);
bool operator<(const Player& other) const;
};

#endif
29 changes: 29 additions & 0 deletions include/core/SaveLoadManager.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#ifndef SAVE_LOAD_MANAGER_HPP
#define SAVE_LOAD_MANAGER_HPP

#include <string>
#include <fstream>

#include "GameEngine.hpp"

class SaveLoadManager
{
private:
static void savePlayers(std::ofstream& file, const GameEngine& engine);
static void saveProperties(std::ofstream& file, const GameEngine& engine);
static void saveDeck(std::ofstream& file, const GameEngine& engine);
static void saveLogs(std::ofstream& file, const GameEngine& engine);

static void loadPlayers(std::ifstream& file, GameEngine& engine);
static void loadProperties(std::ifstream& file, GameEngine& engine);
static void loadDeck(std::ifstream& file, GameEngine& engine);
static void loadLogs(std::ifstream& file, GameEngine& engine);
public:
static bool saveGame(const std::string& fileName, const GameEngine& engine);
static bool loadGame(const std::string& fileName, GameEngine& engine);
static bool existFile(const std::string& fileName);

};


#endif
Loading