Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
76 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
1035588
Merge pull request #12 from Labpro-22/feat/tile-2
manuellthimoty Apr 22, 2026
0ef5860
feat : add enum class that represents any possible state for Tile Cla…
manuellthimoty Apr 22, 2026
4ea6442
Merge pull request #13 from Labpro-22/feat/tile-2
manuellthimoty Apr 22, 2026
ea04197
feat: getWealth implementation
Rizelbit Apr 22, 2026
540ac65
fix : adding states for ActionTile
manuellthimoty Apr 23, 2026
7d831a5
fix: changes to GameEngine integrate with other implementation
raulinns Apr 23, 2026
55f4bb3
Merge pull request #14 from Labpro-22/feat/tile-2
raulinns Apr 23, 2026
dcc3c77
fix: changes to player, tile, and auction for better handling in Game…
raulinns Apr 23, 2026
4167070
feat: main.cpp
arghaarham Apr 23, 2026
8d357c3
feat: getter setter for config, fix: executeTileAction
raulinns Apr 24, 2026
78a504b
feat: add GO Action Log
raulinns Apr 24, 2026
ec7a9b3
Merge pull request #15 from Labpro-22/main
miguelsinaga Apr 24, 2026
0ade50b
fix: delegate all game logic to GameEngine via effect enum
miguelsinaga Apr 24, 2026
3e0b14b
Merge pull request #16 from Labpro-22/feat/card
miguelsinaga Apr 24, 2026
a808bb2
Merge pull request #17 from Labpro-22/feat/card
miguelsinaga Apr 24, 2026
ead49c8
feat : implement sellBuilding()
manuellthimoty Apr 24, 2026
a4e4fa0
feat: add function for select all Tiles in one ColGroup
manuellthimoty Apr 24, 2026
c04048c
refactor: adjusting function to avoid dynamic casting
manuellthimoty Apr 24, 2026
eb6a436
feat : implement sellBuilding() (draft)
manuellthimoty Apr 24, 2026
8d5d556
feat: integrate card effect handling via SkillCardEffect and ActionCa…
miguelsinaga Apr 25, 2026
6806206
add
manuellthimoty Apr 25, 2026
e951193
Merge pull request #18 from Labpro-22/feat/gameEngine-1
manuellthimoty Apr 25, 2026
3ba6dae
huge refactor, solve undefined references for clases (linking process)
manuellthimoty Apr 25, 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.
2 changes: 2 additions & 0 deletions config/misc.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
MAX_TURN SALDO_AWAL
15 1000
29 changes: 29 additions & 0 deletions config/property.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
ID KODE NAMA JENIS WARNA HARGA_LAHAN NILAI_GADAI UPG_RUMAH UPG_HT RENT_L0 RENT_L1 RENT_L2 RENT_L3 RENT_L4 RENT_L5
2 GRT Garut STREET COKLAT 60 40 20 50 2 10 30 90 160 250
4 TSK Tasikmalaya STREET COKLAT 60 40 50 50 4 20 60 180 250 320
6 GBR Stasiun_Gambir RAILROAD DEFAULT 0 20
7 BGR Bogor STREET BIRU_MUDA 100 80 20 50 6 30 90 270 350 400
9 DPK Depok STREET BIRU_MUDA 100 80 20 50 6 30 90 270 350 400
10 BKS Bekasi STREET BIRU_MUDA 120 90 20 50 8 40 100 300 380 450
12 MGL Magelang STREET MERAH_MUDA 140 100 100 100 10 50 150 450 625 750
13 PLN PLN UTILITY ABU_ABU 0 25
14 SOL Solo STREET MERAH_MUDA 140 100 100 100 10 50 150 450 625 750
15 YOG Yogyakarta STREET MERAH_MUDA 160 120 100 100 12 60 180 500 700 900
16 STB Stasiun_Bandung RAILROAD DEFAULT 0 40
17 MAL Malang STREET ORANGE 180 135 100 100 14 70 200 550 750 950
19 SMG Semarang STREET ORANGE 180 140 100 100 14 70 200 550 750 950
20 SBY Surabaya STREET ORANGE 200 150 100 100 16 80 220 600 800 1000
22 MKS Makassar STREET MERAH 220 175 150 150 18 90 250 700 875 1050
24 BLP Balikpapan STREET MERAH 220 175 150 150 18 90 250 700 875 1050
25 MND Manado STREET MERAH 240 190 150 150 20 100 300 750 900 1100
26 TUG Stasiun_Tugu RAILROAD DEFAULT 0 50
27 PLB Palembang STREET KUNING 260 200 150 150 22 110 330 800 975 1150
28 PKB Pekanbaru STREET KUNING 260 210 150 150 22 110 330 800 975 1150
29 PAM PAM UTILITY ABU_ABU 0 60
30 MED Medan STREET KUNING 280 225 150 150 24 120 360 850 1000 1200
32 BDG Bandung STREET HIJAU 300 250 200 200 26 130 390 900 1100 1275
33 DEN Denpasar STREET HIJAU 300 260 200 200 26 130 390 900 1100 1275
35 MTR Mataram STREET HIJAU 320 280 200 200 28 150 450 1000 1200 1400
36 GUB Stasiun_Gubeng RAILROAD DEFAULT 0 120
38 JKT Jakarta STREET BIRU_TUA 350 300 200 200 35 175 500 1100 1300 1500
40 IKN Ibu_Kota_Nusantara STREET BIRU_TUA 400 350 200 200 50 200 600 1400 1700 2000
5 changes: 5 additions & 0 deletions config/railroad.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
JUMLAH_RAILROAD BIAYA_SEWA
1 25
2 50
3 100
4 200
2 changes: 2 additions & 0 deletions config/special.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
GO_SALARY JAIL_FINE
200 50
2 changes: 2 additions & 0 deletions config/tax.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
PPH_FLAT PPH_PERSENTASE PBM_FLAT
150 10 200
3 changes: 3 additions & 0 deletions config/utility.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
JUMLAH_UTILITY FAKTOR_PENGALI
1 4
2 10
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.
Binary file added doc/Spesifikasi Tugas Besar 1_ Nimonspoli.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
76 changes: 76 additions & 0 deletions include/core/ConfigLoader.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
#pragma once
#include <string>
#include <fstream>
#include <vector>
#include <map>
#include "../models/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;
int getGoSalary() const { return goSalary; }
int getJailFine() const { return jailFine; }
};
86 changes: 86 additions & 0 deletions include/core/Enums.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
#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, GO, UNKNOWN,GOTILE
};

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

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

