Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
90 commits
Select commit Hold shift + click to select a range
2c622d8
sample push
GithinjiTabz1 Apr 17, 2025
07be9af
committing nananuthouse
merodriguez27 Apr 17, 2025
3ab4ee8
done with two spinners and players
meronoumer Apr 17, 2025
5cac9b4
done2
meronoumer Apr 17, 2025
123c1d6
updated Castle draft code
GithinjiTabz1 Apr 18, 2025
964d788
Merge remote-tracking branch 'origin/meron2' into Tabitha's-branch
GithinjiTabz1 Apr 18, 2025
f84d5a3
Class update
mcarbonellmatos Apr 18, 2025
444ea0e
Merge remote-tracking branch 'origin/Milka' into Tabitha's-branch
GithinjiTabz1 Apr 18, 2025
646e24f
changed the jump logic
GithinjiTabz1 Apr 18, 2025
9e4bc1c
Constructor and accesors
mcarbonellmatos Apr 20, 2025
657d43b
Update
mcarbonellmatos Apr 20, 2025
180ba3d
Map methods updated
mcarbonellmatos Apr 20, 2025
1a80d57
Merge branch 'MayMayBranch' of https://github.com/GithinjiTabz1/CSC12…
meronoumer Apr 21, 2025
72f1afe
Merge branch 'Milka' of https://github.com/GithinjiTabz1/CSC120-Final…
meronoumer Apr 21, 2025
f8f1aed
comittingsomething
merodriguez27 Apr 21, 2025
b202fb8
Committing to branch
merodriguez27 Apr 22, 2025
710af0f
Merge pull request #1 from GithinjiTabz1/MayMayBranch
merodriguez27 Apr 22, 2025
974b58c
committing architechture diagram
meronoumer Apr 23, 2025
3824a64
Merge branch 'main' of https://github.com/GithinjiTabz1/CSC120-FinalP…
meronoumer Apr 23, 2025
4b35b15
committing some path places updates
merodriguez27 Apr 24, 2025
02c7311
Merge branch 'main' of https://github.com/GithinjiTabz1/CSC120-FinalP…
merodriguez27 Apr 24, 2025
a6da189
Map Progress
mcarbonellmatos Apr 24, 2025
dc26925
edited spinner
meronoumer Apr 24, 2025
97d292a
Merge branch 'main' of https://github.com/GithinjiTabz1/CSC120-FinalP…
meronoumer Apr 24, 2025
b651f97
committing more edits
merodriguez27 Apr 24, 2025
1f273f6
Merge branch 'main' of https://github.com/GithinjiTabz1/CSC120-FinalP…
merodriguez27 Apr 24, 2025
c0fb558
Committing Edits
merodriguez27 Apr 25, 2025
16a6d77
nuthouse and parentpathplaces commit
merodriguez27 Apr 26, 2025
36a8fb3
Update
mcarbonellmatos Apr 26, 2025
cb231e7
Merge remote-tracking branch 'origin/Milka' into Tabitha's-branch
GithinjiTabz1 Apr 26, 2025
2fcb15e
fixed player class
meronoumer Apr 26, 2025
49f683f
fixed player class
meronoumer Apr 26, 2025
37eaf72
Merge branch 'main' of https://github.com/GithinjiTabz1/CSC120-FinalP…
meronoumer Apr 26, 2025
c131ed2
the Castle class and subclasses
GithinjiTabz1 Apr 26, 2025
12b5825
castle
GithinjiTabz1 Apr 26, 2025
a66433e
very sketchy main
GithinjiTabz1 Apr 26, 2025
b96f7ed
edited player
meronoumer Apr 26, 2025
87c5730
main and lollipop classes
GithinjiTabz1 Apr 26, 2025
38a8a9d
updating the teleporting methods
GithinjiTabz1 Apr 26, 2025
5820e24
map update
mcarbonellmatos Apr 26, 2025
5329a4e
Merge branch 'Tabitha's-branch' into Milka
mcarbonellmatos Apr 26, 2025
f11c56e
Merge remote-tracking branch 'origin/MayMayBranch' into Milka
mcarbonellmatos Apr 26, 2025
6dcf289
Merge remote-tracking branch 'origin/main' into Milka
mcarbonellmatos Apr 26, 2025
57ff1ec
minor edits
merodriguez27 Apr 26, 2025
9d2b404
committing minor edits
merodriguez27 Apr 26, 2025
848b1b8
commiting
merodriguez27 Apr 29, 2025
12af49b
updated castle subclasses
GithinjiTabz1 Apr 29, 2025
01848f1
map update
mcarbonellmatos Apr 29, 2025
9ad05c6
committing
merodriguez27 Apr 29, 2025
9e6de72
Merge branch 'main' into Milka
mcarbonellmatos Apr 29, 2025
c1cc5e1
Merge pull request #3 from GithinjiTabz1/Milka
mcarbonellmatos Apr 29, 2025
7932ae6
Merge branch 'main' into Tabitha's-branch
GithinjiTabz1 Apr 29, 2025
378c6a8
Merge pull request #2 from GithinjiTabz1/Tabitha's-branch
GithinjiTabz1 Apr 29, 2025
278d68f
Update
mcarbonellmatos Apr 29, 2025
4c0591b
Merge pull request #4 from GithinjiTabz1/Milka
GithinjiTabz1 Apr 29, 2025
e974159
committing more -maylynn
merodriguez27 Apr 29, 2025
11b096d
Merge branch 'main' of https://github.com/GithinjiTabz1/CSC120-FinalP…
merodriguez27 Apr 29, 2025
dc47d1a
comitting
merodriguez27 Apr 29, 2025
635f156
main - 50% done
meronoumer Apr 30, 2025
c545c5d
committing allchanges made with compilation error free code - main no…
meronoumer May 1, 2025
8365b17
commit this
meronoumer May 1, 2025
3b358c4
commit
meronoumer May 1, 2025
b672e5e
almost final commit
meronoumer May 1, 2025
9a04021
functioning main but can't solve the problem of not revisiting alre…
meronoumer May 1, 2025
d27ad71
allmost final fix
meronoumer May 1, 2025
637781d
edited startchallenge() to pass in an argument and reassigned telepo…
meronoumer May 1, 2025
bc715f2
codebase #3
meronoumer May 4, 2025
ba8306b
penultimate edits - working game loop with player successfully dying …
meronoumer May 4, 2025
5f8f23b
updated my javadoc header comments
meronoumer May 4, 2025
eb86bd5
Update cheatsheet.md
merodriguez27 May 6, 2025
00967f5
Update cheatsheet.md
merodriguez27 May 6, 2025
3dad6be
Update cheatsheet.md
mcarbonellmatos May 6, 2025
26b30a0
dealt with last two bugs and reformatted some of the prompts to make …
meronoumer May 8, 2025
37343d5
Merge branch 'main' of https://github.com/GithinjiTabz1/CSC120-FinalP…
meronoumer May 8, 2025
f23cdbf
filled out the rubric
GithinjiTabz1 May 8, 2025
ff61400
updated cheatsheet
GithinjiTabz1 May 8, 2025
9e7f680
design justification file
GithinjiTabz1 May 8, 2025
5915f66
createdc a reflections file
GithinjiTabz1 May 8, 2025
b2dbf31
final iteration of game
meronoumer May 9, 2025
83a0737
Merge branch 'main' of https://github.com/GithinjiTabz1/CSC120-FinalP…
meronoumer May 9, 2025
ea1bd7b
added my reflection
meronoumer May 9, 2025
8185978
updated cheatsheet
GithinjiTabz1 May 9, 2025
4c50da0
added comments
GithinjiTabz1 May 9, 2025
d6e307f
added javadoc comments
GithinjiTabz1 May 9, 2025
5dcc09c
added comments
GithinjiTabz1 May 9, 2025
16326c2
comments
GithinjiTabz1 May 9, 2025
0e85fba
updated archiecture diagram
GithinjiTabz1 May 9, 2025
689c6aa
updated comment
GithinjiTabz1 May 9, 2025
f64c38f
deleted Queen Kandy
GithinjiTabz1 May 9, 2025
7344c00
added the map
GithinjiTabz1 May 9, 2025
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
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"java.debug.settings.onBuildFailureProceed": true
}
Binary file added Candyland Map.pdf
Binary file not shown.
81 changes: 81 additions & 0 deletions Castle.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
/**
* Castle class represents a special location (castle) in the Candy Land game.
* Players can enter or exit castles if they are accessible.
*/
public class Castle {
protected static String name;
protected static boolean isAccessible;
protected static boolean isInTheCastle;

/**
* Constructor for Castle.
* @param name The name of the castle.
*/
public Castle(String name) {
this.name = name;
this.isAccessible = true;
this.isInTheCastle = false;
}

/**
* Gets the name of the castle.
* @return The name of the castle.
*/
public String getName() {
return name;
}

/**
* Checks if the castle is accessible.
* @return True if accessible, false otherwise.
*/
public static boolean isAccessible() {
return isAccessible;
}

/**
* Sets whether the castle is accessible.
* @param accessible True to make accessible, false to block access.
*/
public static void setAccessible(Boolean accessible) {
FrostedPalace.isAccessible = accessible;
}

/**
* Checks if the player is currently inside the castle.
* @return True if inside, false otherwise.
*/
public boolean isInTheCastle() {
return isInTheCastle;
}


/**
* Handles the logic for entering the castle.
* Player can only enter if the castle is accessible and they are not already inside.
*/
public static void enter() {
if (isAccessible && !isInTheCastle) {
isInTheCastle = true;
System.out.println("You have entered the " + name + ".");

} else if (isInTheCastle) {
System.out.println("You are already in the " + name + ".");
} else {
System.out.println("The " + name + " is not accessible right now.");
}
}

/**
* Handles the logic for exiting the castle.
* Player can only exit if they are currently inside.
*/
public void exit() {
if (isInTheCastle) {
isInTheCastle = false;
System.out.println("You have exited the " + name + ".");
} else {
System.out.println("You are not in the " + name + " to exit.");
}
}
}
11 changes: 11 additions & 0 deletions Design Justification.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Design Justification
For this project, we designed a text-based adventure game inspired by Candy Land, where players journey through a series of themed challenges — Lollipop Castle, Frosted Palace, Nana’s Nuthouse, and finally, King Kandy’s Castle.

