Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 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
b7590c1
feat: implement card.cpp, still waiting on ENDRA's game engine implem…
miguelsinaga Apr 21, 2026
031bfdd
refactor: rapih-rapih
miguelsinaga Apr 21, 2026
e563a72
refactor: rapih-rapih lagi
miguelsinaga Apr 21, 2026
e3e4dad
Merge pull request #9 from Labpro-22/feat/card
raulinns Apr 21, 2026
4cb1fdf
feat : ActionTile.cpp (draft)
manuellthimoty Apr 21, 2026
eb1ff83
feat: add more getter and setter
Rizelbit 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
18d673b
feat: config loader
Apr 21, 2026
28ddd20
Merge pull request #11 from Labpro-22/feat/board_config-1
raulinns Apr 21, 2026
1508853
Merge pull request #10 from Labpro-22/feat/tile-1
raulinns Apr 21, 2026
65bc344
feat: PNG assets
arghaarham Apr 21, 2026
b22ebcb
Merge branch 'main' of https://github.com/Labpro-22/tugas-besar-1-pop
arghaarham Apr 21, 2026
14f47a1
feat: Formatter
arghaarham Apr 21, 2026
9b8edfc
feat: add auction and gameengine
raulinns Apr 21, 2026
371bf65
refactor: formatter
arghaarham Apr 22, 2026
513b85a
refactor: GUI
arghaarham Apr 22, 2026
b325832
fix: implement available card actions and add board dependencies
miguelsinaga Apr 22, 2026
62a44bf
fix : addinvg const keywoard for getter
manuellthimoty Apr 22, 2026
da80d28
fix : adding calculate value function for PropertyTile
manuellthimoty Apr 22, 2026
0ef5860
feat : add enum class that represents any possible state for Tile Cla…
manuellthimoty Apr 22, 2026
540ac65
fix : adding states for ActionTile
manuellthimoty Apr 23, 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/AkhiriGiliran.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/Bangun.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/Beli.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/CetakAkta.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/CetakPapan.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/CetakProperti.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/Dice1.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/Dice2.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/Dice3.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/Dice4.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/Dice5.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/Dice6.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/Gadai.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/LemparDadu.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/Pion.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/Tebus.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 doc/IF2010_TB1-M1_POP.pdf
Binary file not shown.
Binary file added doc/IF2010_TB1-M1__POP.docx.pdf
Binary file not shown.
Binary file added doc/IF2010_TB1-M1__POP.pdf
Binary file not shown.
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
74 changes: 74 additions & 0 deletions include/core/ConfigLoader.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
#pragma once
#include <string>
#include <fstream>
#include <vector>
#include <map>
#include "Tile.hpp"
using namespace std;

class ConfigLoader {
private:
static ConfigLoader* instance;
ConfigLoader();

ifstream currentFile;
string currentLine;
int currentParsedIndex;
string configFilePath;
bool isConfigValid;

map<int, int> railroadRentMap;
map<int, int> utilityMultiplierMap;
int taxPPHFlat;
double taxPPHPercent;
int taxPBMFlat;
int goSalary;
int jailFine;

int maxTurn;
int initialMoney;

class TileDefinition {
public:
int index;
string kode;
string nama;
string tipeStr;

TileDefinition(int index, const string& kode,
const string& nama, const string& tipeStr);

int getIndex() const;
string getKode() const;
string getNama() const;
string getTipeStr() const;
};
vector<TileDefinition> layoutDefinitions;

void readRailroadConfig();
void readUtilityConfig();
void readTaxConfig();
void readSpecialConfig();
void readMiscConfig();

void buildLayoutFromHardcode();
void buildLayoutFromFile();

Tile* instantiateTile(const TileDefinition& def);
void linkSpecialTiles();

public:
static ConfigLoader* getInstance();
~ConfigLoader();

void loadAllConfigs();
void parsePropertyConfig();
void parseActionTileConfig();
void validateBoardLayout();
void setConfigFilePath(const string& path);
bool getIsConfigValid() const;

// Getter untuk GameEngine setelah loadAllConfigs() selesai
int getMaxTurn() const;
int getInitialMoney() const;
};
78 changes: 78 additions & 0 deletions include/core/Enums.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
#ifndef ENUMS_HPP
#define ENUMS_HPP

#include <string>


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
};

std::string actionTypeToString(LogActionType type);
LogActionType stringToActionType(const std::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
61 changes: 61 additions & 0 deletions include/core/GameEngine.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#ifndef GAME_ENGINE_HPP
#define GAME_ENGINE_HPP

#include <vector>
#include <string>
#include <random>

// Forward Declarations - Hindari include di header untuk mencegah circular dependency
class Player;
class Board;
class SaveLoadManager;
class TransactionLogger;
class Auction;
class SkillCard;
template <typename T> class CardDeck;

class GameEngine {
private:
// State Game
std::vector<Player*> players;
Board* board;
SaveLoadManager* saveLoadManager;
TransactionLogger* logger;
CardDeck<SkillCard>* skillDeck; // Sesuaikan dengan tipe dari Miguel

int currentTurnIdx; // Indeks pemain aktif (0-3)
int roundCount; // Jumlah putaran yang sudah berjalan
bool diceRolled;
bool turnEnded;

// Utilitas Internal
void checkWinCondition();
void nextTurn();

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

// Kontrol Alur Permainan
void startNewGame(const std::vector<std::string>& playerNames);
void loadGame(const std::string& filePath);
void saveGame(const std::string& filePath);

// Logika Turn
void rollDice(int d1 = 0, int d2 = 0); // Support ATUR_DADU (overload)
void executeTileAction();
void endTurn();

// Getters untuk Integrasi (Dibutuhkan SaveLoadManager & Auction)
Player* getCurrentPlayer() const;
std::vector<Player*> getAllPlayers() const { return players; }
Board* getBoard() const { return board; }
int getCurrentRound() const { return roundCount; }
int getCurrentTurnIdx() const { return currentTurnIdx; }

// Flags
bool hasDiceRolled() const { return diceRolled; }
bool isTurnEnded() const { return turnEnded; }
};

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

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

using namespace std;

class PropertyTile;
class SkillCard;

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

int activeDiscount;
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;
int getJailTurnsLeft() const;
int getDoubleStreak() const;
bool getHasUsedCardThisTurn() const;
bool isShieldActive() const;
int getActiveDiscountPercent() const;

void setHasUsedCardThisTurn(bool used);
void setActiveDiscountPercent(int percent);

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
Loading