Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
0948c7f
commit
BebeCosgrove Nov 26, 2024
8ba67e2
First iteration of BingoCard class with some modifications to Person
vscott14 Dec 2, 2024
9c4b3a5
person adjustments and adding object class
BebeCosgrove Dec 2, 2024
3ee6720
modifying person class and adding object class
BebeCosgrove Dec 2, 2024
9cd3ff4
making person uppercase
BebeCosgrove Dec 2, 2024
a823b5b
Addition of a Task class and finalization of
vscott14 Dec 3, 2024
80933cc
Added javadoc comments
vscott14 Dec 3, 2024
1f244a6
map
kwang64 Dec 3, 2024
52a26af
changes
BebeCosgrove Dec 3, 2024
65a0231
change
kwang64 Dec 3, 2024
51dde91
Merge branch 'main' of https://github.com/BebeCosgrove/CSC120-FinalPr…
BebeCosgrove Dec 3, 2024
adfb16d
json settings
BebeCosgrove Dec 3, 2024
782749f
Merge branch 'main' of https://github.com/BebeCosgrove/CSC120-FinalPr…
BebeCosgrove Dec 3, 2024
2d98e4e
node changes
BebeCosgrove Dec 5, 2024
d433756
complete the map
kwang64 Dec 6, 2024
d67d0de
adding direction information to the edges
kwang64 Dec 6, 2024
b57b5a6
Added the directions of restaurant/cafe, and Stores
kwang64 Dec 6, 2024
2e5a0b8
adding city hall and smith college area directions
BebeCosgrove Dec 7, 2024
a03ad91
..
kwang64 Dec 7, 2024
b29406b
Anna's files for Building and subclasses.
vscott14 Dec 8, 2024
1c10ec9
Beginning of chatbot class!
vscott14 Dec 8, 2024
f1a32af
Merging branches and trying to get rid of duplicated files
vscott14 Dec 8, 2024
5d2fb0a
chatbot
vscott14 Dec 8, 2024
3597432
Merge branch 'main' of https://github.com/BebeCosgrove/CSC120-FinalPr…
vscott14 Dec 8, 2024
47adf1c
..
kwang64 Dec 10, 2024
47cdb32
map game adding methods
BebeCosgrove Dec 10, 2024
21f1603
Merge branch 'main' of https://github.com/BebeCosgrove/CSC120-FinalPr…
BebeCosgrove Dec 10, 2024
573f74d
Merge branch 'main' of https://github.com/BebeCosgrove/CSC120-FinalPr…
kwang64 Dec 10, 2024
122d2ee
Merge branch 'main' of https://github.com/BebeCosgrove/CSC120-FinalPr…
kwang64 Dec 10, 2024
981763f
updated architecture diagram
kwang64 Dec 10, 2024
4d29e2e
completed GAME
BebeCosgrove Dec 10, 2024
8c26545
Merge branch 'main' of https://github.com/BebeCosgrove/CSC120-FinalPr…
BebeCosgrove Dec 10, 2024
2287f95
Architecture
BebeCosgrove Dec 10, 2024
b35d8a6
solving merge comments
BebeCosgrove Dec 10, 2024
7723578
Add files via upload
kwang64 Dec 14, 2024
ecda56d
Add files via upload
kwang64 Dec 14, 2024
40ce3d6
Update README.md
kwang64 Dec 14, 2024
3c024b6
Update README.md
kwang64 Dec 14, 2024
57638a2
mostly final changes
BebeCosgrove Dec 14, 2024
443bbb7
Merge branch 'main' of https://github.com/BebeCosgrove/CSC120-FinalPr…
BebeCosgrove Dec 14, 2024
286a499
Update rubric.md
kwang64 Dec 14, 2024
774684e
final changes
BebeCosgrove Dec 14, 2024
0acbd01
Merge branch 'main' of https://github.com/BebeCosgrove/CSC120-FinalPr…
BebeCosgrove Dec 14, 2024
c473a68
cheatsheet
BebeCosgrove Dec 14, 2024
c4f9f22
cheatsheet changes
BebeCosgrove Dec 14, 2024
6e5370c
adding java docs for some classes
BebeCosgrove Dec 14, 2024
c2838e0
Update README.md
BebeCosgrove Dec 14, 2024
52b93a4
design justification
BebeCosgrove Dec 14, 2024
fba3cd0
design justification changes
BebeCosgrove Dec 14, 2024
3b97884
Building java doc comments
BebeCosgrove Dec 15, 2024
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
Binary file added .DS_Store
Binary file not shown.
6 changes: 6 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"java.project.referencedLibraries": [
"lib/**/*.jar",
"guava-31.1-jre.jar"
]
}
130 changes: 130 additions & 0 deletions BingoCard.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
import java.util.ArrayList;
import java.util.Collections;
/**
* BingoCard class creates a random bingo card for a user
*/
public class BingoCard {
ArrayList < Task > tasks;
private Person owner;
private boolean bingo;
private MapGame map;
Task task1 = new Task("Borrow 'Macbeth' from Forbes Library");
Task task2 = new Task("Buy Uggs at Synergy ");
Task task3 = new Task("Buy a coffee at Woodstar ");
Task task4 = new Task("Buy a top at Urban Outfitters ");
Task task5 = new Task("Buy a loaf of bread at Hungry Ghost ");
Task task6 = new Task("Find a ticket at Academy of Music ");
Task task7 = new Task("Get a plant from Botanic Garden ");
Task task8 = new Task("Get a postcard from the SCAM ");
Task task9 = new Task("Buy Dumplings from T.ROOTS ");

/**
* Constructor for BingoCard class
* @param owner Person, the owner of the bingo card
*/
public BingoCard(Person owner) {
this.owner = owner;
tasks = new ArrayList < > ();
map = new MapGame();
//format the tasks so that the strings are all the same length
//add tasks to arraylist
tasks.add(task1);
tasks.add(task2);
tasks.add(task3);
tasks.add(task4);
tasks.add(task5);
tasks.add(task6);
tasks.add(task7);
tasks.add(task8);
tasks.add(task9);
//shuffle the arraylist of tasks
Collections.shuffle(tasks);
bingo = false;

}
/**
* Setter for bingo boolean (sets true)
*/
public void setBingoTrue() {
this.bingo = true;
}
/**
* Prints the bingo card in a 3x3 grid with a check or an x next to each task description indicating the completion status
*/
public void printBingoCard() {
System.out.println(" -----------BINGO CARD-----------");
System.out.println(tasks.get(0).getDescription() + " " + tasks.get(0).printStatus() + " | " + tasks.get(1).getDescription() + " " + tasks.get(1).printStatus() + " | " + tasks.get(2).getDescription() + " " + tasks.get(2).printStatus());
System.out.println(tasks.get(3).getDescription() + " " + tasks.get(3).printStatus() + " | " + tasks.get(4).getDescription() + " " + tasks.get(4).printStatus() + " | " + tasks.get(5).getDescription() + " " + tasks.get(5).printStatus());
System.out.println(tasks.get(6).getDescription() + " " + tasks.get(6).printStatus() + " | " + tasks.get(7).getDescription() + " " + tasks.get(7).printStatus() + " | " + tasks.get(8).getDescription() + " " + tasks.get(8).printStatus());
}

/**
* Prints the descriptions of each task in the arraylist of tasks
*/
public void printTasks() {
for (int i = 0; i < 9; i++) {
System.out.println(tasks.get(i).getDescription());
}
}
/**
* Checks if the person has scored a bingo based on whether or not they have completed tasks that make three in a row for their bingo card
* @return boolean bingo, true if the owner of the card has scored a bingo and false if not
*/
public boolean checkBingo() {
if (tasks.get(0).getCompletionStatus() == true && tasks.get(1).getCompletionStatus() == true && tasks.get(2).getCompletionStatus() == true) {
this.bingo = true;
System.out.println("Checking first row... " + this.bingo);
//second row
} else if (tasks.get(3).getCompletionStatus() == true && tasks.get(4).getCompletionStatus() == true && tasks.get(5).getCompletionStatus() == true) {
this.bingo = true;
System.out.println("Checking second row... " + this.bingo);
//third row
} else if (tasks.get(6).getCompletionStatus() == true && tasks.get(7).getCompletionStatus() == true && tasks.get(8).getCompletionStatus() == true) {
this.bingo = true;
System.out.println("Checking third row... " + this.bingo);
//first column
} else if (tasks.get(0).getCompletionStatus() == true && tasks.get(3).getCompletionStatus() == true && tasks.get(6).getCompletionStatus() == true) {
this.bingo = true;
System.out.println("Checking first column... " + this.bingo);
//second column
} else if (tasks.get(1).getCompletionStatus() == true && tasks.get(4).getCompletionStatus() == true && tasks.get(7).getCompletionStatus() == true) {
this.bingo = true;
System.out.println("Checking second column... " + this.bingo);
//third column
} else if (tasks.get(2).getCompletionStatus() == true && tasks.get(5).getCompletionStatus() == true && tasks.get(8).getCompletionStatus() == true) {
this.bingo = true;
System.out.println("Checking third column... " + this.bingo);
//diagonal from left to right
} else if (tasks.get(0).getCompletionStatus() == true && tasks.get(4).getCompletionStatus() == true && tasks.get(8).getCompletionStatus() == true) {
this.bingo = true;
System.out.println("Checking first diagonal... " + this.bingo);
//diagonal from right to left
} else if (tasks.get(2).getCompletionStatus() == true && tasks.get(4).getCompletionStatus() == true && tasks.get(6).getCompletionStatus() == true) {
this.bingo = true;
System.out.println("Checking second diagonal... " + this.bingo);
//else no bingo
}
if (this.bingo) {
System.out.println("BINGO! You win!");
//end game
}
return this.bingo;
}

/*
* Main method
*/
public static void main(String args[]) {
Person victoria = new Person(20);
BingoCard myCard = new BingoCard(victoria);
myCard.task1.setCompletedTrue();
myCard.task2.setCompletedTrue();
myCard.task3.setCompletedTrue();
myCard.task4.setCompletedTrue();
myCard.task5.setCompletedTrue();
myCard.printTasks();
myCard.printBingoCard();
System.out.println(myCard.checkBingo());
}

}
175 changes: 175 additions & 0 deletions Building.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
/**
* Building class
*/
public class Building {
/* Attributes */
protected String name;
protected String address;
protected int nFloors;
protected int activeFloor = -1; // Default value indicating we are not inside this building
protected boolean elevator;
protected Object object;

/**
* Overloaded constructor for map game class
* @param name name of building
* @param address address of building
*/
public Building(String name, String address) {
this.name = name;
this.address = address;
}

/* Constructor */
/**
* Constructor
* @param name name of building
* @param address address of building
* @param nFloors number of floors
* @param elevator whether or not there is an elevator
*/
public Building(String name, String address, int nFloors, boolean elevator) {
if (name != null) {
this.name = name;
}
if (address != null) {
this.address = address;
}
if (nFloors < 1) {
throw new RuntimeException("Cannot construct a building with fewer than 1 floor.");
}
this.nFloors = nFloors;
this.elevator = elevator;
}

/* Accessors */

/**
* Getter for name
* @return name
*/
public String getName() {
return this.name;
}

/**
* Getter for address
* @return address
*/
public String getAddress() {
return this.address;
}

/**
* Getter for number of floors
* @return number of floors
*/
public int getFloors() {
return this.nFloors;
}

/**
* Getter for whether or not there is an elevator
* @return whether or not there is an elevator
*/
public boolean getElevator() {
return this.elevator;
}

/* Navigation methods */
/**
* Lets user enter building
* @return building user is in
*/
public Building enter() {
if (activeFloor != -1) {
throw new RuntimeException("You are already inside this Building.");
}
this.activeFloor = 1;
System.out.println("You are now inside " + this.name + " on the ground floor.");
return this; // Return a pointer to the current building
}

/**
* Lets user exit building
* @return building user exited
*/
public Building exit() {
if (this.activeFloor == -1) {
throw new RuntimeException("You are not inside this Building. Must call enter() before exit().");
}
if (this.activeFloor > 1) {
throw new RuntimeException("You have fallen out a window from floor #" + this.activeFloor + "!");
}
System.out.println("You have left " + this.name + ".");
this.activeFloor = -1; // We're leaving the building, so we no longer have a valid active floor
return null; // We're outside now, so the building is null
}

/**
* Lets user go to floor
* @param floorNum floor number
*/
public void goToFloor(int floorNum) {
if (this.activeFloor == -1) {
throw new RuntimeException("You are not inside this Building. Must call enter() before navigating between floors.");
}
if (floorNum < 1 || floorNum > this.nFloors) {
throw new RuntimeException("Invalid floor number. Valid range for this Building is 1-" + this.nFloors + ".");
}
System.out.println("You are now on floor #" + floorNum + " of " + this.name);
this.activeFloor = floorNum;
}

/**
* Lets user go up
*/
public void goUp() {
this.goToFloor(this.activeFloor + 1);
}

/**
* Lets user go down
*/
public void goDown() {
this.goToFloor(this.activeFloor - 1);
}

/**
* Prints options at that building
*/
public void showOptions() {
System.out.println("Available options at " + this.name + ":\n + enter() \n + exit() \n + goUp() \n + goDown()\n + goToFloor(n)");
}

/**
* Returns the string of name
* @return name
*/
public String toString() {
return this.name;
}

/**
* Main Method
* @param args
*/
public static void main(String[] args) {
System.out.println("------------------------------------");
System.out.println("Test of Building constructor/methods");
System.out.println("------------------------------------");

Building fordHall = new Building("Ford Hall", "100 Green Street Northampton, MA 01063", 20, true);
System.out.println(fordHall);
fordHall.showOptions();

System.out.println("-----------------------------------");
System.out.println("Demonstrating enter/exit/navigation");
System.out.println("-----------------------------------");
fordHall.enter();
fordHall.goUp();
fordHall.goDown();
fordHall.exit();
}

}
Binary file added CSC 120 FP Architecture Diagram.pdf
Binary file not shown.
26 changes: 26 additions & 0 deletions CSC120 Additional reflection questions .md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
* **What was your overall approach to tackling this project?**