Each location is implemented as a class extending from a common superclass (Castle or Paths), allowing us to structure the game using inheritance and encapsulation.

We broke our code into separate classes so it was easier to manage and fix, and so each person could work on their part without getting in each other’s way. Each castle or location had its own challenge logic (e.g., a jumping challenge in Lollipop Castle, a number guessing game in Frosted Palace), which helped isolate bugs and made testing individual components easier. We also made sure the main method acted more as a narrative controller rather than duplicating logic.

# Alternative Considered
One design alternative we discussed was using cards instead of a spinning wheel — or even incorporating both — to determine player movement. While the spinning wheel was simpler to implement programmatically using random numbers, incorporating cards could have added an element of memory or strategy but it was more time consuming to configure. If we had more time, we might have explored a hybrid mechanic that combines randomness with player choice.


95 changes: 95 additions & 0 deletions FullSpinner.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
import java.util.ArrayList;
import java.util.Random;

/**
* The FullSpinner class simulates a spinner used in a board game.
* It randomly selects a color or candy tile from a predefined list.
* Special tiles (candies) can be removed once visited to prevent replay.
*
* This class supports adding spinner parts, removing special tiles,
* spinning for a random outcome, and displaying the result.
*/
public class FullSpinner {
private ArrayList<SpinnerPart> parts;
private String part;
private Random random;

/**
* Constructs a FullSpinner with an empty list of spinner parts
* and initializes the random number generator.
*/
public FullSpinner() {
this.parts = new ArrayList<>();
this.random = new Random();
}

/**
* Populates the spinner with basic color tiles and special candy tiles.
* This method should be called before any spinning is performed.
*/
public void addParts() {
parts.add(new SpinnerPart("Red"));
parts.add(new SpinnerPart("Purple"));
parts.add(new SpinnerPart("Yellow"));
parts.add(new SpinnerPart("Blue"));
parts.add(new SpinnerPart("Orange"));
parts.add(new SpinnerPart("Green"));
parts.add(new SpinnerPart("Red"));
parts.add(new SpinnerPart("Purple"));
parts.add(new SpinnerPart("Yellow"));
parts.add(new SpinnerPart("Blue"));
parts.add(new SpinnerPart("Orange"));
parts.add(new SpinnerPart("Green"));
parts.add(new SpinnerPart("Red"));
parts.add(new SpinnerPart("Purple"));
parts.add(new SpinnerPart("Yellow"));
parts.add(new SpinnerPart("Blue"));
parts.add(new SpinnerPart("Orange"));
parts.add(new SpinnerPart("Green"));

// Adding special candy tiles
parts.add(new SpinnerPart("Peppermint"));
parts.add(new SpinnerPart("Icecream"));
parts.add(new SpinnerPart("Licorice"));
parts.add(new SpinnerPart("Lollipop"));
parts.add(new SpinnerPart("Peanut"));
}

/**
* Removes a special tile (e.g., candy) that has already been visited
* so it won't appear again in future spins.
*
* @param partName the name of the tile to remove from the spinner
*/
public void removeVisitedCandies(String partName) {
parts.removeIf(p -> p.getColor().equals(partName));
}

/**
* Spins the spinner and returns a randomly selected SpinnerPart.
*
* @return the randomly selected SpinnerPart
* @throws IllegalStateException if the spinner parts list is empty
*/
public SpinnerPart spin() {
if (parts.isEmpty()) {
throw new IllegalStateException("The spinner parts list is empty! Please add parts before spinning.");
}

int index = random.nextInt(parts.size());
SpinnerPart SpinnerOutput = parts.get(index);

this.part = SpinnerOutput.getColor();
return SpinnerOutput;
}

/**
* Returns a string representation of the spin result.
*
* @return message indicating the tile the player spun
*/
@Override
public String toString() {
return "Congratulations! You have spun a " + this.part + ". You can now advance ahead to the " + this.part + " tile.";
}
}
41 changes: 41 additions & 0 deletions KingKandyCastle.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import java.util.Scanner;