enum class ActionCardEffect {
NONE,
CHANCE_NEAREST_STATION, CHANCE_MOVE_BACK_3, CHANCE_GO_TO_JAIL,
COMMUNITY_BIRTHDAY, COMMUNITY_DOCTOR, COMMUNITY_ELECTION
};
#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
72 changes: 72 additions & 0 deletions include/core/GameEngine.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
#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
CardDeck<ActionCard>* chanceDeck;
CardDeck<ActionCard>* communityDeck;

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


// Utilitas Internal
void checkWinCondition();
void nextTurn();
void handleBankruptcy(Player* bankruptPlayer, Player* creditor = nullptr);
void runAuction(PropertyTile* prop);
void handleActionCardEffect(Player& player, ActionCardEffect effect);
void initDecks();


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

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

void rollDice(int d1 = 0, int d2 = 0);
void executeTileAction();
void endTurn();

void buyBuilding(const std::string& propertyCode);
void sellBuilding(const std::string& colorGroup);
void mortgageProperty(const std::string& propertyCode);
void unmortgageProperty(const std::string& propertyCode);
void useSkillCard(int cardIdx);

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

bool hasDiceRolled() const { return diceRolled; }
bool isTurnEnded() const { return turnEnded; }
const std::vector<SkillCard*>& getSkillDeckCards() const;
};

#endif
Loading