We firstly draft a narrative of the game so that we can decide what class and method we need to put in our game. Since we did this project in teamwork, it became clear to divide the workload based on different classes/methods. The underlying intention of the game was to apply the concepts we have learnt in the class over the semester, so when we were deciding the methods, we took past assignments as a reference.

* **What new thing(s) did you learn / figure out in completing this project?**

One of the biggest accomplishments of the game is the application of Guava. Guava helped us to build an indirect map as well as the key of the whole layout of the game. We learnt how to add information (e.g.directions) on the edges and link all the classes and methods together in the Game Loop.

* **Is there anything that you wish you had implemented differently?**

We could have implemented the makeResponse() method in the chatbot class a bit differently. Our approach was a bit procedural, and it could have been broken up into several methods for clarity. In a similar vein, we could have also made the instances of Object included in the game attributes of the buildings rather than the map, so that we could have removed some of the error-handling from the chatbot.

* **If you had unlimited time, what additional features would you implement?**

If we had unlimited time to work on this project, we’d love to implement graphics to make the game more interesting to the user. In addition, it would be great to have items sold by restaurants be instances of a class that is different than object, since it would give us more functionality with regards to the methods in the Restaurant class (we chose to just use Store to save time). We also wish we could have implemented a method called lookAround(), which would tell the player which buildings surrounded them. Finally, Northampton has a lot to do, and we could have captured more buildings and objects in our game with more time\!