/**
* Represents King Kandy's Castle, the final destination in Candy Land.
* Players can only enter if they have the required key from Frosted Palace.
*/
public class KingKandyCastle extends Castle {
private boolean hasKeyToKingKandy;

/**
* Constructor.
*/
public KingKandyCastle() {
super("King Kandy's Castle");
this.hasKeyToKingKandy = false;
}

/**
* Sets whether the player has the key to King Kandy's Castle.
* @param hasKey true if the player has the key, false otherwise.
*/
public void setHasKeyToKingKandy(boolean hasKey) {
this.hasKeyToKingKandy = hasKey;
}

/**
* Attempts to enter King Kandy's Castle.
* Only allows entry if the player has the King Kandy key.
*/
public void attemptEntry() {
if (hasKeyToKingKandy) { // <<< use the local boolean here
Scanner scanner = new Scanner(System.in);
System.out.println("\n You have reached King Kandy's Castle!");
System.out.print("Press Enter to step inside and claim your victory...");
scanner.nextLine();
System.out.println("\n Congratulations! You have WON the game!");
} else {
System.out.println("\n You cannot enter King Kandy's Castle yet! You need the final key!");
}
}
}
88 changes: 88 additions & 0 deletions LicoriceLagoon.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
import java.util.Scanner;

/**
* Represents the Licorice Lagoon, a special location in the game where players
* must guess the number of licorice pieces to proceed and earn the key to Lollipop Castle.
*/
public class LicoriceLagoon extends PathPlaces {
private static boolean hasKeyToLollipop = false;

/**
* Constructs a new Licorice Lagoon with the specified name and player input.
*
* @param name the name of this location
* @param playerInput the initial player input value
*/
public LicoriceLagoon(String name, int playerInput) {
super(name, playerInput);
}

/**
* Displays the welcome message and challenge description for the Licorice Lagoon.
*/
public void printPathName() {
System.out.println("You have entered the Licorice Lagoon! You are ready to begin your next challenge. " +
"From 2000 - 5000, how many licorice make up the Lagoon?");
}

/*
* When you land in the lagoon you will need to guess a number.
* If you guess it incorectly, you will get a random trivia question.
* ArrayList of the trivia questions.
*/

/**
* Starts the licorice counting challenge.
* Players must guess a number between 2000 and 5000.
* Odd numbers allow direct progression, while even numbers require answering a trivia question.
*
* @return true if the player has earned the key to Lollipop Castle
*/
public Boolean startChallenge() {
Scanner scanner = new Scanner(System.in);
int playerInput = scanner.nextInt();
String question = triviaQuestions.get(this.random.nextInt(triviaQuestions.size()));

hasKeyToLollipop = true;
if (playerInput >= 2000 && playerInput <= 5000) {
if (playerInput % 2 != 0) {
System.out.println("Aha! I see you have done your research! " + playerInput +
" licorice make up the Lagoon. You can advance to the next tile.");
} else {
System.out.println("Oh no! " + playerInput +
" is not the correct number of licorice that make up the Lagoon. " +
"You must complete the following trivia question to move to the next tile. " +
question);
scanner.nextLine();
String response = scanner.nextLine();
System.out.println("Well done! You have completed the challenge and may progress to the next tile.");
}
} else {
System.out.println("Please enter a number between 2000 and 5000.");
}
System.out.println("Yay! You also just acquired the key to Lollipop Castle. Keeping it in your inventory for now.");
return hasKeyToLollipop;
}

/**
* Displays a success message when the player completes the challenge.
*/
public void finalSentiment() {
System.out.println("That's right! You have completed the challenge and may progress to the next tile.");
}

public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);

LicoriceLagoon llTest = new LicoriceLagoon("Licorice Lagoon", 2003);
llTest.printPathName();


try {
Boolean result = llTest.startChallenge();
System.out.println("Result: " + result);
} catch (IllegalArgumentException e) {
System.err.println("Error: " + e.getMessage());
}
}
}
Loading