Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feedback #1

Open
wants to merge 14 commits into
base: feedback
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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 .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .idea/.name

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions .idea/jarRepositories.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

49 changes: 49 additions & 0 deletions adventure.iml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Maven: org.glassfish.jersey.containers:jersey-container-grizzly2-http:2.29.1" level="project" />
<orderEntry type="library" name="Maven: org.glassfish.hk2.external:jakarta.inject:2.6.1" level="project" />
<orderEntry type="library" name="Maven: org.glassfish.grizzly:grizzly-http-server:2.4.4" level="project" />
<orderEntry type="library" name="Maven: org.glassfish.grizzly:grizzly-http:2.4.4" level="project" />
<orderEntry type="library" name="Maven: org.glassfish.grizzly:grizzly-framework:2.4.4" level="project" />
<orderEntry type="library" name="Maven: org.glassfish.jersey.core:jersey-common:2.29.1" level="project" />
<orderEntry type="library" name="Maven: jakarta.annotation:jakarta.annotation-api:1.3.5" level="project" />
<orderEntry type="library" name="Maven: org.glassfish.hk2:osgi-resource-locator:1.0.3" level="project" />
<orderEntry type="library" name="Maven: com.sun.activation:jakarta.activation:1.2.1" level="project" />
<orderEntry type="library" name="Maven: org.glassfish.jersey.core:jersey-server:2.29.1" level="project" />
<orderEntry type="library" name="Maven: org.glassfish.jersey.core:jersey-client:2.29.1" level="project" />
<orderEntry type="library" name="Maven: org.glassfish.jersey.media:jersey-media-jaxb:2.29.1" level="project" />
<orderEntry type="library" name="Maven: jakarta.validation:jakarta.validation-api:2.0.2" level="project" />
<orderEntry type="library" name="Maven: jakarta.xml.bind:jakarta.xml.bind-api:2.3.2" level="project" />
<orderEntry type="library" name="Maven: jakarta.activation:jakarta.activation-api:1.2.1" level="project" />
<orderEntry type="library" name="Maven: jakarta.ws.rs:jakarta.ws.rs-api:2.1.6" level="project" />
<orderEntry type="library" name="Maven: org.glassfish.jersey.inject:jersey-hk2:2.26" level="project" />
<orderEntry type="library" name="Maven: org.glassfish.hk2:hk2-locator:2.5.0-b42" level="project" />
<orderEntry type="library" name="Maven: org.glassfish.hk2.external:javax.inject:2.5.0-b42" level="project" />
<orderEntry type="library" name="Maven: org.glassfish.hk2.external:aopalliance-repackaged:2.5.0-b42" level="project" />
<orderEntry type="library" name="Maven: org.glassfish.hk2:hk2-api:2.5.0-b42" level="project" />
<orderEntry type="library" name="Maven: javax.inject:javax.inject:1" level="project" />
<orderEntry type="library" name="Maven: org.glassfish.hk2:hk2-utils:2.5.0-b42" level="project" />
<orderEntry type="library" name="Maven: javax.annotation:javax.annotation-api:1.2" level="project" />
<orderEntry type="library" name="Maven: org.javassist:javassist:3.22.0-CR2" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.10.0" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.10.0" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-core:2.10.0" level="project" />
<orderEntry type="library" name="Maven: org.glassfish.jersey.media:jersey-media-json-jackson:2.29.1" level="project" />
<orderEntry type="library" name="Maven: org.glassfish.jersey.ext:jersey-entity-filtering:2.29.1" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.module:jackson-module-jaxb-annotations:2.9.9" level="project" />
<orderEntry type="library" name="Maven: junit:junit:4.12" level="project" />
<orderEntry type="library" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
<orderEntry type="library" name="Maven: org.xerial:sqlite-jdbc:3.32.3.2" level="project" />
</component>
</module>
5 changes: 0 additions & 5 deletions src/main/java/Main.java

This file was deleted.

25 changes: 25 additions & 0 deletions src/main/java/student/Main.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package student;

import org.glassfish.grizzly.http.server.HttpServer;
import student.adventure.AdventureDesign;
import student.adventure.GameEngine;
import student.server.AdventureResource;
import student.server.AdventureServer;
import student.server.BreakingBadAdventureService;

import java.io.File;
import java.io.IOException;
import java.util.Scanner;

/**
* Main class that uses a scanner input to call methods, and is used as a UI. Commands include "go", "take",
* "drop", "examine", and more. Accounts for spelling and spacing errors. This class also stores the server
* for the API.
*/
public class Main {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your main has way too much in it right now. All of your game logic should be in its own class. At the moment its impossible to test your game engine, which is a big issue as we always want to make our code as easy to test as possible.


public static void main(String[] args) throws IOException {
HttpServer server = AdventureServer.createServer(AdventureResource.class);
server.start();
}
}
50 changes: 50 additions & 0 deletions src/main/java/student/adventure/AdventureDesign.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package student.adventure;

public class AdventureDesign {

//the full list of rooms in the JSON file
public Room[] rooms;
//the name of the room that one starts in, stored in a String
public String startingRoom;
//the name of the room that one ends in, stored in a String
public String endingRoom;

public AdventureDesign() {

}
/**
* getter to retrieve the starting room of the adventure
* @return startingRoom
*/
public String getStartingRoom() {
return startingRoom;
}

/**
* getter to retrieve the ending room of the adventure
* @return endingRoom
*/
public String getEndingRoom() {
return endingRoom;
}

/**
* getter to retrieve the full list of rooms in JSON, all stored in the Room object
* @return rooms
*/
public Room[] getRooms() {
return rooms;
}

/**
* Complete constructor for the AdventureDesign class
* @param startingRoom - the starting room of the adventure
* @param endingRoom - the ending room of the adventure
* @param rooms - the full array of the rooms available
*/
public AdventureDesign(String startingRoom, String endingRoom, Room[] rooms) {
this.startingRoom = startingRoom;
this.endingRoom = endingRoom;
this.rooms = rooms;
}
}
41 changes: 41 additions & 0 deletions src/main/java/student/adventure/DirectionsOnMap.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package student.adventure;

/**
* This class works much like a linked list, where the Direction acts as a key, and the next room is viewed
* as a value
*/
public class DirectionsOnMap {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not just call this class Directions? DirectionsOnMap feels a bit redundant.

//the direction one is going in
private String directionName;
//the next room one will go in following the currentDirection
private String room;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd advise you to call this member variable roomName since you have an object type called Room.


public DirectionsOnMap() {

}
/**
* getter to retrieve the name of the direction
* @return directionName
*/
public String getDirectionName() {
return directionName;
}

/**
* getter to retrieve the name of the room that will be reached following a said direction
* @return room
*/
public String getRoom() {
return room;
}

/**
* Full constructor for the DirectionsOnMap class
* @param directionName - name of the direction(north, east, south, west, etc.)
* @param roomName - name of the room in said direction
*/
public DirectionsOnMap(String directionName, String roomName) {
this.directionName = directionName;
this.room = roomName;
}
}
Loading