* **What was the most helpful piece of feedback you received while working on your project? Who gave it to you?**

We received a lot of really good feedback on this project\! For instance, Professor Mosca advised us to add a class for Tasks, since each task had to hold a lot of information in order to work as implemented, and we found this to be really helpful.

* **If you could go back in time and give your past self some advice about this project, what hints would you give?**
If we could go back in time, we would have given ourselves the hint to give ourselves a lot of time to figure out how Guava works and to not be intimidated by Guava because once you figure it out, it’s not that complicated.
* ***If you worked with a team:*** **please comment on how your team dynamics influenced your experience working on this project.**

Our project consists of different classes. We decided that each individual in the group would be responsible for writing one part of the project (e.g. buildings, person, bingo card, map) and then we could meet to connect the classes and write the game loop. By having something to do both individually and as a group, each person could get a sense of what they should do and have a chance to collaborate with each other. This kind of working strategy made the division of the work and communication within the group much clearer. Overall, the team dynamics made everyone have a good experience on this project.

16 changes: 16 additions & 0 deletions CSC120-FinalProject-1.code-workspace
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"folders": [
{
"path": "."
},
{
"path": "../Guava Demo-20241202/.vscode"
}
],
"settings": {
"java.project.referencedLibraries": [
"lib/**/*.jar",
"guava-31.1-jre.jar"
]
}
}
Binary file added CSC210_final_project_map.pdf
Binary file not shown.
Loading