├── .gitignore
├── section8
├── sample_data.txt
├── CreateAFile.java
├── OutgoingCallsFromBangalore.java
├── Call.java
├── LongestCall.java
├── TotalNumberOfCalls.java
├── RecordOfTextsAndCalls.java
└── PotentialTelemarketers.java
├── README.md
├── Hangman
├── src
│ ├── main
│ │ ├── resources
│ │ │ ├── hangman_ascii.txt
│ │ │ ├── scores.txt
│ │ │ ├── guesses
│ │ │ │ ├── 0.png
│ │ │ │ ├── 1.png
│ │ │ │ ├── 2.png
│ │ │ │ ├── 3.png
│ │ │ │ ├── 4.png
│ │ │ │ ├── 5.png
│ │ │ │ ├── 6.png
│ │ │ │ ├── 7.png
│ │ │ │ └── 8.png
│ │ │ └── letters
│ │ │ │ ├── temp
│ │ │ │ ├── 1.png
│ │ │ │ ├── 2.png
│ │ │ │ ├── 3.png
│ │ │ │ ├── 4.png
│ │ │ │ ├── 5.png
│ │ │ │ ├── 6.png
│ │ │ │ ├── 7.png
│ │ │ │ ├── 8.png
│ │ │ │ ├── 9.png
│ │ │ │ ├── 10.png
│ │ │ │ ├── 11.png
│ │ │ │ ├── 12.png
│ │ │ │ ├── 13.png
│ │ │ │ ├── 14.png
│ │ │ │ ├── 15.png
│ │ │ │ ├── 16.png
│ │ │ │ ├── 17.png
│ │ │ │ ├── 18.png
│ │ │ │ ├── 19.png
│ │ │ │ ├── 20.png
│ │ │ │ ├── 21.png
│ │ │ │ ├── 22.png
│ │ │ │ ├── 23.png
│ │ │ │ ├── 24.png
│ │ │ │ ├── 25.png
│ │ │ │ ├── 26.png
│ │ │ │ ├── 27.png
│ │ │ │ ├── 28.png
│ │ │ │ ├── 29.png
│ │ │ │ ├── 30.png
│ │ │ │ ├── 31.png
│ │ │ │ ├── 32.png
│ │ │ │ ├── 33.png
│ │ │ │ ├── 34.png
│ │ │ │ ├── 35.png
│ │ │ │ ├── 36.png
│ │ │ │ ├── 37.png
│ │ │ │ ├── 38.png
│ │ │ │ ├── 39.png
│ │ │ │ ├── 40.png
│ │ │ │ ├── 41.png
│ │ │ │ ├── 42.png
│ │ │ │ ├── 43.png
│ │ │ │ ├── 44.png
│ │ │ │ ├── 45.png
│ │ │ │ ├── 46.png
│ │ │ │ ├── 47.png
│ │ │ │ ├── 48.png
│ │ │ │ ├── 49.png
│ │ │ │ ├── 50.png
│ │ │ │ ├── 51.png
│ │ │ │ └── 52.png
│ │ │ │ └── Untitled.gif
│ │ └── java
│ │ │ ├── Counter.java
│ │ │ ├── Main.java
│ │ │ ├── UserInput.java
│ │ │ ├── FileIO.java
│ │ │ ├── UserInterface.java
│ │ │ └── HangmanGame.java
│ └── test
│ │ └── java
│ │ ├── UserInterfaceTest.java
│ │ └── HangmanGameTest.java
├── .idea
│ ├── .gitignore
│ ├── vcs.xml
│ ├── misc.xml
│ ├── compiler.xml
│ ├── libraries
│ │ └── junit.xml
│ ├── jarRepositories.xml
│ └── uiDesigner.xml
└── pom.xml
├── SpringBootAssign1
├── target
│ ├── classes
│ │ ├── application.properties
│ │ └── com
│ │ │ └── genspark
│ │ │ └── SpringBootAssign1
│ │ │ ├── Entity
│ │ │ ├── Course.class
│ │ │ └── Employee.class
│ │ │ ├── Service
│ │ │ ├── CourseService.class
│ │ │ ├── CourseServiceImpl.class
│ │ │ ├── EmployeeService.class
│ │ │ └── EmployeeServiceImpl.class
│ │ │ ├── Controller
│ │ │ └── MyController.class
│ │ │ └── SpringBootAssign1Application.class
│ └── test-classes
│ │ └── com
│ │ └── genspark
│ │ └── SpringBootAssign1
│ │ └── SpringBootDemoAppApplicationTests.class
├── src
│ ├── main
│ │ ├── resources
│ │ │ └── application.properties
│ │ └── java
│ │ │ └── com
│ │ │ └── genspark
│ │ │ └── SpringBootAssign1
│ │ │ ├── SpringBootAssign1Application.java
│ │ │ ├── Service
│ │ │ ├── CourseService.java
│ │ │ ├── EmployeeService.java
│ │ │ ├── CourseServiceImpl.java
│ │ │ └── EmployeeServiceImpl.java
│ │ │ ├── Entity
│ │ │ ├── Employee.java
│ │ │ └── Course.java
│ │ │ └── Controller
│ │ │ └── MyController.java
│ └── test
│ │ └── java
│ │ └── com
│ │ └── genspark
│ │ └── SpringBootAssign1
│ │ └── SpringBootDemoAppApplicationTests.java
├── HELP.md
├── pom.xml
├── mvnw.cmd
└── mvnw
├── DragonCave
├── .idea
│ ├── .gitignore
│ ├── vcs.xml
│ ├── compiler.xml
│ ├── misc.xml
│ └── jarRepositories.xml
├── src
│ ├── test
│ │ └── java
│ │ │ └── MainTest.java
│ └── main
│ │ └── java
│ │ └── Main.java
└── pom.xml
├── NumberGuess
├── .idea
│ ├── .gitignore
│ ├── vcs.xml
│ ├── compiler.xml
│ ├── misc.xml
│ └── jarRepositories.xml
├── src
│ ├── test
│ │ └── java
│ │ │ └── MainTest.java
│ └── main
│ │ └── java
│ │ └── Main.java
└── pom.xml
├── HumansVsGoblins
├── .idea
│ ├── .gitignore
│ ├── vcs.xml
│ ├── misc.xml
│ ├── compiler.xml
│ ├── jarRepositories.xml
│ └── uiDesigner.xml
├── src
│ ├── main
│ │ └── java
│ │ │ ├── ui
│ │ │ ├── display
│ │ │ │ ├── Displayable.java
│ │ │ │ ├── Display.java
│ │ │ │ ├── TileDisplay.java
│ │ │ │ └── BoardDisplay.java
│ │ │ ├── UserInterface.java
│ │ │ └── UserInput.java
│ │ │ ├── interactable
│ │ │ ├── Interactable.java
│ │ │ └── creature
│ │ │ │ ├── Creature.java
│ │ │ │ ├── Goblin.java
│ │ │ │ ├── Human.java
│ │ │ │ └── CreatureConcrete.java
│ │ │ ├── game
│ │ │ ├── turn
│ │ │ │ ├── logic
│ │ │ │ │ ├── TurnLogic.java
│ │ │ │ │ ├── start
│ │ │ │ │ │ ├── Start.java
│ │ │ │ │ │ ├── math
│ │ │ │ │ │ │ ├── MathStart.java
│ │ │ │ │ │ │ └── RandomStart.java
│ │ │ │ │ │ └── FirstStart.java
│ │ │ │ │ ├── AlwaysFirst.java
│ │ │ │ │ └── PlayersHuman.java
│ │ │ │ └── TurnTracker.java
│ │ │ ├── BattleManager.java
│ │ │ ├── board
│ │ │ │ ├── Holder.java
│ │ │ │ ├── Tile.java
│ │ │ │ └── Board.java
│ │ │ ├── conditional
│ │ │ │ ├── Conditional.java
│ │ │ │ └── HumansOnly.java
│ │ │ ├── Roster.java
│ │ │ └── Game.java
│ │ │ └── Main.java
│ └── test
│ │ └── java
│ │ └── game
│ │ └── conditional
│ │ └── HumansOnlyTest.java
└── pom.xml
└── .idea
├── vcs.xml
├── modules.xml
├── GensparkProjects.iml
└── workspace.xml
/.gitignore:
--------------------------------------------------------------------------------
1 |
2 | *.class
3 |
--------------------------------------------------------------------------------
/section8/sample_data.txt:
--------------------------------------------------------------------------------
1 | test
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | GensparkProjects
2 |
--------------------------------------------------------------------------------
/Hangman/src/main/resources/hangman_ascii.txt:
--------------------------------------------------------------------------------
1 | o
2 | /|\
3 | / \
--------------------------------------------------------------------------------
/SpringBootAssign1/target/classes/application.properties:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/SpringBootAssign1/src/main/resources/application.properties:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/Hangman/src/main/resources/scores.txt:
--------------------------------------------------------------------------------
1 | m,4
2 | n,5
3 | m,3
4 | m,4
5 |
--------------------------------------------------------------------------------
/Hangman/.idea/.gitignore:
--------------------------------------------------------------------------------
1 | # Default ignored files
2 | /shelf/
3 | /workspace.xml
4 |
--------------------------------------------------------------------------------
/DragonCave/.idea/.gitignore:
--------------------------------------------------------------------------------
1 | # Default ignored files
2 | /shelf/
3 | /workspace.xml
4 |
--------------------------------------------------------------------------------
/NumberGuess/.idea/.gitignore:
--------------------------------------------------------------------------------
1 | # Default ignored files
2 | /shelf/
3 | /workspace.xml
4 |
--------------------------------------------------------------------------------
/HumansVsGoblins/.idea/.gitignore:
--------------------------------------------------------------------------------
1 | # Default ignored files
2 | /shelf/
3 | /workspace.xml
4 | *.class
--------------------------------------------------------------------------------
/HumansVsGoblins/src/main/java/ui/display/Displayable.java:
--------------------------------------------------------------------------------
1 | package ui.display;
2 |
3 | public interface Displayable {
4 | }
5 |
--------------------------------------------------------------------------------
/Hangman/src/main/resources/guesses/0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/combsort/GensparkProjects/master/Hangman/src/main/resources/guesses/0.png
--------------------------------------------------------------------------------
/Hangman/src/main/resources/guesses/1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/combsort/GensparkProjects/master/Hangman/src/main/resources/guesses/1.png
--------------------------------------------------------------------------------
/Hangman/src/main/resources/guesses/2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/combsort/GensparkProjects/master/Hangman/src/main/resources/guesses/2.png
--------------------------------------------------------------------------------
/Hangman/src/main/resources/guesses/3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/combsort/GensparkProjects/master/Hangman/src/main/resources/guesses/3.png
--------------------------------------------------------------------------------
/Hangman/src/main/resources/guesses/4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/combsort/GensparkProjects/master/Hangman/src/main/resources/guesses/4.png
--------------------------------------------------------------------------------
/Hangman/src/main/resources/guesses/5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/combsort/GensparkProjects/master/Hangman/src/main/resources/guesses/5.png
--------------------------------------------------------------------------------
/Hangman/src/main/resources/guesses/6.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/combsort/GensparkProjects/master/Hangman/src/main/resources/guesses/6.png
--------------------------------------------------------------------------------
/Hangman/src/main/resources/guesses/7.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/combsort/GensparkProjects/master/Hangman/src/main/resources/guesses/7.png
--------------------------------------------------------------------------------
/Hangman/src/main/resources/guesses/8.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/combsort/GensparkProjects/master/Hangman/src/main/resources/guesses/8.png
--------------------------------------------------------------------------------
/Hangman/src/main/resources/letters/temp/1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/combsort/GensparkProjects/master/Hangman/src/main/resources/letters/temp/1.png
--------------------------------------------------------------------------------
/Hangman/src/main/resources/letters/temp/2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/combsort/GensparkProjects/master/Hangman/src/main/resources/letters/temp/2.png
--------------------------------------------------------------------------------
/Hangman/src/main/resources/letters/temp/3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/combsort/GensparkProjects/master/Hangman/src/main/resources/letters/temp/3.png
--------------------------------------------------------------------------------
/Hangman/src/main/resources/letters/temp/4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/combsort/GensparkProjects/master/Hangman/src/main/resources/letters/temp/4.png
--------------------------------------------------------------------------------
/Hangman/src/main/resources/letters/temp/5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/combsort/GensparkProjects/master/Hangman/src/main/resources/letters/temp/5.png
--------------------------------------------------------------------------------
/Hangman/src/main/resources/letters/temp/6.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/combsort/GensparkProjects/master/Hangman/src/main/resources/letters/temp/6.png
--------------------------------------------------------------------------------
/Hangman/src/main/resources/letters/temp/7.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/combsort/GensparkProjects/master/Hangman/src/main/resources/letters/temp/7.png
--------------------------------------------------------------------------------
/Hangman/src/main/resources/letters/temp/8.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/combsort/GensparkProjects/master/Hangman/src/main/resources/letters/temp/8.png
--------------------------------------------------------------------------------
/Hangman/src/main/resources/letters/temp/9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/combsort/GensparkProjects/master/Hangman/src/main/resources/letters/temp/9.png
--------------------------------------------------------------------------------
/Hangman/src/main/resources/letters/Untitled.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/combsort/GensparkProjects/master/Hangman/src/main/resources/letters/Untitled.gif
--------------------------------------------------------------------------------
/Hangman/src/main/resources/letters/temp/10.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/combsort/GensparkProjects/master/Hangman/src/main/resources/letters/temp/10.png
--------------------------------------------------------------------------------
/Hangman/src/main/resources/letters/temp/11.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/combsort/GensparkProjects/master/Hangman/src/main/resources/letters/temp/11.png
--------------------------------------------------------------------------------
/Hangman/src/main/resources/letters/temp/12.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/combsort/GensparkProjects/master/Hangman/src/main/resources/letters/temp/12.png
--------------------------------------------------------------------------------
/Hangman/src/main/resources/letters/temp/13.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/combsort/GensparkProjects/master/Hangman/src/main/resources/letters/temp/13.png
--------------------------------------------------------------------------------
/Hangman/src/main/resources/letters/temp/14.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/combsort/GensparkProjects/master/Hangman/src/main/resources/letters/temp/14.png
--------------------------------------------------------------------------------
/Hangman/src/main/resources/letters/temp/15.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/combsort/GensparkProjects/master/Hangman/src/main/resources/letters/temp/15.png
--------------------------------------------------------------------------------
/Hangman/src/main/resources/letters/temp/16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/combsort/GensparkProjects/master/Hangman/src/main/resources/letters/temp/16.png
--------------------------------------------------------------------------------
/Hangman/src/main/resources/letters/temp/17.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/combsort/GensparkProjects/master/Hangman/src/main/resources/letters/temp/17.png
--------------------------------------------------------------------------------
/Hangman/src/main/resources/letters/temp/18.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/combsort/GensparkProjects/master/Hangman/src/main/resources/letters/temp/18.png
--------------------------------------------------------------------------------
/Hangman/src/main/resources/letters/temp/19.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/combsort/GensparkProjects/master/Hangman/src/main/resources/letters/temp/19.png
--------------------------------------------------------------------------------
/Hangman/src/main/resources/letters/temp/20.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/combsort/GensparkProjects/master/Hangman/src/main/resources/letters/temp/20.png
--------------------------------------------------------------------------------
/Hangman/src/main/resources/letters/temp/21.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/combsort/GensparkProjects/master/Hangman/src/main/resources/letters/temp/21.png
--------------------------------------------------------------------------------
/Hangman/src/main/resources/letters/temp/22.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/combsort/GensparkProjects/master/Hangman/src/main/resources/letters/temp/22.png
--------------------------------------------------------------------------------
/Hangman/src/main/resources/letters/temp/23.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/combsort/GensparkProjects/master/Hangman/src/main/resources/letters/temp/23.png
--------------------------------------------------------------------------------
/Hangman/src/main/resources/letters/temp/24.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/combsort/GensparkProjects/master/Hangman/src/main/resources/letters/temp/24.png
--------------------------------------------------------------------------------
/Hangman/src/main/resources/letters/temp/25.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/combsort/GensparkProjects/master/Hangman/src/main/resources/letters/temp/25.png
--------------------------------------------------------------------------------
/Hangman/src/main/resources/letters/temp/26.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/combsort/GensparkProjects/master/Hangman/src/main/resources/letters/temp/26.png
--------------------------------------------------------------------------------
/Hangman/src/main/resources/letters/temp/27.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/combsort/GensparkProjects/master/Hangman/src/main/resources/letters/temp/27.png
--------------------------------------------------------------------------------
/Hangman/src/main/resources/letters/temp/28.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/combsort/GensparkProjects/master/Hangman/src/main/resources/letters/temp/28.png
--------------------------------------------------------------------------------
/Hangman/src/main/resources/letters/temp/29.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/combsort/GensparkProjects/master/Hangman/src/main/resources/letters/temp/29.png
--------------------------------------------------------------------------------
/Hangman/src/main/resources/letters/temp/30.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/combsort/GensparkProjects/master/Hangman/src/main/resources/letters/temp/30.png
--------------------------------------------------------------------------------
/Hangman/src/main/resources/letters/temp/31.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/combsort/GensparkProjects/master/Hangman/src/main/resources/letters/temp/31.png
--------------------------------------------------------------------------------
/Hangman/src/main/resources/letters/temp/32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/combsort/GensparkProjects/master/Hangman/src/main/resources/letters/temp/32.png
--------------------------------------------------------------------------------
/Hangman/src/main/resources/letters/temp/33.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/combsort/GensparkProjects/master/Hangman/src/main/resources/letters/temp/33.png
--------------------------------------------------------------------------------
/Hangman/src/main/resources/letters/temp/34.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/combsort/GensparkProjects/master/Hangman/src/main/resources/letters/temp/34.png
--------------------------------------------------------------------------------
/Hangman/src/main/resources/letters/temp/35.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/combsort/GensparkProjects/master/Hangman/src/main/resources/letters/temp/35.png
--------------------------------------------------------------------------------
/Hangman/src/main/resources/letters/temp/36.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/combsort/GensparkProjects/master/Hangman/src/main/resources/letters/temp/36.png
--------------------------------------------------------------------------------
/Hangman/src/main/resources/letters/temp/37.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/combsort/GensparkProjects/master/Hangman/src/main/resources/letters/temp/37.png
--------------------------------------------------------------------------------
/Hangman/src/main/resources/letters/temp/38.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/combsort/GensparkProjects/master/Hangman/src/main/resources/letters/temp/38.png
--------------------------------------------------------------------------------
/Hangman/src/main/resources/letters/temp/39.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/combsort/GensparkProjects/master/Hangman/src/main/resources/letters/temp/39.png
--------------------------------------------------------------------------------
/Hangman/src/main/resources/letters/temp/40.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/combsort/GensparkProjects/master/Hangman/src/main/resources/letters/temp/40.png
--------------------------------------------------------------------------------
/Hangman/src/main/resources/letters/temp/41.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/combsort/GensparkProjects/master/Hangman/src/main/resources/letters/temp/41.png
--------------------------------------------------------------------------------
/Hangman/src/main/resources/letters/temp/42.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/combsort/GensparkProjects/master/Hangman/src/main/resources/letters/temp/42.png
--------------------------------------------------------------------------------
/Hangman/src/main/resources/letters/temp/43.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/combsort/GensparkProjects/master/Hangman/src/main/resources/letters/temp/43.png
--------------------------------------------------------------------------------
/Hangman/src/main/resources/letters/temp/44.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/combsort/GensparkProjects/master/Hangman/src/main/resources/letters/temp/44.png
--------------------------------------------------------------------------------
/Hangman/src/main/resources/letters/temp/45.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/combsort/GensparkProjects/master/Hangman/src/main/resources/letters/temp/45.png
--------------------------------------------------------------------------------
/Hangman/src/main/resources/letters/temp/46.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/combsort/GensparkProjects/master/Hangman/src/main/resources/letters/temp/46.png
--------------------------------------------------------------------------------
/Hangman/src/main/resources/letters/temp/47.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/combsort/GensparkProjects/master/Hangman/src/main/resources/letters/temp/47.png
--------------------------------------------------------------------------------
/Hangman/src/main/resources/letters/temp/48.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/combsort/GensparkProjects/master/Hangman/src/main/resources/letters/temp/48.png
--------------------------------------------------------------------------------
/Hangman/src/main/resources/letters/temp/49.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/combsort/GensparkProjects/master/Hangman/src/main/resources/letters/temp/49.png
--------------------------------------------------------------------------------
/Hangman/src/main/resources/letters/temp/50.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/combsort/GensparkProjects/master/Hangman/src/main/resources/letters/temp/50.png
--------------------------------------------------------------------------------
/Hangman/src/main/resources/letters/temp/51.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/combsort/GensparkProjects/master/Hangman/src/main/resources/letters/temp/51.png
--------------------------------------------------------------------------------
/Hangman/src/main/resources/letters/temp/52.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/combsort/GensparkProjects/master/Hangman/src/main/resources/letters/temp/52.png
--------------------------------------------------------------------------------
/HumansVsGoblins/src/main/java/ui/display/Display.java:
--------------------------------------------------------------------------------
1 | package ui.display;
2 |
3 | public interface Display {
4 |
5 | String display(Displayable displayable);
6 |
7 | }
8 |
--------------------------------------------------------------------------------
/section8/CreateAFile.java:
--------------------------------------------------------------------------------
1 | package genspark.assignments.section8;
2 |
3 | import genspark.assignments.Assignment;
4 |
5 | public class CreateAFile implements Assignment {
6 | }
7 |
--------------------------------------------------------------------------------
/HumansVsGoblins/src/main/java/interactable/Interactable.java:
--------------------------------------------------------------------------------
1 | package interactable;
2 |
3 | public interface Interactable {
4 |
5 | void interact();
6 | char getSymbol();
7 |
8 | }
9 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/DragonCave/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Hangman/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/NumberGuess/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/HumansVsGoblins/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/HumansVsGoblins/src/main/java/game/turn/logic/TurnLogic.java:
--------------------------------------------------------------------------------
1 | package game.turn.logic;
2 |
3 | import interactable.creature.Creature;
4 |
5 | public interface TurnLogic {
6 |
7 | Creature nextTurn();
8 |
9 | }
10 |
--------------------------------------------------------------------------------
/SpringBootAssign1/target/classes/com/genspark/SpringBootAssign1/Entity/Course.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/combsort/GensparkProjects/master/SpringBootAssign1/target/classes/com/genspark/SpringBootAssign1/Entity/Course.class
--------------------------------------------------------------------------------
/SpringBootAssign1/target/classes/com/genspark/SpringBootAssign1/Entity/Employee.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/combsort/GensparkProjects/master/SpringBootAssign1/target/classes/com/genspark/SpringBootAssign1/Entity/Employee.class
--------------------------------------------------------------------------------
/SpringBootAssign1/target/classes/com/genspark/SpringBootAssign1/Service/CourseService.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/combsort/GensparkProjects/master/SpringBootAssign1/target/classes/com/genspark/SpringBootAssign1/Service/CourseService.class
--------------------------------------------------------------------------------
/SpringBootAssign1/target/classes/com/genspark/SpringBootAssign1/Controller/MyController.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/combsort/GensparkProjects/master/SpringBootAssign1/target/classes/com/genspark/SpringBootAssign1/Controller/MyController.class
--------------------------------------------------------------------------------
/SpringBootAssign1/target/classes/com/genspark/SpringBootAssign1/Service/CourseServiceImpl.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/combsort/GensparkProjects/master/SpringBootAssign1/target/classes/com/genspark/SpringBootAssign1/Service/CourseServiceImpl.class
--------------------------------------------------------------------------------
/SpringBootAssign1/target/classes/com/genspark/SpringBootAssign1/Service/EmployeeService.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/combsort/GensparkProjects/master/SpringBootAssign1/target/classes/com/genspark/SpringBootAssign1/Service/EmployeeService.class
--------------------------------------------------------------------------------
/HumansVsGoblins/src/main/java/Main.java:
--------------------------------------------------------------------------------
1 | import game.Game;
2 |
3 | public class Main {
4 |
5 |
6 |
7 | public static void main(String[] args) {
8 | Game game = new Game();
9 | game.runGame();
10 |
11 | }
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/SpringBootAssign1/target/classes/com/genspark/SpringBootAssign1/Service/EmployeeServiceImpl.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/combsort/GensparkProjects/master/SpringBootAssign1/target/classes/com/genspark/SpringBootAssign1/Service/EmployeeServiceImpl.class
--------------------------------------------------------------------------------
/SpringBootAssign1/target/classes/com/genspark/SpringBootAssign1/SpringBootAssign1Application.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/combsort/GensparkProjects/master/SpringBootAssign1/target/classes/com/genspark/SpringBootAssign1/SpringBootAssign1Application.class
--------------------------------------------------------------------------------
/HumansVsGoblins/src/main/java/game/turn/logic/start/Start.java:
--------------------------------------------------------------------------------
1 | package game.turn.logic.start;
2 |
3 | import game.Roster;
4 | import interactable.creature.Creature;
5 |
6 | public interface Start {
7 |
8 | Creature start(Roster roster);
9 |
10 | }
11 |
--------------------------------------------------------------------------------
/SpringBootAssign1/target/test-classes/com/genspark/SpringBootAssign1/SpringBootDemoAppApplicationTests.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/combsort/GensparkProjects/master/SpringBootAssign1/target/test-classes/com/genspark/SpringBootAssign1/SpringBootDemoAppApplicationTests.class
--------------------------------------------------------------------------------
/HumansVsGoblins/src/main/java/game/BattleManager.java:
--------------------------------------------------------------------------------
1 | package game;
2 |
3 | import interactable.creature.Creature;
4 | import interactable.creature.CreatureConcrete;
5 |
6 | public interface BattleManager {
7 |
8 | void doBattle(Creature c1, Creature c2);
9 |
10 | }
11 |
--------------------------------------------------------------------------------
/HumansVsGoblins/src/main/java/game/board/Holder.java:
--------------------------------------------------------------------------------
1 | package game.board;
2 |
3 | import interactable.Interactable;
4 |
5 | import java.util.List;
6 |
7 | public interface Holder {
8 |
9 | List getContents();
10 | List prioritizeContents();
11 | }
12 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/HumansVsGoblins/src/main/java/game/turn/logic/start/math/MathStart.java:
--------------------------------------------------------------------------------
1 | package game.turn.logic.start.math;
2 |
3 | import game.Roster;
4 | import interactable.creature.Creature;
5 |
6 | import java.util.List;
7 |
8 | public interface MathStart {
9 |
10 | int calculate(List creatures);
11 |
12 | }
13 |
--------------------------------------------------------------------------------
/Hangman/src/main/java/Counter.java:
--------------------------------------------------------------------------------
1 | public class Counter {
2 | public int getValue() {
3 | return value;
4 | }
5 |
6 | public void setValue(int value) {
7 | this.value = value;
8 | }
9 |
10 | private int value;
11 |
12 | public void incrementValue(){
13 | this.value++;
14 | }
15 |
16 | }
17 |
--------------------------------------------------------------------------------
/HumansVsGoblins/src/main/java/game/turn/logic/start/FirstStart.java:
--------------------------------------------------------------------------------
1 | package game.turn.logic.start;
2 |
3 | import game.Roster;
4 | import interactable.creature.Creature;
5 |
6 | public class FirstStart implements Start {
7 |
8 | public Creature start(Roster roster){
9 | return roster.getCreatures().get(0);
10 | }
11 |
12 | }
13 |
--------------------------------------------------------------------------------
/HumansVsGoblins/src/main/java/game/conditional/Conditional.java:
--------------------------------------------------------------------------------
1 | package game.conditional;
2 |
3 | import interactable.creature.Creature;
4 |
5 | import java.util.Collection;
6 | import java.util.ArrayList;
7 | import java.util.List;
8 |
9 | public interface Conditional {
10 |
11 | List qualified(List roster);
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/NumberGuess/src/test/java/MainTest.java:
--------------------------------------------------------------------------------
1 | import static org.junit.jupiter.api.Assertions.*;
2 |
3 | class MainTest {
4 |
5 | @org.junit.jupiter.api.Test
6 | void getResult() {
7 | assertEquals(Main.LOW, Main.getResult(1,2));
8 | assertEquals(Main.HIGH, Main.getResult(15,9));
9 | assertEquals(Main.CORRECT, Main.getResult(3,3));
10 | }
11 | }
--------------------------------------------------------------------------------
/section8/OutgoingCallsFromBangalore.java:
--------------------------------------------------------------------------------
1 | package genspark.assignments.section8;
2 |
3 | import genspark.assignments.Assignment;
4 | import java.io.IOException;
5 |
6 | public class OutgoingCallsFromBangalore implements Assignment {
7 | public String solution() throws IOException {
8 | // ↓↓↓↓ your code goes here ↓↓↓↓
9 | return null;
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/.idea/GensparkProjects.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/SpringBootAssign1/src/test/java/com/genspark/SpringBootAssign1/SpringBootDemoAppApplicationTests.java:
--------------------------------------------------------------------------------
1 | package com.genspark.SpringBootAssign1;
2 |
3 | import org.junit.jupiter.api.Test;
4 | import org.springframework.boot.test.context.SpringBootTest;
5 |
6 | @SpringBootTest
7 | class SpringBootDemoAppApplicationTests {
8 |
9 | @Test
10 | void contextLoads() {
11 | }
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/HumansVsGoblins/src/main/java/interactable/creature/Creature.java:
--------------------------------------------------------------------------------
1 | package interactable.creature;
2 |
3 | import interactable.Interactable;
4 |
5 | public interface Creature extends Interactable {
6 |
7 | int getMoveDistance(char moveDirection);
8 | void loot();
9 | String getName();
10 | int attack(Creature c);
11 | void setHealth(int h);
12 | int getHealth();
13 |
14 | }
15 |
--------------------------------------------------------------------------------
/DragonCave/src/test/java/MainTest.java:
--------------------------------------------------------------------------------
1 | import static org.junit.jupiter.api.Assertions.*;
2 |
3 | class MainTest {
4 |
5 | @org.junit.jupiter.api.Test
6 | void dragonCave() {
7 | try{
8 | assertEquals(Main.GOOD_END, Main.dragonCave(1));
9 | assertEquals(Main.BAD_END, Main.dragonCave(2));
10 | }
11 | catch(Exception e){
12 | System.out.println(Main.INVALID);
13 | }
14 | }
15 | }
--------------------------------------------------------------------------------
/Hangman/src/main/java/Main.java:
--------------------------------------------------------------------------------
1 | import java.io.File;
2 | import java.io.IOException;
3 | import java.util.ArrayList;
4 | import java.util.Scanner;
5 |
6 | /**
7 | * Created by Ryan on 9/23/2017.
8 | */
9 |
10 | public class Main {
11 | public static void main(String[] args){
12 | UserInterface ui = new UserInterface();
13 | HangmanGame game = new HangmanGame();
14 | UserInput input = new UserInput(ui);
15 | game.gameLoop(ui, input);
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/SpringBootAssign1/src/main/java/com/genspark/SpringBootAssign1/SpringBootAssign1Application.java:
--------------------------------------------------------------------------------
1 | package com.genspark.SpringBootAssign1;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 |
6 | @SpringBootApplication
7 | public class SpringBootAssign1Application {
8 |
9 | public static void main(String[] args) {
10 | SpringApplication.run(SpringBootAssign1Application.class, args);
11 | }
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/SpringBootAssign1/src/main/java/com/genspark/SpringBootAssign1/Service/CourseService.java:
--------------------------------------------------------------------------------
1 | package com.genspark.SpringBootAssign1.Service;
2 |
3 | import com.genspark.SpringBootAssign1.Entity.Course;
4 |
5 | import java.util.List;
6 |
7 | public interface CourseService {
8 |
9 | List getAllCourses();
10 | Course getByCourseId(int id);
11 | Course addCourse(Course course);
12 | Course updateCourse(Course course);
13 | Course deleteCourse(int courseId);
14 |
15 | }
16 |
--------------------------------------------------------------------------------
/HumansVsGoblins/src/main/java/ui/display/TileDisplay.java:
--------------------------------------------------------------------------------
1 | package ui.display;
2 |
3 | import game.board.Tile;
4 |
5 | public class TileDisplay {
6 |
7 | public TileDisplay(){};
8 |
9 | public String display(Tile tile){
10 | try {
11 | return ""+tile.prioritizeContents().get(0).getSymbol();
12 | }
13 | catch (IndexOutOfBoundsException e){
14 | // empty tile
15 | return tile.isPassableTerrain() ? "-" : "#";
16 | }
17 | }
18 |
19 | }
20 |
--------------------------------------------------------------------------------
/SpringBootAssign1/src/main/java/com/genspark/SpringBootAssign1/Service/EmployeeService.java:
--------------------------------------------------------------------------------
1 | package com.genspark.SpringBootAssign1.Service;
2 |
3 | import com.genspark.SpringBootAssign1.Entity.Employee;
4 |
5 | import java.util.List;
6 |
7 | public interface EmployeeService {
8 |
9 |
10 | List getAllEmployees();
11 | Employee getByEmployeeId(int id);
12 | Employee addEmployee(Employee employee);
13 | Employee updateEmployee(Employee employee);
14 | Employee deleteEmployee(int employeeId);
15 |
16 | }
17 |
--------------------------------------------------------------------------------
/HumansVsGoblins/src/main/java/game/Roster.java:
--------------------------------------------------------------------------------
1 | package game;
2 |
3 | import interactable.creature.Creature;
4 |
5 | import java.util.Collection;
6 | import java.util.ArrayList;
7 |
8 | public class Roster {
9 |
10 | private ArrayList creatures;
11 |
12 | public Roster(){
13 | creatures = new ArrayList();
14 | }
15 |
16 | public ArrayList getCreatures() {
17 | return creatures;
18 | }
19 |
20 | public void addCreature(Creature creature) {
21 | this.creatures.add(creature);
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Hangman/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/Hangman/.idea/compiler.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/DragonCave/.idea/compiler.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/DragonCave/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/NumberGuess/.idea/compiler.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/HumansVsGoblins/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/NumberGuess/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/HumansVsGoblins/.idea/compiler.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/HumansVsGoblins/src/main/java/interactable/creature/Goblin.java:
--------------------------------------------------------------------------------
1 | package interactable.creature;
2 |
3 | import interactable.Interactable;
4 |
5 | public class Goblin extends CreatureConcrete {
6 |
7 | public Goblin() {
8 | this.name = "Goblin";
9 | }
10 |
11 | @Override
12 | public int getMoveDistance(char direction){
13 | return 1;
14 | }
15 |
16 | @Override
17 | public void loot(){
18 |
19 | }
20 |
21 |
22 | @Override
23 | public void interact(){
24 |
25 | }
26 |
27 | @Override
28 | public char getSymbol(){
29 | return 'o';
30 | }
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/HumansVsGoblins/src/main/java/interactable/creature/Human.java:
--------------------------------------------------------------------------------
1 | package interactable.creature;
2 |
3 | import interactable.Interactable;
4 |
5 | public class Human extends CreatureConcrete {
6 |
7 | public Human(){
8 | super();
9 | this.name = "Human";
10 | }
11 |
12 | @Override
13 | public int getMoveDistance(char direction){
14 | return 1;
15 | }
16 |
17 | @Override
18 | public void loot() {
19 |
20 | }
21 |
22 | @Override
23 | public void interact() {
24 |
25 | }
26 |
27 | @Override
28 | public char getSymbol(){
29 | return '@';
30 | }
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/HumansVsGoblins/src/main/java/game/turn/logic/AlwaysFirst.java:
--------------------------------------------------------------------------------
1 | package game.turn.logic;
2 |
3 | import game.Roster;
4 | import game.turn.logic.start.FirstStart;
5 | import game.turn.logic.start.Start;
6 | import game.turn.logic.start.math.RandomStart;
7 | import interactable.creature.Creature;
8 |
9 | public class AlwaysFirst implements TurnLogic{
10 |
11 | private Start start;
12 | private Roster roster;
13 |
14 | public AlwaysFirst(Roster roster){
15 | start = new FirstStart();
16 | this.roster = roster;
17 | }
18 |
19 | public Creature nextTurn(){
20 | return roster.getCreatures().get(0);
21 | }
22 |
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/HumansVsGoblins/src/main/java/game/turn/logic/PlayersHuman.java:
--------------------------------------------------------------------------------
1 | package game.turn.logic;
2 |
3 | import game.Roster;
4 | import game.turn.logic.start.Start;
5 | import game.turn.logic.start.math.RandomStart;
6 | import interactable.creature.Creature;
7 |
8 | public class PlayersHuman implements TurnLogic{
9 |
10 | private Start start;
11 | private Roster roster;
12 |
13 | public PlayersHuman(Roster roster){
14 | start = new RandomStart();
15 | this.roster = roster;
16 | }
17 |
18 | public Creature nextTurn(){
19 | // TODO: implement human-only logic
20 | return roster.getCreatures().get(0);
21 | }
22 |
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/HumansVsGoblins/src/main/java/game/conditional/HumansOnly.java:
--------------------------------------------------------------------------------
1 | package game.conditional;
2 |
3 | import java.util.Collection;
4 | import java.util.List;
5 | import java.util.ArrayList;
6 |
7 | import interactable.creature.Creature;
8 | import interactable.creature.Human;
9 |
10 | public class HumansOnly implements Conditional{
11 |
12 | public List qualified(List creatures){
13 | ArrayList qualifiedIndexes = new ArrayList<>();
14 | for (int i = 0; i < creatures.size(); i++){
15 | if (creatures.get(i) instanceof Human) qualifiedIndexes.add(i);
16 | }
17 | return qualifiedIndexes;
18 | }
19 |
20 | }
21 |
--------------------------------------------------------------------------------
/Hangman/.idea/libraries/junit.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/HumansVsGoblins/src/main/java/game/turn/logic/start/math/RandomStart.java:
--------------------------------------------------------------------------------
1 | package game.turn.logic.start.math;
2 |
3 | import game.Roster;
4 | import game.turn.logic.start.Start;
5 | import interactable.creature.Creature;
6 |
7 | import java.util.List;
8 | import java.util.concurrent.ThreadLocalRandom;
9 |
10 | public class RandomStart implements MathStart, Start {
11 |
12 | public int calculate(List creatures){
13 | return ThreadLocalRandom.current().nextInt(0, creatures.size());
14 | }
15 |
16 | public Creature start(Roster roster){
17 | int index = calculate(roster.getCreatures());
18 | return roster.getCreatures().get(index);
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/HumansVsGoblins/src/main/java/ui/display/BoardDisplay.java:
--------------------------------------------------------------------------------
1 | package ui.display;
2 |
3 | import game.board.Board;
4 | import game.board.Tile;
5 |
6 | import java.util.ArrayList;
7 |
8 | public class BoardDisplay implements Display{
9 |
10 |
11 | public BoardDisplay(){
12 | }
13 |
14 | public String display(Displayable displayable){
15 | Board board = (Board) displayable;
16 |
17 | StringBuilder sb = new StringBuilder();
18 | ArrayList> grid = board.getGrid();
19 | TileDisplay td = new TileDisplay();
20 |
21 | for (int y = 0; y < grid.size(); y++){
22 | ArrayList row = grid.get(y);
23 | for (int x = 0; x < row.size(); x++){
24 | sb.append(td.display(row.get(x)));
25 | }
26 | sb.append('\n');
27 | }
28 |
29 | return sb.toString();
30 | }
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/DragonCave/.idea/jarRepositories.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/Hangman/.idea/jarRepositories.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/NumberGuess/.idea/jarRepositories.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/HumansVsGoblins/.idea/jarRepositories.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/SpringBootAssign1/HELP.md:
--------------------------------------------------------------------------------
1 | # Getting Started
2 |
3 | ### Reference Documentation
4 | For further reference, please consider the following sections:
5 |
6 | * [Official Apache Maven documentation](https://maven.apache.org/guides/index.html)
7 | * [Spring Boot Maven Plugin Reference Guide](https://docs.spring.io/spring-boot/docs/2.6.6/maven-plugin/reference/html/)
8 | * [Create an OCI image](https://docs.spring.io/spring-boot/docs/2.6.6/maven-plugin/reference/html/#build-image)
9 | * [Spring Web](https://docs.spring.io/spring-boot/docs/2.6.6/reference/htmlsingle/#boot-features-developing-web-applications)
10 |
11 | ### Guides
12 | The following guides illustrate how to use some features concretely:
13 |
14 | * [Building a RESTful Web Service](https://spring.io/guides/gs/rest-service/)
15 | * [Serving Web Content with Spring MVC](https://spring.io/guides/gs/serving-web-content/)
16 | * [Building REST services with Spring](https://spring.io/guides/tutorials/bookmarks/)
17 |
18 |
--------------------------------------------------------------------------------
/HumansVsGoblins/src/main/java/game/turn/TurnTracker.java:
--------------------------------------------------------------------------------
1 | package game.turn;
2 |
3 | import game.Roster;
4 | import game.turn.logic.AlwaysFirst;
5 | import game.turn.logic.PlayersHuman;
6 | import game.turn.logic.TurnLogic;
7 | import interactable.creature.Creature;
8 |
9 | public class TurnTracker {
10 |
11 | private TurnLogic turnLogic;
12 | private Roster roster;
13 | private Creature activeCreature;
14 |
15 | public TurnTracker(Roster roster){
16 | turnLogic = new AlwaysFirst(roster);
17 | this.roster = roster;
18 | activeCreature = turnLogic.nextTurn();
19 | }
20 |
21 | public Creature getActiveCreature() {
22 | return activeCreature;
23 | }
24 | public void setActiveCreature(Creature activeCreature) {
25 | this.activeCreature = activeCreature;
26 | }
27 |
28 | public Creature nextTurn(){
29 | Creature active = turnLogic.nextTurn();
30 | activeCreature = active;
31 | return active;
32 | }
33 |
34 | }
35 |
--------------------------------------------------------------------------------
/Hangman/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 4.0.0
6 |
7 | org.example
8 | Hangman
9 | 1.0-SNAPSHOT
10 |
11 |
12 | junit
13 | junit
14 | RELEASE
15 | test
16 |
17 |
18 | org.junit.jupiter
19 | junit-jupiter
20 | 5.8.2
21 | test
22 |
23 |
24 |
25 |
26 | 11
27 | 11
28 |
29 |
30 |
--------------------------------------------------------------------------------
/DragonCave/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 4.0.0
6 |
7 | org.example
8 | DragonCave
9 | 1.0-SNAPSHOT
10 |
11 |
12 | junit
13 | junit
14 | RELEASE
15 | test
16 |
17 |
18 | org.junit.jupiter
19 | junit-jupiter
20 | RELEASE
21 | test
22 |
23 |
24 |
25 |
26 | 11
27 | 11
28 |
29 |
30 |
--------------------------------------------------------------------------------
/NumberGuess/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 4.0.0
6 |
7 | org.example
8 | NumberGuess
9 | 1.0-SNAPSHOT
10 |
11 |
12 | junit
13 | junit
14 | RELEASE
15 | test
16 |
17 |
18 | org.junit.jupiter
19 | junit-jupiter
20 | RELEASE
21 | test
22 |
23 |
24 |
25 |
26 | 11
27 | 11
28 |
29 |
30 |
--------------------------------------------------------------------------------
/HumansVsGoblins/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 4.0.0
6 |
7 | org.example
8 | HumansVsGoblins
9 | 1.0-SNAPSHOT
10 |
11 |
12 | junit
13 | junit
14 | RELEASE
15 | test
16 |
17 |
18 | org.junit.jupiter
19 | junit-jupiter
20 | RELEASE
21 | test
22 |
23 |
24 |
25 |
26 | 11
27 | 11
28 |
29 |
30 |
--------------------------------------------------------------------------------
/section8/Call.java:
--------------------------------------------------------------------------------
1 | package genspark.assignments.section8;
2 |
3 | public class Call {
4 | private final String calling;
5 | private final String receiving;
6 | private final String start;
7 | private final int duration;
8 |
9 | public Call(String calling, String receiving, String start, String duration) {
10 | this.calling = calling;
11 | this.receiving = receiving;
12 | this.start = start;
13 | this.duration = Integer.parseInt(duration);
14 | }
15 |
16 | public String getCalling() {
17 | return calling;
18 | }
19 |
20 | public String getReceiving() {
21 | return receiving;
22 | }
23 |
24 | public String getStart() {
25 | return start;
26 | }
27 |
28 | public int getDuration() {
29 | return duration;
30 | }
31 |
32 | @Override
33 | public String toString() {
34 | return "Call{" +
35 | "calling='" + calling + '\'' +
36 | ", receiving='" + receiving + '\'' +
37 | ", start='" + start + '\'' +
38 | ", duration='" + duration + '\'' +
39 | '}';
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/HumansVsGoblins/src/test/java/game/conditional/HumansOnlyTest.java:
--------------------------------------------------------------------------------
1 | package game.conditional;
2 |
3 | import java.util.ArrayList;
4 |
5 | import interactable.creature.Creature;
6 | import interactable.creature.Goblin;
7 | import interactable.creature.Human;
8 |
9 | import static org.junit.jupiter.api.Assertions.*;
10 |
11 | class HumansOnlyTest {
12 |
13 | @org.junit.jupiter.api.Test
14 | void qualified() {
15 | Goblin goblin1 = new Goblin();
16 | Goblin goblin2 = new Goblin();
17 | Goblin goblin3 = new Goblin();
18 | Human human1 = new Human();
19 | Human human2 = new Human();
20 | ArrayList creatures = new ArrayList<>();
21 | creatures.add(goblin1);
22 | creatures.add(goblin2);
23 | creatures.add(goblin3);
24 | creatures.add(human1);
25 | creatures.add(human2);
26 |
27 | HumansOnly humansOnly = new HumansOnly();
28 | ArrayList indeces = (ArrayList) humansOnly.qualified(creatures);
29 |
30 | assertEquals(2, indeces.size());
31 | assertEquals(creatures.get(indeces.get(0)), human1);
32 | assertEquals(creatures.get(indeces.get(1)), human2);
33 |
34 | }
35 | }
--------------------------------------------------------------------------------
/HumansVsGoblins/src/main/java/ui/UserInterface.java:
--------------------------------------------------------------------------------
1 | package ui;
2 |
3 | import game.board.Board;
4 | import interactable.creature.Creature;
5 | import ui.display.BoardDisplay;
6 | import ui.display.Displayable;
7 |
8 | public class UserInterface {
9 |
10 | public static final String QUIT_KEY = "q";
11 | private BoardDisplay boardDisplay;
12 |
13 | public UserInterface(){
14 | this.boardDisplay = new BoardDisplay();
15 | }
16 |
17 | public void renderBoard(Board board){
18 | System.out.print(boardDisplay.display(board));
19 | }
20 |
21 | // messages
22 | public String movementPrompt(){
23 | return "Enter n/s/e/w to move";
24 | }
25 | public String tier1Prompt(){
26 | return "Options: m to move, l to loot, or q to quit";
27 | }
28 | public String battleResultMsg(Creature c1, Creature c2, int dmg) {
29 | return String.format("%s strikes %s for %s damage",
30 | c1.getName(),
31 | c2.getName(),
32 | dmg);
33 | }
34 | public String creatureDeathMsg(Creature c){
35 | return String.format("%s has died.", c.getName());
36 | }
37 |
38 |
39 | public void displayMessage(String s){
40 | System.out.println(s);
41 | }
42 |
43 | }
44 |
--------------------------------------------------------------------------------
/Hangman/src/main/java/UserInput.java:
--------------------------------------------------------------------------------
1 | import java.util.Scanner;
2 |
3 | public class UserInput {
4 |
5 | Scanner scanner;
6 | UserInterface ui;
7 |
8 | UserInput(UserInterface ui){
9 | scanner = new Scanner(System.in);
10 | this.ui = ui;
11 | }
12 |
13 | public class StringLengthException extends Exception{
14 | public StringLengthException(String errorMessage) {
15 | super(errorMessage);
16 | }
17 | }
18 |
19 | public char getCharInput(){
20 | try{
21 | String input = getInput();
22 | if (input.length() > 1) throw new StringLengthException("String input too long");
23 | if (input.length() == 0) throw new StringLengthException("No character provided");
24 | return input.charAt(0);
25 | }
26 | catch(StringLengthException e){
27 | ui.display(ui.singleCharPrompt());
28 | return getCharInput();
29 | }
30 | }
31 |
32 | public String getInput(){
33 | try{
34 | String input = scanner.nextLine();
35 | return input;
36 | }
37 | catch(Exception e){
38 | System.out.printf(String.format("Input error: %s", e.getMessage()));
39 | return getInput();
40 | }
41 | }
42 |
43 | }
44 |
--------------------------------------------------------------------------------
/SpringBootAssign1/src/main/java/com/genspark/SpringBootAssign1/Entity/Employee.java:
--------------------------------------------------------------------------------
1 | package com.genspark.SpringBootAssign1.Entity;
2 |
3 | public class Employee {
4 |
5 | private int employeeId;
6 | private String name;
7 | private String email;
8 |
9 | public Employee() {
10 | }
11 |
12 | public Employee(int employeeId, String name, String email) {
13 | this.employeeId = employeeId;
14 | this.name = name;
15 | this.email = email;
16 | }
17 |
18 | public int getEmployeeId() {
19 | return employeeId;
20 | }
21 |
22 | public void setEmployeeId(int employeeId) {
23 | this.employeeId = employeeId;
24 | }
25 |
26 | public String getName() {
27 | return name;
28 | }
29 |
30 | public void setName(String name) {
31 | this.name = name;
32 | }
33 |
34 | public String getEmail() {
35 | return email;
36 | }
37 |
38 | public void setEmail(String email) {
39 | this.email = email;
40 | }
41 |
42 | @Override
43 | public String toString() {
44 | return "Employee{" +
45 | "employeeId=" + employeeId +
46 | ", name='" + name + '\'' +
47 | ", email='" + email + '\'' +
48 | '}';
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/SpringBootAssign1/src/main/java/com/genspark/SpringBootAssign1/Entity/Course.java:
--------------------------------------------------------------------------------
1 | package com.genspark.SpringBootAssign1.Entity;
2 |
3 | public class Course {
4 |
5 | private int courseId;
6 | private String title;
7 | private String instructor;
8 |
9 | public Course() {
10 | }
11 |
12 | public Course(int courseId, String title, String instructor) {
13 | this.courseId = courseId;
14 | this.title = title;
15 | this.instructor = instructor;
16 | }
17 |
18 | public int getCourseId() {
19 | return courseId;
20 | }
21 |
22 | public void setCourseId(int courseId) {
23 | this.courseId = courseId;
24 | }
25 |
26 | public String getTitle() {
27 | return title;
28 | }
29 |
30 | public void setTitle(String title) {
31 | this.title = title;
32 | }
33 |
34 | public String getInstructor() {
35 | return instructor;
36 | }
37 |
38 | public void setInstructor(String instructor) {
39 | this.instructor = instructor;
40 | }
41 |
42 | @Override
43 | public String toString() {
44 | return "Course{" +
45 | "courseId=" + courseId +
46 | ", title='" + title + '\'' +
47 | ", instructor='" + instructor + '\'' +
48 | '}';
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/SpringBootAssign1/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 |
6 | org.springframework.boot
7 | spring-boot-starter-parent
8 | 2.6.6
9 |
10 |
11 | com.genspark
12 | SpringBootDemoApp
13 | 0.0.1-SNAPSHOT
14 | SpringBootDemoApp
15 | Demo project for Spring Boot
16 |
17 | 11
18 |
19 |
20 |
21 | org.springframework.boot
22 | spring-boot-starter-web
23 |
24 |
25 |
26 | org.springframework.boot
27 | spring-boot-starter-test
28 | test
29 |
30 |
31 |
32 |
33 |
34 |
35 | org.springframework.boot
36 | spring-boot-maven-plugin
37 |
38 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/Hangman/src/main/java/FileIO.java:
--------------------------------------------------------------------------------
1 | import java.io.BufferedWriter;
2 | import java.io.File;
3 | import java.io.IOException;
4 | import java.nio.file.Files;
5 | import java.nio.file.Path;
6 | import java.nio.file.Paths;
7 | import java.nio.file.StandardOpenOption;
8 | import java.util.ArrayList;
9 | import java.util.Scanner;
10 |
11 | public class FileIO {
12 | public static final String SCORE_PATH = "C:\\GensparkProjects\\GensparkProjects\\Hangman\\src\\main\\resources\\scores.txt";
13 | public static final String MAN_PATH = "C:\\GensparkProjects\\GensparkProjects\\Hangman\\src\\main\\resources\\hangman_ascii.txt";
14 |
15 | public ArrayList getFileLines(String path){
16 | File file = new File(path);
17 | ArrayList contents = new ArrayList<>();
18 | try (Scanner scanner = new Scanner(file)) {
19 | while (scanner.hasNext()) {
20 | String next = scanner.nextLine();
21 | contents.add(next);
22 | }
23 | } catch (IOException e) {
24 | System.out.println("Failure opening file: " + e.getMessage());
25 | }
26 | return contents;
27 | }
28 |
29 | public void appendLineToFile(String path, String line){
30 | Path p = Paths.get(path);
31 | try (BufferedWriter writer = Files.newBufferedWriter(p, StandardOpenOption.APPEND)) {
32 | writer.write(line+'\n');
33 | } catch (IOException ioe) {
34 | System.err.format("IOException: %s%n", ioe);
35 | }
36 | }
37 |
38 | public void recordScore(String name, int score){
39 | appendLineToFile(SCORE_PATH, String.format("%s,%s",name,score));
40 | }
41 |
42 | }
43 |
--------------------------------------------------------------------------------
/Hangman/src/test/java/UserInterfaceTest.java:
--------------------------------------------------------------------------------
1 | import org.junit.jupiter.api.AfterEach;
2 | import org.junit.jupiter.api.Assertions;
3 | import org.junit.jupiter.api.BeforeEach;
4 | import org.junit.jupiter.api.Test;
5 |
6 | import java.util.ArrayList;
7 |
8 | import static org.junit.jupiter.api.Assertions.*;
9 |
10 | class UserInterfaceTest {
11 |
12 | UserInterface ui;
13 |
14 | @BeforeEach
15 | void setUp() {
16 | this.ui = new UserInterface();
17 | }
18 |
19 | @Test
20 | void buildGallows() {
21 | System.out.println("0\n%s".format(ui.buildGallows(0)));
22 | System.out.println("1\n%s".format(ui.buildGallows(1)));
23 | System.out.println("2\n%s".format(ui.buildGallows(2)));
24 | System.out.println("3\n%s".format(ui.buildGallows(3)));
25 | System.out.println("4\n%s".format(ui.buildGallows(4)));
26 | System.out.println("5\n%s".format(ui.buildGallows(5)));
27 | System.out.println("6\n%s".format(ui.buildGallows(6)));
28 | System.out.println("7\n%s".format(ui.buildGallows(7)));
29 | System.out.println("8\n%s".format(ui.buildGallows(8)));
30 | System.out.println("9\n%s".format(ui.buildGallows(9)));
31 | System.out.println("10\n%s".format(ui.buildGallows(10)));
32 | System.out.println("11\n%s".format(ui.buildGallows(11)));
33 | System.out.println("12\n%s".format(ui.buildGallows(12)));
34 | }
35 |
36 | @Test
37 | void guessedString() {
38 | ArrayList guessed = new ArrayList();
39 | Assertions.assertEquals("", ui.guessedString("",guessed));
40 | guessed.add('a');
41 | Assertions.assertEquals("_ a _", ui.guessedString("cat",guessed));
42 | guessed.add('c');
43 | guessed.add('t');
44 | Assertions.assertEquals("c a t", ui.guessedString("cat",guessed));
45 | }
46 | }
--------------------------------------------------------------------------------
/DragonCave/src/main/java/Main.java:
--------------------------------------------------------------------------------
1 | import java.util.Scanner;
2 |
3 | public class Main {
4 |
5 | public static final String INTRO = "You are in a land full of dragons. In front of you, you see two caves. In one cave, the dragon is friendly and will share his treasure with you. The other dragon is greedy and will eat you on sight. Which cave do you go into? (1 or 2)";
6 | public static final String BAD_END = "You approach the cave and get eaten!";
7 | public static final String GOOD_END = "You approach the cave and get treasure!";
8 | public static final String INVALID = "Invalid dragonCave option";
9 | public static final String VALID_OPTIONS = "Options: 1 or 2";
10 |
11 | public static String dragonCave(int option) throws Exception{
12 | if (option == 1){
13 | return GOOD_END;
14 | }
15 | else if (option == 2){
16 | return BAD_END;
17 | }
18 | else throw new Exception(INVALID);
19 | }
20 |
21 | public static int getIntegerOption(Scanner scanner){
22 | while(true){
23 | String optionString = scanner.nextLine();
24 | try{
25 | int option = Integer.parseInt(optionString);
26 | return option;
27 | }
28 | catch(Exception e){
29 | System.out.println(VALID_OPTIONS);
30 | continue;
31 | }
32 | }
33 | }
34 |
35 | public static void main(String[] args) {
36 | System.out.println(INTRO);
37 | Scanner in = new Scanner(System.in);
38 |
39 | while(true){
40 | int option = getIntegerOption(in);
41 |
42 | try{
43 | String response = dragonCave(option);
44 | System.out.println(response);
45 | break;
46 | }catch(Exception e){
47 | System.out.println(VALID_OPTIONS);
48 | continue;
49 | }
50 | }
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/HumansVsGoblins/src/main/java/interactable/creature/CreatureConcrete.java:
--------------------------------------------------------------------------------
1 | package interactable.creature;
2 |
3 | public class CreatureConcrete implements Creature {
4 |
5 | int strength;
6 | int stamina;
7 | int health;
8 | String name;
9 | String color;
10 |
11 | public CreatureConcrete(){
12 | this.strength = 2;
13 | this.stamina = 4;
14 | this.health = 4;
15 | this.name = "CreatureConcrete";
16 | this.color = "grey";
17 | }
18 |
19 | @Override
20 | public void interact() {
21 |
22 | }
23 |
24 | @Override
25 | public int getMoveDistance(char direction){
26 | return 1;
27 | }
28 |
29 | public int attack(Creature creature){
30 | int maxDmg = this.getStrength();
31 | int minDmg = 0;
32 | int result = minDmg + (int)(Math.random() * ((maxDmg - minDmg) + 1));
33 | return result;
34 | }
35 |
36 | @Override
37 | public void loot() {
38 |
39 | }
40 |
41 | public int getHealth() {
42 | return health;
43 | }
44 | public void setHealth(int health) {
45 | this.health = health;
46 | }
47 | public int getStrength() {
48 | return strength;
49 | }
50 | public void setStrength(int strength) {
51 | this.strength = strength;
52 | }
53 | public int getStamina() {
54 | return stamina;
55 | }
56 | public void setStamina(int stamina) {
57 | this.stamina = stamina;
58 | }
59 | public String getName() {
60 | return name;
61 | }
62 | public void setName(String name) {
63 | this.name = name;
64 | }
65 | public String getColor() {
66 | return color;
67 | }
68 | public void setColor(String color) {
69 | this.color = color;
70 | }
71 | public char getSymbol(){
72 | return '?';
73 | }
74 |
75 |
76 | @Override
77 | public String toString() {
78 | return "CreatureConcrete{" +
79 | "strength=" + strength + '\'' +
80 | ", stamina='" + stamina + '\'' +
81 | ", name='" + name + '\'' +
82 | ", color='" + color + '\'' +
83 | '}';
84 | }
85 |
86 | }
87 |
--------------------------------------------------------------------------------
/SpringBootAssign1/src/main/java/com/genspark/SpringBootAssign1/Service/CourseServiceImpl.java:
--------------------------------------------------------------------------------
1 | package com.genspark.SpringBootAssign1.Service;
2 |
3 | import com.genspark.SpringBootAssign1.Entity.Course;
4 | import org.springframework.stereotype.Service;
5 |
6 | import java.util.ArrayList;
7 | import java.util.List;
8 |
9 | @Service
10 | public class CourseServiceImpl implements CourseService{
11 |
12 | private List list;
13 |
14 | public CourseServiceImpl() {
15 | list = new ArrayList<>();
16 | list.add(new Course(123,"Counting class", "Dracula"));
17 | list.add(new Course(234,"Intermediate counting class", "Dracula"));
18 | list.add(new Course(345,"Advanced Counting class", "Dracula"));
19 | list.add(new Course(456,"Graduate Counting Lab", "Dracula, Bismarck"));
20 | }
21 |
22 | public Course getByCourseId(int id){
23 | Course c = null;
24 | for (Course course : this.list){
25 | if (course.getCourseId() == id) {
26 | c = course;
27 | break;
28 | }
29 | }
30 |
31 | return c;
32 | }
33 |
34 | public List getAllCourses(){
35 | return list;
36 | }
37 |
38 | public Course addCourse(Course course){
39 | list.add(course);
40 | return getByCourseId(course.getCourseId());
41 | }
42 |
43 | public Course updateCourse(Course course){
44 | String title = course.getTitle();
45 | String instructor = course.getInstructor();
46 | Course c = null;
47 | for ( Course e : this.list){
48 | if (e.getCourseId() == course.getCourseId()){
49 | e.setTitle(title);
50 | e.setInstructor(instructor);
51 | c = e;
52 | break;
53 | }
54 | }
55 | return c;
56 | }
57 |
58 | public Course deleteCourse(int courseId){
59 | Course c = null;
60 | for ( Course e : this.list){
61 | if (e.getCourseId() == courseId){
62 | list.remove(e);
63 | break;
64 | }
65 | }
66 | return c;
67 | }
68 |
69 | }
70 |
--------------------------------------------------------------------------------
/HumansVsGoblins/src/main/java/ui/UserInput.java:
--------------------------------------------------------------------------------
1 | package ui;
2 |
3 | import java.util.Scanner;
4 |
5 | public class UserInput {
6 |
7 | Scanner scanner;
8 | UserInterface ui;
9 |
10 | public UserInput(UserInterface ui){
11 | scanner = new Scanner(System.in);
12 | this.ui = ui;
13 | }
14 |
15 | public class StringLengthException extends Exception{
16 | public StringLengthException(String errorMessage) {
17 | super(errorMessage);
18 | }
19 | }
20 |
21 | public char tier1Input(){
22 | while (true){
23 | try{
24 | String input = getInput();
25 |
26 | if (input.length() > 1) throw new StringLengthException("String input too long");
27 | if (input.length() == 0) throw new StringLengthException("No character provided");
28 | char c = input.charAt(0);
29 | if ("mMqQlL".indexOf(c) == -1) throw new Exception("Input does not match options");
30 | return input.charAt(0);
31 | }
32 | catch(Exception e){
33 | ui.displayMessage(ui.tier1Prompt());
34 | }
35 | }
36 | }
37 |
38 | public char getMoveInput(){
39 | while (true){
40 | try{
41 | String input = getInput();
42 |
43 | if (input.length() > 1) throw new StringLengthException("String input too long");
44 | if (input.length() == 0) throw new StringLengthException("No character provided");
45 | char c = input.charAt(0);
46 | if ("nsewNSEW".indexOf(c) == -1) throw new Exception("Input must specify a cardinal direction");
47 | return input.charAt(0);
48 | }
49 | catch(Exception e){
50 | ui.displayMessage(ui.movementPrompt());
51 | }
52 | }
53 | }
54 |
55 | public String getInput(){
56 | while(true){
57 | try{
58 | String input = scanner.nextLine();
59 | return input;
60 | }
61 | catch(Exception e){
62 | System.out.printf(String.format("Input error: %s", e.getMessage()));
63 | continue;
64 | }
65 | }
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/SpringBootAssign1/src/main/java/com/genspark/SpringBootAssign1/Service/EmployeeServiceImpl.java:
--------------------------------------------------------------------------------
1 | package com.genspark.SpringBootAssign1.Service;
2 |
3 |
4 | import com.genspark.SpringBootAssign1.Entity.Employee;
5 | import org.springframework.stereotype.Service;
6 |
7 | import java.util.ArrayList;
8 | import java.util.List;
9 |
10 | @Service
11 | public class EmployeeServiceImpl implements EmployeeService{
12 |
13 | List list;
14 |
15 | public EmployeeServiceImpl() {
16 | list = new ArrayList<>();
17 | list.add(new Employee(1,"Employee One", "EmployeeOne@employees.org"));
18 | list.add(new Employee(2,"Employee Two", "EmployeeTwo@employees.org"));
19 | list.add(new Employee(3,"Employee Three", "EmployeeThree@employees.org"));
20 | list.add(new Employee(4,"Employee Four", "EmployeeFour@employees.org"));
21 | }
22 |
23 | public Employee getByEmployeeId(int id){
24 | Employee c = null;
25 | for (Employee employee : this.list){
26 | if (employee.getEmployeeId() == id) {
27 | c = employee;
28 | break;
29 | }
30 | }
31 |
32 | return c;
33 | }
34 |
35 | public List getAllEmployees(){
36 | return list;
37 | }
38 |
39 | public Employee addEmployee(Employee Employee){
40 | list.add(Employee);
41 | return getByEmployeeId(Employee.getEmployeeId());
42 | }
43 |
44 | public Employee updateEmployee(Employee Employee){
45 | String title = Employee.getName();
46 | String instructor = Employee.getEmail();
47 | Employee c = null;
48 | for ( Employee e : this.list){
49 | if (e.getEmployeeId() == Employee.getEmployeeId()){
50 | e.setName(title);
51 | e.setEmail(instructor);
52 | c = e;
53 | break;
54 | }
55 | }
56 | return c;
57 | }
58 |
59 | public Employee deleteEmployee(int EmployeeId){
60 | Employee c = null;
61 | for ( Employee e : this.list){
62 | if (e.getEmployeeId() == EmployeeId){
63 | list.remove(e);
64 | break;
65 | }
66 | }
67 | return c;
68 | }
69 |
70 | }
71 |
--------------------------------------------------------------------------------
/.idea/workspace.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 | 1647620419984
37 |
38 |
39 | 1647620419984
40 |
41 |
42 |
43 |
--------------------------------------------------------------------------------
/HumansVsGoblins/src/main/java/game/board/Tile.java:
--------------------------------------------------------------------------------
1 | package game.board;
2 |
3 | import interactable.Interactable;
4 | import interactable.creature.Creature;
5 | import ui.display.Displayable;
6 |
7 | import java.util.List;
8 |
9 | import java.util.ArrayList;
10 |
11 | public class Tile implements Holder, Displayable {
12 |
13 | boolean passableTerrain;
14 | boolean occupied;
15 | ArrayList contents;
16 |
17 |
18 | public Tile(){
19 | this.passableTerrain = true;
20 | this.contents = new ArrayList<>();
21 | this.occupied = calculateOccupied();
22 | }
23 |
24 | public Tile(boolean passableTerrain){
25 | this.passableTerrain = passableTerrain;
26 | this.contents = new ArrayList<>();
27 | this.occupied = calculateOccupied();
28 | }
29 |
30 | public Tile(boolean passableTerrain, ArrayList contents){
31 | this.contents = contents;
32 | this.occupied = calculateOccupied();
33 | this.passableTerrain = passableTerrain;
34 | }
35 |
36 | public Tile(ArrayList contents){
37 | this.contents = contents;
38 | this.occupied = calculateOccupied();
39 | this.passableTerrain = true;
40 | }
41 |
42 | public List prioritizeContents() {
43 | return this.contents;
44 | }
45 |
46 | public List getContents(){
47 | return this.contents;
48 | }
49 |
50 | public Creature getFirstOccupant(){
51 | for (Interactable i : contents){
52 | if (i instanceof Creature) return (Creature) i;
53 | }
54 | return null;
55 | }
56 |
57 | public void addToContents(Interactable i){
58 | contents.add(i);
59 | }
60 |
61 | public boolean isPassableTerrain() {
62 | return passableTerrain;
63 | }
64 |
65 | public void setPassableTerrain(boolean passableTerrain) {
66 | this.passableTerrain = passableTerrain;
67 | }
68 |
69 | public boolean isPassable(){
70 | return !occupied && passableTerrain;
71 | }
72 |
73 | public boolean calculateOccupied(){
74 | for (Interactable i : contents){
75 | if (i instanceof Creature){
76 | this.occupied = true;
77 | return true;
78 | }
79 | }
80 | this.occupied = false;
81 | return false;
82 | }
83 |
84 | public boolean isOccupied(){
85 | return occupied;
86 | }
87 | public void setOccupied(boolean occupied){
88 | this.occupied = occupied;
89 | }
90 |
91 | }
92 |
--------------------------------------------------------------------------------
/Hangman/src/test/java/HangmanGameTest.java:
--------------------------------------------------------------------------------
1 | import org.junit.jupiter.api.Assertions;
2 | import org.junit.jupiter.api.BeforeEach;
3 | import org.junit.jupiter.api.Test;
4 |
5 | import java.util.Arrays;
6 | import java.util.Collections;
7 | import java.util.ArrayList;
8 |
9 | class HangmanGameTest {
10 |
11 | HangmanGame game;
12 |
13 | @BeforeEach
14 | void setUp(){
15 | this.game = new HangmanGame("cat",3);
16 | }
17 |
18 | @Test
19 | void didWin() {
20 | game.addGuess('c');
21 | game.addGuess('a');
22 | Assertions.assertFalse(game.didWin());
23 | game.addGuess('t');
24 | Assertions.assertTrue(game.didWin());
25 | game.addGuess('o');
26 | Assertions.assertTrue(game.didWin());
27 | game.reset();
28 |
29 | game.addGuess('c');
30 | game.addGuess('t');
31 | Assertions.assertFalse(game.didWin());
32 | game.addGuess('o');
33 | Assertions.assertFalse(game.didWin());
34 |
35 | }
36 |
37 | @Test
38 | void gameIsEnded(){
39 | // guess 1
40 | game.addGuess('o');
41 | game.addGuess('o');
42 | game.addGuess('o');
43 | game.addGuess('o');
44 | game.addGuess('o');
45 | Assertions.assertFalse(game.gameIsEnded());
46 | // guess 2
47 | game.addGuess('2');
48 | Assertions.assertFalse(game.gameIsEnded());
49 |
50 |
51 | // guess 3 - time to end
52 | game.addGuess('3');
53 | Assertions.assertTrue(game.gameIsEnded());
54 | game.reset();
55 |
56 | game.addGuess('c');
57 | game.addGuess('a');
58 | Assertions.assertFalse(game.gameIsEnded());
59 | game.addGuess('o');
60 | game.addGuess('2');
61 | Assertions.assertFalse(game.gameIsEnded());
62 |
63 | game.addGuess('t');
64 | Assertions.assertTrue(game.gameIsEnded());
65 | }
66 |
67 | @Test
68 | void getHighScore(){
69 | ArrayList lines = new ArrayList<>(Arrays.asList("high,1","2nd,2","3rd,3"));
70 | Assertions.assertEquals(1,game.getHighScore(lines,""));
71 | Assertions.assertEquals(1,game.getHighScore(lines,"high"));
72 | Assertions.assertEquals(2,game.getHighScore(lines,"2nd"));
73 | Assertions.assertEquals(3,game.getHighScore(lines,"3rd"));
74 | }
75 |
76 | @Test
77 | void alreadyGuessed(){
78 | game.addGuess('o');
79 | Assertions.assertTrue(game.alreadyGuessed('o'));
80 | Assertions.assertFalse(game.alreadyGuessed(' '));
81 | Assertions.assertFalse(game.alreadyGuessed('f'));
82 | }
83 | }
--------------------------------------------------------------------------------
/HumansVsGoblins/src/main/java/game/Game.java:
--------------------------------------------------------------------------------
1 | package game;
2 |
3 | import game.board.Board;
4 | import game.turn.TurnTracker;
5 | import interactable.creature.Creature;
6 | import interactable.creature.Goblin;
7 | import interactable.creature.Human;
8 | import ui.UserInput;
9 | import ui.UserInterface;
10 |
11 | public class Game implements BattleManager{
12 |
13 | private TurnTracker turnTracker;
14 | private Board board;
15 | private Roster roster;
16 | private UserInterface ui;
17 | private UserInput input;
18 |
19 | public Game(){
20 | roster = new Roster();
21 |
22 | roster.addCreature(new Human());
23 | roster.addCreature(new Goblin());
24 |
25 | board = new Board(roster, this);
26 | turnTracker = new TurnTracker(roster);
27 | ui = new UserInterface();
28 | input = new UserInput(ui);
29 | }
30 |
31 | public void doBattle(Creature c1, Creature c2){
32 | int dmg = c1.attack(c2);
33 | c2.setHealth(c2.getHealth()-dmg);
34 | ui.displayMessage(ui.battleResultMsg(c1,c2,dmg));
35 |
36 | if (c2.getHealth() <= 0){
37 | ui.displayMessage(ui.creatureDeathMsg(c2));
38 | board.clearCreature(c2);
39 | }
40 |
41 | }
42 |
43 | private char handleMovement(){
44 | while (true){
45 | ui.displayMessage(ui.movementPrompt());
46 | char direction = input.getMoveInput();
47 | try {
48 | board.moveSwitch(turnTracker.getActiveCreature(), direction);
49 | return direction;
50 | }
51 | catch(Board.InvalidDestException e){
52 | System.out.println(e.getMessage());
53 | continue;
54 | }
55 | }
56 | }
57 |
58 | private char tier1Options(){
59 | ui.displayMessage(ui.tier1Prompt());
60 | switch (input.tier1Input()) {
61 | case 'm':
62 | case 'M':
63 | handleMovement();
64 | return 'm';
65 |
66 | case 'l':
67 | case 'L':
68 | ui.displayMessage("Sorry, looting not yet implemented\n");
69 | return 'l';
70 |
71 | case 'q':
72 | case 'Q':
73 | return 'q';
74 | }
75 |
76 | return 'q';
77 | }
78 |
79 | public void runGame(){
80 | do {
81 | ui.renderBoard(board);
82 | if (tier1Options() == 'q') break;
83 | turnTracker.nextTurn();
84 | ui.displayMessage("\n\n\n");
85 | }while(true);
86 | }
87 |
88 | }
89 |
--------------------------------------------------------------------------------
/section8/LongestCall.java:
--------------------------------------------------------------------------------
1 | package genspark.assignments.section8;
2 |
3 | import genspark.assignments.Assignment;
4 |
5 | import java.io.File;
6 | import java.io.IOException;
7 | import java.nio.charset.StandardCharsets;
8 | import java.nio.file.Files;
9 | import java.nio.file.Paths;
10 | import java.util.*;
11 | import java.util.stream.Collectors;
12 |
13 | public class LongestCall implements Assignment {
14 |
15 | // public ArrayList readAFile(String str){
16 | // String pathname = str.equals("") ? "C:\\Genspark\\genspark-java-core\\genspark-java-core\\src\\main\\java\\genspark\\assignments\\section8/sample_data.txt" : str;
17 | // File file = new File(pathname);
18 | // ArrayList contents = new ArrayList<>();
19 | // try (Scanner scanner = new Scanner(file)) {
20 | // while (scanner.hasNext()) {
21 | // String next = scanner.nextLine() + '\n';
22 | // contents.add(next);
23 | // }
24 | // } catch (IOException e) {
25 | // System.out.println("Failure opening file: " + e.getMessage());
26 | // }
27 | //
28 | // ArrayList ret = (ArrayList) contents.stream()
29 | // .map(s -> s.chars().mapToObj(i->(char)i).collect(Collectors.toList()))
30 | // .reduce(new ArrayList<>(),(prevString,newString) ->{
31 | // ArrayList a = new ArrayList<>(prevString);
32 | // a.addAll(newString);
33 | // return a;
34 | // });
35 | //
36 | // return ret;
37 | // }
38 | //
39 | // public String fileToStringArray(String str){
40 | // ArrayList result = readAFile(str);
41 | // return result.stream().map(Object::toString)
42 | // .reduce("",(a,b) -> a+b);
43 | // }
44 |
45 | class SortByDuration implements Comparator {
46 |
47 | // Method
48 | // Sorting in ascending order of roll number
49 | public int compare(String a, String b)
50 | {
51 | String[] aDetails = a.split(",");
52 | String[] bDetails = b.split(",");
53 | return Integer.parseInt(bDetails[3]) - Integer.parseInt(aDetails[3]);
54 | }
55 | }
56 |
57 | public String solution() {
58 | // ↓↓↓↓ your code goes here ↓↓↓↓
59 | String callsPath = "C:\\GenSpark\\genspark-java-core\\genspark-java-core\\genspark-java-core\\src\\main\\resources\\calls.csv";
60 |
61 | try{
62 | String[] calls = Files.readString(Paths.get(callsPath), StandardCharsets.US_ASCII).split("\n");
63 | Object[] sortedRecords = Arrays.stream(calls).sorted(new SortByDuration()).toArray();
64 | String answerRecord = (String) sortedRecords[0];
65 | String answer = answerRecord.split(",")[0];
66 | return answer;
67 | }
68 | catch (IOException e ){
69 | e.printStackTrace();
70 | return "0";
71 | }
72 | }
73 | }
74 |
75 |
--------------------------------------------------------------------------------
/SpringBootAssign1/src/main/java/com/genspark/SpringBootAssign1/Controller/MyController.java:
--------------------------------------------------------------------------------
1 | package com.genspark.SpringBootAssign1.Controller;
2 |
3 | import com.genspark.SpringBootAssign1.Entity.Course;
4 | import com.genspark.SpringBootAssign1.Entity.Employee;
5 | import com.genspark.SpringBootAssign1.Service.CourseService;
6 | import com.genspark.SpringBootAssign1.Service.EmployeeService;
7 | import org.springframework.beans.factory.annotation.Autowired;
8 | import org.springframework.web.bind.annotation.*;
9 |
10 | import java.util.List;
11 |
12 | @RestController
13 | public class MyController {
14 |
15 | @Autowired
16 | private CourseService courseService;
17 | @Autowired
18 | private EmployeeService employeeService;
19 |
20 | @GetMapping("home")
21 | public String home(){
22 | return "Welcome to the course application
";
23 | }
24 |
25 | // // // // //
26 | // COURSES //
27 | // // // // //
28 | @GetMapping("courses")
29 | public List getCourses(){
30 | return this.courseService.getAllCourses();
31 | }
32 |
33 | @GetMapping("/courses/{courseId}")
34 | public Course getCourse(@PathVariable String courseId){
35 | return this.courseService.getByCourseId(Integer.parseInt(courseId));
36 | }
37 |
38 | @PostMapping("/courses")
39 | public Course addCourse(@RequestBody Course course){
40 | return this.courseService.addCourse(course);
41 | }
42 |
43 | @PutMapping("/courses")
44 | public Course updateCourse(@RequestBody Course course){
45 | return this.courseService.updateCourse(course);
46 | }
47 |
48 | @DeleteMapping("/courses/{courseId}")
49 | public String deleteCourse(@PathVariable String courseId){
50 | this.courseService.deleteCourse(Integer.parseInt(courseId));
51 | return "Deleted Successfully";
52 | }
53 |
54 | // // // // // //
55 | // EMPLOYEES //
56 | // // // // //
57 | @GetMapping("employees")
58 | public List getEmployees(){
59 | return this.employeeService.getAllEmployees();
60 | }
61 |
62 | @GetMapping("/employees/{employeeId}")
63 | public Employee getEmployee(@PathVariable String employeeId){
64 | return this.employeeService.getByEmployeeId(Integer.parseInt(employeeId));
65 | }
66 |
67 | @PostMapping("/employees")
68 | public Employee addEmployee(@RequestBody Employee employee){
69 | return this.employeeService.addEmployee(employee);
70 | }
71 |
72 | @PutMapping("/employees")
73 | public Employee updateCourse(@RequestBody Employee employee){
74 | return this.employeeService.updateEmployee(employee);
75 | }
76 |
77 | @DeleteMapping("/employees/{employeeId}")
78 | public String deleteEmployee(@PathVariable String employeeId){
79 | this.employeeService.deleteEmployee(Integer.parseInt(employeeId));
80 | return "Deleted Successfully";
81 | }
82 |
83 | }
84 |
--------------------------------------------------------------------------------
/section8/TotalNumberOfCalls.java:
--------------------------------------------------------------------------------
1 | package genspark.assignments.section8;
2 |
3 | import genspark.assignments.Assignment;
4 |
5 | import java.io.BufferedWriter;
6 | import java.io.File;
7 | import java.io.IOException;
8 | import java.nio.charset.StandardCharsets;
9 | import java.nio.file.Files;
10 | import java.nio.file.Path;
11 | import java.nio.file.Paths;
12 | import java.nio.file.StandardOpenOption;
13 | import java.util.ArrayList;
14 | import java.util.HashSet;
15 | import java.util.Scanner;
16 | import java.util.stream.Collectors;
17 |
18 | public class TotalNumberOfCalls implements Assignment {
19 |
20 | // public ArrayList readAFile(String str){
21 | // String pathname = str.equals("") ? "C:\\Genspark\\genspark-java-core\\genspark-java-core\\src\\main\\java\\genspark\\assignments\\section8/sample_data.txt" : str;
22 | // File file = new File(pathname);
23 | // ArrayList contents = new ArrayList<>();
24 | // try (Scanner scanner = new Scanner(file)) {
25 | // while (scanner.hasNext()) {
26 | // String next = scanner.nextLine() + '\n';
27 | // contents.add(next);
28 | // }
29 | // } catch (IOException e) {
30 | // System.out.println("Failure opening file: " + e.getMessage());
31 | // }
32 | //
33 | // ArrayList ret = (ArrayList) contents.stream()
34 | // .map(s -> s.chars().mapToObj(i->(char)i).collect(Collectors.toList()))
35 | // .reduce(new ArrayList<>(),(prevString,newString) ->{
36 | // ArrayList a = new ArrayList<>(prevString);
37 | // a.addAll(newString);
38 | // return a;
39 | // });
40 | //
41 | // return ret;
42 | // }
43 | //
44 | // public String fileToStringArray(String str){
45 | // ArrayList result = readAFile(str);
46 | // return result.stream().map(Object::toString)
47 | // .reduce("",(a,b) -> a+b);
48 | // }
49 |
50 | public int solution() throws IOException {
51 | String callsPath = "C:\\GenSpark\\genspark-java-core\\genspark-java-core\\genspark-java-core\\src\\main\\resources\\calls.csv";
52 | String textsPath = "C:\\GenSpark\\genspark-java-core\\genspark-java-core\\genspark-java-core\\src\\main\\resources\\texts.csv";
53 |
54 | String[] calls = Files.readString(Paths.get(callsPath), StandardCharsets.US_ASCII).split("\n");
55 | String[] texts = Files.readString(Paths.get(textsPath), StandardCharsets.US_ASCII).split("\n");
56 |
57 | HashSet numbers = new HashSet<>();
58 |
59 | for (String call : calls){
60 | String[] data = call.split(",");
61 | String calling = data[0];
62 | String rcv = data[1];
63 | numbers.add(calling);
64 | numbers.add(rcv);
65 | }
66 | for (String text : texts){
67 | String[] data = text.split(",");
68 | String sender = data[0];
69 | String rcv = data[1];
70 | numbers.add(sender);
71 | numbers.add(rcv);
72 | }
73 |
74 | return numbers.size();
75 | }
76 | }
77 |
78 |
--------------------------------------------------------------------------------
/section8/RecordOfTextsAndCalls.java:
--------------------------------------------------------------------------------
1 | package genspark.assignments.section8;
2 |
3 | import genspark.assignments.Assignment;
4 |
5 | import java.io.File;
6 | import java.io.IOException;
7 | import java.nio.charset.StandardCharsets;
8 | import java.nio.file.Files;
9 | import java.nio.file.Paths;
10 | import java.util.List;
11 | import java.util.ArrayList;
12 | import java.util.Scanner;
13 | import java.util.stream.Collectors;
14 |
15 |
16 | public class RecordOfTextsAndCalls implements Assignment {
17 | //
18 | // public ArrayList charThing(List a, List b){
19 | // ArrayList ret = new ArrayList<>(a);
20 | // a.addAll(b);
21 | // return ret;
22 | // }
23 | //
24 | // public ArrayList readAFile(String str){
25 | // String pathname = str.equals("") ? "C:\\Genspark\\genspark-java-core\\genspark-java-core\\src\\main\\java\\genspark\\assignments\\section8/sample_data.txt" : str;
26 | // File file = new File(pathname);
27 | // ArrayList contents = new ArrayList<>();
28 | // try (Scanner scanner = new Scanner(file)) {
29 | // while (scanner.hasNext()) {
30 | // String next = scanner.nextLine() + '\n';
31 | // contents.add(next);
32 | // }
33 | // } catch (IOException e) {
34 | // System.out.println("Failure opening file: " + e.getMessage());
35 | // }
36 | //
37 | // ArrayList ret = new ArrayList<>();
38 | // ret = (ArrayList) contents.stream()
39 | // .map(s -> s.chars().mapToObj(i->(char)i).collect(Collectors.toList()))
40 | // .reduce(ret, this::charThing);
41 | //
42 | // return ret;
43 | // }
44 | //
45 | // public String fileToStringArray(String str){
46 | // ArrayList result = this.readAFile(str);
47 | // return result.stream().map(Object::toString)
48 | // .reduce("",(a,b) -> a+b);
49 | // }
50 |
51 | public String[] solution() throws IOException {
52 | // ↓↓↓↓ your code goes here ↓↓↓↓
53 | // First record of texts, texts at time