README.MD written by Loc Su
Three program Bank, Agent, AuctionHouse, that can interact with each other through Socket connection and complete different tasks.
-
The Bank (Bank.jar) can be considered the middle ground where it only plays as a server that connect the Agents to the AuctionHouses.
-
The AuctionHouse (AuctionHouse.jar) is play as both a Server and a Client. It is a Client to the Bank, but it is also a Server to the Client. The AuctionHouse job is reading in the Agents' request and communicate it with the Bank and to complete different tasks.
-
The Agent (Agent.jar) is the one that will mostly initiate all the action such as making bids, set bank balance, etc
-
The AutoBidder (AutoBidder.jar) is the same as the Agent which it does not require a human to make a bid but it will continuously place a bid after a set amount of time.
Four bidding status:
ACCEPTED
REJECTED
OUTBID
WINNER
ACCEPTED
status is set when a bid is being requested, and it meets all the requirements.
REJECTED
status is set when a bid is being requested, and it does not meet all the requirements.
OUTBID
status is set when you are the current bid winner, and another agent makes a better the bid than you, your bid will be OUTBID-ED.
WINNER
status is set when after the 30 seconds interval has passed, and no other Agents contest your bid, you will win the bidding process.
No GUI
The program can run on the same computer or through multiple computer through jar file.
For one computer through IntelliJ
Steps
- Run the Bank.jar by left click on file -> Run jar. It will give you the host name. Copy it.
- Run the AuctionHouse.jar by left click on file -> Run jar. It will ask you the host name which you will put the host name provided when running the Bank.jar. You can run as much AuctionHouse instances as you want.Then input the wanted name, i.e ah1, ah2, ...
- Run the Agent.jar by left click on file -> Run jar. It will ask you the host name which you will put the host name provided when running the Bank.jar. You can run as much Agent instances as you want. Then input the wanted name, i.e user1, user2, ...
- After running the Agent, you will be ask to input in the Bank Balance which will be your total money you can spend on the bidding.
- A menu will pop with different set of options.
- Using the index of the option to choose the option. 1, 2 or 3.
- When viewing the available AuctionHouses, you can choose a specific AuctionHouse base on the name of it applying step 6.
- Choose a specific AuctionHouse, then apply step 6 to make bid with the following format bid "ItemIndex bidAmount". For example: In the bottom, "1" is the "ItemIndex" for the first item and "4" is the "bidAmount".
- Make sure your bid to an item has to be larger than the CurrentBid + MinimumBid to be
ACCEPTED
.
For multiple computers through terminal Steps
- After create the three java files, Bank.jar, AuctionHouse.jar and Agent.jar, for the UNM CS machine, we need to copy and paste
it to the
BIN
location of our JDK/ZULU file. This has to be applied for all computers that are in used to run this project. - In the
BIN
location, where we put our Jar files, open terminal in that location for each computer. - Assuming we are only using 3 computers, one computer will be in charged of the Bank.jar, one for AuctionHouse.jar, one for Agent.jar.
- Run the Bank.jar by typing
./java -jar Bank.jar
in the terminal. It will show you the host name and the port number it is using. - Run the AuctionHouse.jar by typing
./java -jar AuctionHouse.jar
in the terminal. It will ask you the host name which you will put the host name provided when running the Bank.jar. You can run as much AuctionHouse instances as you want.Then input the wanted name, i.e ah1, ah2, ...Typeexit
to safely disconnect. - Run the Agent.jar by typing
./java -jar Agent.jar
in the terminal. It will ask you the host name which you will put the host name provided when running the Bank.jar. You can run as much Agent instances as you want. Then input the wanted name, i.e user1, user2, ... - After running the Agent, you will be asked to input in the Bank Balance which will be your total money you can spend on the bidding.
- A menu will pop with different set of options.
- Using the index of the option to choose the option. 1, 2 or 3.
- When viewing the available AuctionHouses, you can choose a specific AuctionHouse base on the name of it applying step 6.
- Choose a specific AuctionHouse, then apply step 6 to make bid with the following format bid "ItemIndex bidAmount". For example: In the bottom, "1" is the "ItemIndex" for the first item and "4" is the "bidAmount".
- Make sure your bid to an item has to be larger than the MinimumBid to be
ACCEPTED
.
For the AutoBidder:
- After create the three java files, Bank.jar, AuctionHouse.jar and Agent.jar, for the UNM CS machine, we need to copy and paste
it to the
BIN
location of our JDK/ZULU file. This has to be applied for all computers that are in used to run this project. - In the
BIN
location, where we put our Jar files, open terminal in that location for each computer. - Assuming we are only using 3 computers, one computer will be in charged of the Bank.jar, one for AuctionHouse.jar, one for Agent.jar.
- Run the Bank.jar by typing
./java -jar Bank.jar
in the terminal. It will show you the host name and the port number it is using. - Run the AuctionHouse.jar by typing
./java -jar AuctionHouse.jar
in the terminal. It will ask you the host name which you will put the host name provided when running the Bank.jar. You can run as much AuctionHouse instances as you want.Then input the wanted name, i.e ah1, ah2, ... Typeexit
to safely disconnect. - Run the AutoBidder.jar, by typing
./java -jar AutoBidder.jar
in the terminal. Input in the host name and the port name displaying by the Bank.jar in order to initiate connection. - It will ask you the set of time you want it to place new bid.
- Type
start
to start the bid cycle - Type
pause
to pause the bid cycle - Type
exit
to safely disconnect it.
Vasileios Grigorios Kourakos
responsible for most of the work.
Initially responsible for the interaction from the AuctionHouse to the Bank and vice versa. Everything Bank related
such as BankProxy, BankAccount.
He is also responsible for creating the Agent's menu, part of the bidding logic and the
Bank balance checking when a bid is placed.
Vasileios Grigorios Kourakos is also responsible for the AutoBidder since he came up with
the idea to have two different proxy for the Agent, one for the Bank and one for the
AuctionHouse. Same concept for with the AutoBidder.
He also did the IP connection for multiple computers.
He helped improving the communication between different party.
He and Fermin worked on the bid timer.
Fermin Ramos
put in the second most work.
He creates the foundation of the connection between Bank, the AuctionHouse, and the Agent, make it able to communicate to each other.
He is responsible for the display of multiple available AuctionHouse in order
to help the Agent connect to all of it.
He also put a lot of work in resolving different bugs such as the menu bug,
the item update bug, etc.
He and Vasileios worked on the bid timer.
He also helped Vasileios a ton in the bidding function.
He helped to display connection notification in the Bank whenever a new Agent connect to the bank.
Loc Su
put in the least work.
Since personally, I was struggling with this project, I tried to do everything else.
Not as much coding as I wanted.
I helped Fermin with establishing connection between the Agent and AuctionHouse,
especially with multiple AuctionHouse.
I fix the itemID bugs, some Item class feature. I helped with other debugging process too......
I wrote README and the project diagram and the code comment