Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 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
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
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
}
80 changes: 80 additions & 0 deletions Castle.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
/**
* 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 String name;
protected boolean isAccessible;
protected 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 boolean isAccessible() {
return isAccessible;
}

/**
* Sets whether the castle is accessible.
* @param accessible True to make accessible, false to block access.
*/
public void setAccessible(boolean accessible) {
this.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 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.");
}
}
}
54 changes: 54 additions & 0 deletions FullSpinner.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import java.util.ArrayList;
import java.util.Random;

public class FullSpinner {
private ArrayList<SpinnerPart> parts;

public FullSpinner(){
this.parts = new ArrayList<>();
}


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"));

//adding my candies

parts.add(new SpinnerPart("Ice cream"));
parts.add(new SpinnerPart("Peanut"));
parts.add(new SpinnerPart("Lollipop"));
parts.add(new SpinnerPart("Licorice"));


}
//i'll need to add an override method to a to string

// @Override
// public void toString(){
// return "FullSpinner has a ";
// }

public String spin(){
int Index = random.nextInt(parts.size()); //is it not recognizing random?
String part = parts.get(Index).toString(); //can i not use somethig tat is part of a method in another class
return part ;//the thing that
//how could i do this without a getOutput variable


// just declare a variable that would pick a random number from the number of stuff in the arraylist
//and then just get it to spit out that index


}
public static void main(String[] args) {
FullSpinner spinner = new FullSpinner();
spinner.addParts();
System.out.println(spinner);
}

}
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!");
}
}
}
79 changes: 79 additions & 0 deletions LicoriceLagoon.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
import java.util.ArrayList;
import java.util.Scanner;


}

public int guessNumber(){
return this.selectNumber;
/*
* When you land in the lagoon you will need to guess a number from 1 to 10.
* If you guess it incorectly, you will get a random trivia question.
* Array List of the trivia questions.
*/
}

public Boolean proceedTrivia(){
/*
* If number guessed is incorrect proceed to trivia questions.
*/
return this.trivia;
}

public String triviaQuestions(){
/*
* Random questions in an Array List
*/
questions = new ArrayList<>();

return this.triviaQuestions;
}

public String proceedOrNot(){
/*
* If trivia questions wrongly answered then player loses
and therefore proceeds through the long way and does not get directly
relocated to were the catsles are.
* If correctly answered then player gets relocated to the first castle.
*/
return this.acceptance;

public class LicoriceLagoon extends PathPlaces{

public LicoriceLagoon(String name, int playerInput, ArrayList triviaQuestions) {
super (name, playerInput, triviaQuestions);
}
public void printPathName() {
/*
* 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.
*/
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?");

Scanner scanner = new Scanner(System.in);
int playerInput = scanner.nextInt();
System.out.println(triviaQuestions.size());
String question = triviaQuestions.get(this.random.nextInt (triviaQuestions.size()));

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

System.out.println("Well done! You have completed the challenge and may progress to the next tile.");
}
} else {
throw new IllegalArgumentException("Please enter a number between 2000 and 5000.");
}

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

}
LicoriceLagoon llTest = new LicoriceLagoon("Licorice Lagoon", 2003, PathPlaces.triviaQuestions);
llTest.printPathName();
}
}
71 changes: 71 additions & 0 deletions LollipopCastle.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
import java.util.Scanner;

/**
* Represents the Lollipop Castle in Candy Land.
* Players must complete a jumping challenge to proceed toward the Frosted Palace.
*/
public class LollipopCastle extends Castle {
private boolean hasKeyToFrostedPalace;
private double height;

/**
* Constructs a new Lollipop Castle.
*/
public LollipopCastle() {
super("Lollipop Castle");
this.hasKeyToFrostedPalace = false;
this.height = 0;
}

/**
* Starts the jumping challenge at Lollipop Castle.
* If the player jumps between 200–400, they succeed and teleport closer to the Frosted Palace.
* Even if they fail the jump, they still receive the key but must take a longer route.
*
* @param hasKey A boolean indicating if the player has the required key to enter.
*/
public void startChallenge(boolean hasKey) {
if (!hasKey) {
System.out.println("You cannot enter Lollipop Castle without the key to the Frosted Palace.");
return;
}

Scanner scanner = new Scanner(System.in);
System.out.println("Welcome to Lollipop Castle!");
System.out.println("Jump too low = caramel abyss. Jump too high = sucked into space.");

System.out.print("Enter your jump height (100–500): ");
if (scanner.hasNextDouble()) {
height = scanner.nextDouble();
if (height < 100 || height > 500) {
System.out.println("Invalid jump height. Must be between 100 and 500.");
} else {
if (height >= 200 && height <= 400) {
System.out.println("Perfect jump! You land safely on the other side.");
player.setPositionIndex(45);
System.out.println("You are teleported to the Frosted Palace!");
} else if (height < 200) {
System.out.println("Too low! You fall into the caramel abyss... Taking the long route to the Frosted Palace.");
} else {
System.out.println("Too high! You’re sucked into the void of space... Taking the long route to the Frosted Palace.");
}
}
} else {
System.out.println("Please enter a valid number.");
scanner.next(); // Clear invalid input
}

// Regardless of success or failure, the player gets the key
this.hasKeyToFrostedPalace = true;
this.isAccessible = true;
}

/**
* Checks if the player has earned the key to the Frosted Palace.
*
* @return true if the player has the key, false otherwise.
*/
public boolean hasKeyToFrostedPalace() {
return hasKeyToFrostedPalace;
}
}
Loading