From 619dc8edf40419b81392eb9aca662d54d9c7f61c Mon Sep 17 00:00:00 2001 From: Devon Harstrom <devonharstrom@gmail.com> Date: Fri, 14 Feb 2025 08:01:12 -0700 Subject: [PATCH 01/17] notes about what to refactor --- Assignment_1/Notes.txt | 4 +--- Assignment_1/README.md | 7 +++++++ .../assignment3GUI - Classmate's/src/World.java | 3 +++ 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/Assignment_1/Notes.txt b/Assignment_1/Notes.txt index ab02047..a95f30c 100644 --- a/Assignment_1/Notes.txt +++ b/Assignment_1/Notes.txt @@ -1,5 +1,3 @@ Going to use either these 3 codes: -classmate's, -Liam's, -Or Guis' \ No newline at end of file +classmate's, \ No newline at end of file diff --git a/Assignment_1/README.md b/Assignment_1/README.md index b11b1f2..0ebf17b 100644 --- a/Assignment_1/README.md +++ b/Assignment_1/README.md @@ -4,3 +4,10 @@ --- Used code from __ and refactored + + +Refactor branch 1: De-nesting code in world + +refactor branch 2: comments + +refactor branch 3 diff --git a/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/World.java b/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/World.java index 73af68f..6484730 100644 --- a/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/World.java +++ b/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/World.java @@ -44,6 +44,7 @@ public class World } } aWorld = FileInitialization.read(); + // refactor 1 this could be de-nested for readability for (r = 0; r < SIZE; r++) { System.out.println(""); @@ -72,6 +73,7 @@ public class World System.out.println(" - "+"- "+"- "+"- "+"- "+"- "+"- "+"- "+"- "+ "- "); sortLocations(); } + // Same here this could be de-nested public void sortDead() {//supposed to try and sort null elements and bring them to the end doesn't always work as intended for (int i = 0; i<=elfCounter+orcCounter;i++) { if (loc[i] != null) { @@ -87,6 +89,7 @@ public class World } } } + // and potenitally here public void sortLocations() {//puts the elfs in the beginning of the array, checks if there is an orc before and elf and if there is it swaps positions in the array for (int j = 0; j<elfCounter+orcCounter; j++) { if (loc[j+orcCounter] != null) { -- GitLab From 05eeace9b8fb646f577847264f1b165eaec127a5 Mon Sep 17 00:00:00 2001 From: Devon Harstrom <devonharstrom@gmail.com> Date: Sun, 16 Feb 2025 16:36:53 -0700 Subject: [PATCH 02/17] Half-way through refactor 1 where i am de nesting a lot of the if statements to make it more readable ive added some tests for the functions ive changed but it is a gui project so for the most part i am comparing the gui result vs the old resultso far completely the same --- .../Junit/tut_ex1/Book.java | 46 ++++ .../Junit/tut_ex1/Library.java | 64 +++++ .../LibraryManagementSystemTestComplete.java | 68 +++++ .../Junit/tut_ex1/Loan.java | 38 +++ .../Junit/tut_ex1/Member.java | 36 +++ Assignment_1/Notes.txt | 68 ++++- Assignment_1/README.md | 8 +- .../src/refactor_1_testOG.java | 46 ++++ .../src/Entity.java | 2 + .../src/FileInitialization.java | 2 +- .../src/GamePanel.java | 1 + .../src/Location.java | 1 + .../src/World.java | 256 +++++++++--------- .../src/refactor_1_test.java | 49 ++++ .../src/reworks.java | 60 ++++ out/production/501-gitlab/Entity.class | Bin 0 -> 1769 bytes out/production/501-gitlab/FileContainer.class | Bin 0 -> 696 bytes .../501-gitlab/FileInitialization.class | Bin 0 -> 3374 bytes out/production/501-gitlab/GameFrame.class | Bin 0 -> 641 bytes .../501-gitlab/GamePanel$MyKeyAdapter.class | Bin 0 -> 1197 bytes out/production/501-gitlab/GamePanel.class | Bin 0 -> 4923 bytes out/production/501-gitlab/GameStatus.class | Bin 0 -> 2785 bytes out/production/501-gitlab/Location.class | Bin 0 -> 1160 bytes out/production/501-gitlab/Simulator.class | Bin 0 -> 402 bytes out/production/501-gitlab/World.class | Bin 0 -> 5400 bytes out/production/501-gitlab/data.txt | 10 + .../501-gitlab/refactor_1_test.class | Bin 0 -> 2637 bytes 27 files changed, 622 insertions(+), 133 deletions(-) create mode 100644 Assignment_1/Assignment_resources/Junit/tut_ex1/Book.java create mode 100644 Assignment_1/Assignment_resources/Junit/tut_ex1/Library.java create mode 100644 Assignment_1/Assignment_resources/Junit/tut_ex1/LibraryManagementSystemTestComplete.java create mode 100644 Assignment_1/Assignment_resources/Junit/tut_ex1/Loan.java create mode 100644 Assignment_1/Assignment_resources/Junit/tut_ex1/Member.java create mode 100644 Assignment_1/original_code/assignment3GUI - Classmate's/src/refactor_1_testOG.java create mode 100644 Assignment_1/refactored_code/assignment3GUI - Classmate's/src/refactor_1_test.java create mode 100644 Assignment_1/refactored_code/assignment3GUI - Classmate's/src/reworks.java create mode 100644 out/production/501-gitlab/Entity.class create mode 100644 out/production/501-gitlab/FileContainer.class create mode 100644 out/production/501-gitlab/FileInitialization.class create mode 100644 out/production/501-gitlab/GameFrame.class create mode 100644 out/production/501-gitlab/GamePanel$MyKeyAdapter.class create mode 100644 out/production/501-gitlab/GamePanel.class create mode 100644 out/production/501-gitlab/GameStatus.class create mode 100644 out/production/501-gitlab/Location.class create mode 100644 out/production/501-gitlab/Simulator.class create mode 100644 out/production/501-gitlab/World.class create mode 100644 out/production/501-gitlab/data.txt create mode 100644 out/production/501-gitlab/refactor_1_test.class diff --git a/Assignment_1/Assignment_resources/Junit/tut_ex1/Book.java b/Assignment_1/Assignment_resources/Junit/tut_ex1/Book.java new file mode 100644 index 0000000..cd20a05 --- /dev/null +++ b/Assignment_1/Assignment_resources/Junit/tut_ex1/Book.java @@ -0,0 +1,46 @@ +package LibraryManagement; + +public class Book { + private String title; + private String author; + private boolean loaned; + + public Book(String title, String author) { + this.title = title; + this.author = author; + this.loaned = false; + } + + public boolean isLoaned() { + return loaned; + } + + public void setLoaned(boolean loaned) { + this.loaned = loaned; + } + + // Getters and setters + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public String getAuthor() { + return author; + } + + public void setAuthor(String author) { + this.author = author; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) return true; + if (obj == null || getClass() != obj.getClass()) return false; + Book book = (Book) obj; + return title.equals(book.title) && author.equals(book.author); + } +} \ No newline at end of file diff --git a/Assignment_1/Assignment_resources/Junit/tut_ex1/Library.java b/Assignment_1/Assignment_resources/Junit/tut_ex1/Library.java new file mode 100644 index 0000000..27e94c4 --- /dev/null +++ b/Assignment_1/Assignment_resources/Junit/tut_ex1/Library.java @@ -0,0 +1,64 @@ +package LibraryManagement; + +import java.util.ArrayList; +import java.util.List; + + +public class Library { + private List<Book> books; + private List<Member> members; + private List<Loan> loans; + + public Library() { + this.books = new ArrayList<>(); + this.members = new ArrayList<>(); + this.loans = new ArrayList<>(); + } + + public void addBook(Book book) { + books.add(book); + } + + public void addMember(Member member) { + members.add(member); + } + + public void loanBook(Book book, Member member) throws Exception { + if (!books.contains(book)) { + throw new Exception("Book not in library"); + } + if (!members.contains(member)) { + throw new Exception("Member not registered"); + } + if (book.isLoaned()) { + throw new Exception("Book already loaned"); + } + Loan loan = new Loan(book, member); + loans.add(loan); + book.setLoaned(true); + } + + public void returnBook(Book book) throws Exception { + if (!books.contains(book)) { + throw new Exception("Book not in library"); + } + Loan loan = loans.stream().filter(l -> l.getBook().equals(book)).findFirst().orElse(null); + if (loan == null) { + throw new Exception("Book not loaned"); + } + loans.remove(loan); + book.setLoaned(false); + } + + public List<Book> getBooks() { + return books; + } + + public List<Member> getMembers() { + return members; + } + + public List<Loan> getLoans() { + return loans; + } +} \ No newline at end of file diff --git a/Assignment_1/Assignment_resources/Junit/tut_ex1/LibraryManagementSystemTestComplete.java b/Assignment_1/Assignment_resources/Junit/tut_ex1/LibraryManagementSystemTestComplete.java new file mode 100644 index 0000000..d61dee6 --- /dev/null +++ b/Assignment_1/Assignment_resources/Junit/tut_ex1/LibraryManagementSystemTestComplete.java @@ -0,0 +1,68 @@ +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.*; + + +class LibraryManagementSystemTestComplete { + + private static Library library; + private static Book book1; + private static Book book2; + private static Member member1; + private static Member member2; + + @BeforeEach + void setUp() { + // Create library and add books and members + library = new Library(); + book1 = new Book("The Great Gatsby", "F. Scott Fitzgerald"); + book2 = new Book("To Kill a Mockingbird", "Harper Lee"); + member1 = new Member("John Doe", "12345"); + member2 = new Member("Jane Smith", "67890"); + + library.addBook(book1); + library.addBook(book2); + library.addMember(member1); + library.addMember(member2); + } + + @Test + void testLoanBook() throws Exception { + library.loanBook(book1, member1); + assertTrue(book1.isLoaned()); + assertEquals(1, library.getLoans().size()); + } + + @Test + void testLoanBookNotRegistered() { + Member newMember = new Member("New Member", "99999"); + assertThrows(Exception.class, () -> library.loanBook(book2, newMember)); + } + + @Test + void testReturnBook() throws Exception { + library.loanBook(book1, member1); + library.returnBook(book1); + assertFalse(book1.isLoaned()); + assertEquals(0, library.getLoans().size()); + } + + @Test + void testReturnBookNotLoaned() { + assertThrows(Exception.class, () -> library.returnBook(book2)); + } + + @Test + void testAddBook() { + Book newBook = new Book("1984", "George Orwell"); + library.addBook(newBook); + assertTrue(library.getBooks().contains(newBook)); + } + + @Test + void testAddMember() { + Member newMember = new Member("New Member", "99999"); + library.addMember(newMember); + assertTrue(library.getMembers().contains(newMember)); + } +} diff --git a/Assignment_1/Assignment_resources/Junit/tut_ex1/Loan.java b/Assignment_1/Assignment_resources/Junit/tut_ex1/Loan.java new file mode 100644 index 0000000..07edb88 --- /dev/null +++ b/Assignment_1/Assignment_resources/Junit/tut_ex1/Loan.java @@ -0,0 +1,38 @@ +package LibraryManagement; + +public class Loan { + private Book book; + private Member member; + private java.time.LocalDate loanDate; + + public Loan(Book book, Member member) { + this.book = book; + this.member = member; + this.loanDate = java.time.LocalDate.now(); + } + + // Getters and setters + public Book getBook() { + return book; + } + + public void setBook(Book book) { + this.book = book; + } + + public Member getMember() { + return member; + } + + public void setMember(Member member) { + this.member = member; + } + + public java.time.LocalDate getLoanDate() { + return loanDate; + } + + public void setLoanDate(java.time.LocalDate loanDate) { + this.loanDate = loanDate; + } +} \ No newline at end of file diff --git a/Assignment_1/Assignment_resources/Junit/tut_ex1/Member.java b/Assignment_1/Assignment_resources/Junit/tut_ex1/Member.java new file mode 100644 index 0000000..ef2f678 --- /dev/null +++ b/Assignment_1/Assignment_resources/Junit/tut_ex1/Member.java @@ -0,0 +1,36 @@ +package LibraryManagement; + +public class Member { + private String name; + private String id; + + public Member(String name, String id) { + this.name = name; + this.id = id; + } + + // Getters and setters + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) return true; + if (obj == null || getClass() != obj.getClass()) return false; + Member member = (Member) obj; + return id.equals(member.id); + } +} \ No newline at end of file diff --git a/Assignment_1/Notes.txt b/Assignment_1/Notes.txt index a95f30c..39a212a 100644 --- a/Assignment_1/Notes.txt +++ b/Assignment_1/Notes.txt @@ -1,3 +1,69 @@ Going to use either these 3 codes: -classmate's, \ No newline at end of file +classmate's, + + + +------------- + + +//public void attack(int index) { +// if(((loc[index].getType() == 'O') && (aWorld[tempRow][tempColumn].getAppearance() != 'O')) || +// ((loc[index].getType() == 'E') && (aWorld[tempRow][tempColumn].getAppearance() != 'E'))) { +// loc[index].setCanMove(true); +// return; +// } +// turnSinceAtk = 0; +// if((loc[index].getType() == 'E')&&(aWorld[loc[index].getRow()][loc[index].getColumn()] != null)) { +// HP = aWorld[tempRow][tempColumn].getHitPoints(); +// aWorld[tempRow][tempColumn].setHitPoints(aWorld[tempRow][tempColumn].getHitPoints()-Entity.ELF_DAMAGE); +// HPAfter = aWorld[tempRow][tempColumn].getHitPoints(); +// if (GameStatus.debugModeOn) {//attack data for elf attackers +// status.elfAttackDebug(tempRow, tempColumn, loc[index].getRow(), loc[index].getColumn(),HP,HPAfter); +// } +// if (aWorld[tempRow][tempColumn].getHitPoints() >0){ +// return; +// } +// aWorld[tempRow][tempColumn] = null; +// orcCounter--; +// sortDead(); +// if(loc[index] != null) { +// loc[index].setCanMove(true); +// } +// if (orcCounter > 0) { +// return; +// } +// System.out.println("Elves win no more orcs left."); +// programRunning = false; +// if(GameStatus.debugModeOn) {//lose condition data +// status.orcLoseDebug(orcCounter); +// } +// } else if((loc[index].getType() == 'O')&&(aWorld[loc[index].getRow()][loc[index].getColumn()] != null)) { +// HP = aWorld[tempRow][tempColumn].getHitPoints(); +// aWorld[tempRow][tempColumn].setHitPoints(aWorld[tempRow][tempColumn].getHitPoints()-Entity.ORC_DAMAGE); +// HPAfter = aWorld[tempRow][tempColumn].getHitPoints(); +// if (GameStatus.debugModeOn) { +// //attack data for Orc attackers +// status.orcAttackDebug(tempRow, tempColumn, loc[index].getRow(), loc[index].getColumn(),HP,HPAfter); +// } +// if (aWorld[tempRow][tempColumn].getHitPoints() >0){ +// return; +// } +// aWorld[tempRow][tempColumn] = null; +// elfCounter--; +// sortDead(); +// if(loc[index] != null) { +// loc[index].setCanMove(true); +// } +// if (elfCounter>0){ +// return; +// } +// System.out.println("Orcs win no more elves left."); +// programRunning = false; +// if(GameStatus.debugModeOn) {//gives data for lose condition when no elves left standing +// status.elfLoseDebug(elfCounter); +// } +// } else { +// loc[index].setCanMove(true); +// } +//} \ No newline at end of file diff --git a/Assignment_1/README.md b/Assignment_1/README.md index 0ebf17b..1738476 100644 --- a/Assignment_1/README.md +++ b/Assignment_1/README.md @@ -10,4 +10,10 @@ Refactor branch 1: De-nesting code in world refactor branch 2: comments -refactor branch 3 +refactor branch 3: pulling out methods + +refactor branch 4: rearrange classes? + +refactor branch 5: new class? for elves and dwarves? + +refactor: _ maybe renaming? or getting rid of temp \ No newline at end of file diff --git a/Assignment_1/original_code/assignment3GUI - Classmate's/src/refactor_1_testOG.java b/Assignment_1/original_code/assignment3GUI - Classmate's/src/refactor_1_testOG.java new file mode 100644 index 0000000..f612ac8 --- /dev/null +++ b/Assignment_1/original_code/assignment3GUI - Classmate's/src/refactor_1_testOG.java @@ -0,0 +1,46 @@ +import org.junit.jupiter.api.Test; +import java.io.ByteArrayInputStream; +import java.io.InputStream; +import static org.junit.jupiter.api.Assertions.*; +import org.junit.jupiter.api.*; + +class refactor_1_testOG { + private static World world; + + @BeforeEach + void setUp() { + String simulatedInput = "Assignment_1/original_code/assignment3GUI - Classmate's/src/data.txt"; + InputStream originalSystemInStream = System.in; // Save the original System.in + ByteArrayInputStream simulatedInputStream = new ByteArrayInputStream(simulatedInput.getBytes()); + System.setIn(simulatedInputStream); // Set System.in to the new input stream + world = new World(); // This will call FileInitialization.read() and use the simulated input + System.setIn(originalSystemInStream); // Restore the original System.in + } + + @Test + void testBoardInitialization() { + System.out.println("Test 1 running."); + assertNotNull(world.aWorld, "Board should be initialized"); + assertEquals(World.SIZE, world.aWorld.length, "Board should have correct rows"); + assertEquals(World.SIZE, world.aWorld[0].length, "Board should have correct columns"); + assertEquals(4, world.elfCounter); // check if right amount of elves and orcs + assertEquals(4, world.orcCounter); + } + + @Test + void sortDeadTest(){ + + } + + @Test + void test3(){ + StringBuilder afterSort = new StringBuilder(); + for (Location location : world.loc) { + afterSort.append(location != null ? location.getType() : ""); + } + assertEquals("OOEEOOEE", afterSort.toString(), "Locations should be sorted with Orcs before Elves"); + } +} + + + diff --git a/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/Entity.java b/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/Entity.java index 9e06be4..b4427b1 100644 --- a/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/Entity.java +++ b/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/Entity.java @@ -13,6 +13,8 @@ */ +// do i make sub classes for elf and Orc? + public class Entity { public static final char DEFAULT_APPEARANCE = 'X'; diff --git a/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/FileInitialization.java b/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/FileInitialization.java index 4ce778c..bf5b57c 100644 --- a/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/FileInitialization.java +++ b/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/FileInitialization.java @@ -83,7 +83,7 @@ public class FileInitialization { System.out.print("Name of file containing starting positions: "); filename = in.nextLine(); - fr = new FileReader(filename); + fr = new FileReader(filename); br = new BufferedReader(fr); fileFound = true; } diff --git a/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/GamePanel.java b/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/GamePanel.java index 5ab0e62..4a58933 100644 --- a/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/GamePanel.java +++ b/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/GamePanel.java @@ -151,6 +151,7 @@ public class GamePanel extends JPanel implements ActionListener{ System.out.println("Cease Fire, Game over."); } } + // de-nest public class MyKeyAdapter extends KeyAdapter{ public void keyPressed(KeyEvent e) { switch(e.getKeyCode()) { diff --git a/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/Location.java b/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/Location.java index affd51e..7ab6303 100644 --- a/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/Location.java +++ b/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/Location.java @@ -12,6 +12,7 @@ public class Location entityType = type; } + // what are these? public int getColumn() { return(column); diff --git a/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/World.java b/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/World.java index 6484730..f9a66f3 100644 --- a/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/World.java +++ b/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/World.java @@ -3,6 +3,7 @@ import java.util.Scanner; public class World { + // lots of variables can this be changed?? public static final int SIZE = 10; public static final int ORCS_WIN = 0; public static final int ELVES_WIN = 1; @@ -30,139 +31,133 @@ public class World // objects in the array. The type of character in the file // determines the appearance of the Entity(O or D) or if the // element is empty (spaces become null elements) - - public World() - { - aWorld = new Entity[SIZE][SIZE]; - int r; - int c; - for (r = 0; r < SIZE; r++)//creates each object to null - { - for (c = 0; c < SIZE; c++) - { - aWorld[r][c] = null; - } - } - aWorld = FileInitialization.read(); + + public World() + { + aWorld = new Entity[SIZE][SIZE]; // this is null anyway + aWorld = FileInitialization.read(); // refactor 1 this could be de-nested for readability - for (r = 0; r < SIZE; r++) - { - System.out.println(""); - System.out.println(" - "+"- "+"- "+"- "+"- "+"- "+"- "+"- "+"- "+ "- "); - for (c = 0; c < SIZE; c++) - { - if (aWorld[r][c] == null) { - System.out.print("| "); - } else { - System.out.print("|"+aWorld[r][c].getAppearance()); - if ((aWorld[r][c].getAppearance() == 'O')||(aWorld[r][c].getAppearance() == 'E')) { - loc[i] = new Location(r,c,aWorld[r][c].getAppearance());//Initializes each Entities location/type - if (loc[i].getType() == 'O') {//this checks the type and counts +1 if it's an orc - orcCounter++; - } else if (loc[i].getType() == 'E') { - elfCounter++; - } - i++;//Cause each initialization of the loc[i] to go to the next element - } - } - } - System.out.print("|"); - - } - System.out.println(); - System.out.println(" - "+"- "+"- "+"- "+"- "+"- "+"- "+"- "+"- "+ "- "); - sortLocations(); - } + for (int r = 0; r < SIZE; r++) + { + System.out.println("\n - "+"- "+"- "+"- "+"- "+"- "+"- "+"- "+"- "+ "- "); // removed unnecessary print + for (int c = 0; c < SIZE; c++) + { + if (aWorld[r][c] == null) { + System.out.print("| "); + continue; + } + char currentCellAppearance = aWorld[r][c].getAppearance(); + System.out.print("|"+currentCellAppearance); + loc[i] = new Location(r,c,currentCellAppearance);//Initializes each Entities location/type + if (loc[i].getType() == 'O') {//this checks the type and counts +1 if it's an orc + orcCounter++; + } + if (loc[i].getType() == 'E') { + elfCounter++; + } + i++;//Cause each initialization of the loc[i] to go to the next element + } + System.out.print("|"); + } + System.out.println("\n - "+"- "+"- "+"- "+"- "+"- "+"- "+"- "+"- "+ "- "); + sortLocations(); + } // Same here this could be de-nested - public void sortDead() {//supposed to try and sort null elements and bring them to the end doesn't always work as intended - for (int i = 0; i<=elfCounter+orcCounter;i++) { - if (loc[i] != null) { - if((aWorld[loc[i].getRow()][loc[i].getColumn()] == null)&&(loc[i+1] != null)) { - loc[i] = loc[i+1]; - loc[i+1] = null; - if(i-2 >= 0) { - if(loc[i-2]== null) { - sortDead(); - } - } - } - } - } - } + public void sortDead() {//supposed to try and sort null elements and bring them to the end doesn't always work as intended + for (int i = 0; i<=elfCounter+orcCounter;i++) { + if (loc[i] == null) { + continue; + } + if((aWorld[loc[i].getRow()][loc[i].getColumn()] != null)||(loc[i+1] == null)) { + continue; + } + loc[i] = loc[i+1]; + loc[i+1] = null; + if(i-2 >= 0 && loc[i-2]== null) { + sortDead(); + } + } + } // and potenitally here - public void sortLocations() {//puts the elfs in the beginning of the array, checks if there is an orc before and elf and if there is it swaps positions in the array - for (int j = 0; j<elfCounter+orcCounter; j++) { - if (loc[j+orcCounter] != null) { - if(((loc[j].getType() == 'O')&&(loc[j+orcCounter].getType() == 'E'))) { - tempRow = loc[j+orcCounter].getRow(); - tempColumn = loc[j+orcCounter].getColumn(); - tempType = loc[j+orcCounter].getType(); - loc[j+orcCounter].setType(loc[j].getType()); - loc[j+orcCounter].setColumn(loc[j].getColumn()); - loc[j+orcCounter].setRow(loc[j].getRow()); - loc[j].setRow(tempRow); - loc[j].setColumn(tempColumn); - loc[j].setType(tempType); - } - } - } - } - public void attack(int index) { - if(((loc[index].getType() == 'O')&&(aWorld[tempRow][tempColumn].getAppearance() != 'O'))||((loc[index].getType() == 'E')&&(aWorld[tempRow][tempColumn].getAppearance() != 'E'))) {//makes sure it's not attacking it's own kind - turnSinceAtk = 0; - if((loc[index].getType() == 'E')&&(aWorld[loc[index].getRow()][loc[index].getColumn()] != null)) { - HP = aWorld[tempRow][tempColumn].getHitPoints(); - aWorld[tempRow][tempColumn].setHitPoints(aWorld[tempRow][tempColumn].getHitPoints()-Entity.ELF_DAMAGE); - HPAfter = aWorld[tempRow][tempColumn].getHitPoints(); - if (GameStatus.debugModeOn) {//attack data for elf attackers - status.elfAttackDebug(tempRow, tempColumn, loc[index].getRow(), loc[index].getColumn(),HP,HPAfter); - } - if (aWorld[tempRow][tempColumn].getHitPoints() <=0) { - aWorld[tempRow][tempColumn] = null; - orcCounter--; - sortDead(); - if(loc[index] != null) { - loc[index].setCanMove(true); - } - - if (orcCounter<=0) {//gives the game an end condition if there's no orcs left - System.out.println("Elves win no more orcs left."); - programRunning = false; - if(GameStatus.debugModeOn) {//lose condition data - status.orcLoseDebug(orcCounter); - } - } - } - } else if((loc[index].getType() == 'O')&&(aWorld[loc[index].getRow()][loc[index].getColumn()] != null)) { - HP = aWorld[tempRow][tempColumn].getHitPoints(); - aWorld[tempRow][tempColumn].setHitPoints(aWorld[tempRow][tempColumn].getHitPoints()-Entity.ORC_DAMAGE); - HPAfter = aWorld[tempRow][tempColumn].getHitPoints(); - if (GameStatus.debugModeOn) { - //attack data for Orc attackers - status.orcAttackDebug(tempRow, tempColumn, loc[index].getRow(), loc[index].getColumn(),HP,HPAfter); - } - if (aWorld[tempRow][tempColumn].getHitPoints() <=0) { - aWorld[tempRow][tempColumn] = null; - elfCounter--; - sortDead(); - if(loc[index] != null) { - loc[index].setCanMove(true); - } - if (elfCounter<=0) {//gives the game an end condition if there's no Elves left - System.out.println("Orcs win no more elves left."); - programRunning = false; - if(GameStatus.debugModeOn) {//gives data for lose condition when no elves left standing - status.elfLoseDebug(elfCounter); - } - } - } - } else { - loc[index].setCanMove(true); - } - } else { - loc[index].setCanMove(true); - } - } + public void sortLocations() {//puts the elfs in the beginning of the array, checks if there is an orc before and elf and if there is it swaps positions in the array + for (int j = 0; j<elfCounter+orcCounter; j++) { + if (loc[j+orcCounter] == null){ + continue; + } + if(((loc[j].getType() != 'O')&&(loc[j+orcCounter].getType() != 'E'))) { + continue; + } + tempRow = loc[j+orcCounter].getRow(); + tempColumn = loc[j+orcCounter].getColumn(); + tempType = loc[j+orcCounter].getType(); + loc[j+orcCounter].setType(loc[j].getType()); + loc[j+orcCounter].setColumn(loc[j].getColumn()); + loc[j+orcCounter].setRow(loc[j].getRow()); + loc[j].setRow(tempRow); + loc[j].setColumn(tempColumn); + loc[j].setType(tempType); + } + } + public void attack(int index) { + if(((loc[index].getType() == 'O') || (aWorld[tempRow][tempColumn].getAppearance() != 'O')) && + ((loc[index].getType() == 'E') || (aWorld[tempRow][tempColumn].getAppearance() != 'E'))) { + loc[index].setCanMove(true); + return; + } + turnSinceAtk = 0; + if((loc[index].getType() == 'E')&&(aWorld[loc[index].getRow()][loc[index].getColumn()] != null)) { + HP = aWorld[tempRow][tempColumn].getHitPoints(); + aWorld[tempRow][tempColumn].setHitPoints(aWorld[tempRow][tempColumn].getHitPoints()-Entity.ELF_DAMAGE); + HPAfter = aWorld[tempRow][tempColumn].getHitPoints(); + if (GameStatus.debugModeOn) {//attack data for elf attackers + status.elfAttackDebug(tempRow, tempColumn, loc[index].getRow(), loc[index].getColumn(),HP,HPAfter); + } + if (aWorld[tempRow][tempColumn].getHitPoints() >0){ + return; + } + aWorld[tempRow][tempColumn] = null; + orcCounter--; + sortDead(); + if(loc[index] != null) { + loc[index].setCanMove(true); + } + if (orcCounter > 0) { + return; + } + System.out.println("Elves win no more orcs left."); + programRunning = false; + if(GameStatus.debugModeOn) {//lose condition data + status.orcLoseDebug(orcCounter); + } + } else if((loc[index].getType() == 'O')&&(aWorld[loc[index].getRow()][loc[index].getColumn()] != null)) { + HP = aWorld[tempRow][tempColumn].getHitPoints(); + aWorld[tempRow][tempColumn].setHitPoints(aWorld[tempRow][tempColumn].getHitPoints()-Entity.ORC_DAMAGE); + HPAfter = aWorld[tempRow][tempColumn].getHitPoints(); + if (GameStatus.debugModeOn) { + //attack data for Orc attackers + status.orcAttackDebug(tempRow, tempColumn, loc[index].getRow(), loc[index].getColumn(),HP,HPAfter); + } + if (aWorld[tempRow][tempColumn].getHitPoints() >0){ + return; + } + aWorld[tempRow][tempColumn] = null; + elfCounter--; + sortDead(); + if(loc[index] != null) { + loc[index].setCanMove(true); + } + if (elfCounter>0){ + return; + } + System.out.println("Orcs win no more elves left."); + programRunning = false; + if(GameStatus.debugModeOn) {//gives data for lose condition when no elves left standing + status.elfLoseDebug(elfCounter); + } + } else { + loc[index].setCanMove(true); + } + } public boolean checkPerim(int index) {//looks at all the spaces around the current index of loc[index] looking for things not null if (loc[index] != null) { for(int r = loc[index].getRow()-1; r<loc[index].getRow()+2;r++) { @@ -184,6 +179,7 @@ public class World } return false; } + // these methods could be broken up into smaller ones public void move(int index) {//changes the value of aWorld[][] must set old position to null then update it to the new position. if (checkPerim(index) == false) {//checks the perim for things not null if it finds something it returns true and the move code below doesn't run if (loc[index] != null) { diff --git a/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/refactor_1_test.java b/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/refactor_1_test.java new file mode 100644 index 0000000..872812d --- /dev/null +++ b/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/refactor_1_test.java @@ -0,0 +1,49 @@ +import org.junit.jupiter.api.Test; +import java.io.ByteArrayInputStream; +import java.io.InputStream; +import static org.junit.jupiter.api.Assertions.*; +import org.junit.jupiter.api.*; + +class refactor_1_test { + private static World world; + + @BeforeEach + void setUp() { + String simulatedInput = "Assignment_1/refactored_code/assignment3GUI - Classmate's/src/data.txt\n"; + InputStream originalSystemInStream = System.in; // Save the original System.in + ByteArrayInputStream simulatedInputStream = new ByteArrayInputStream(simulatedInput.getBytes()); + System.setIn(simulatedInputStream); // Set System.in to the new input stream + world = new World(); // This will call FileInitialization.read() and use the simulated input + System.setIn(originalSystemInStream); // Restore the original System.in + } + + @Test + void testBoardInitialization() { + System.out.println("Test 1 running."); + assertNotNull(world.aWorld, "Board should be initialized"); + assertEquals(World.SIZE, world.aWorld.length, "Board should have correct rows"); + assertEquals(World.SIZE, world.aWorld[0].length, "Board should have correct columns"); + assertEquals(4, world.elfCounter); // check if right amount of elves and orcs + assertEquals(4, world.orcCounter); + } + + @Test + void sortDeadTest(){ + // not sure how to test because the comment just says doesnt work as intended?? + } + + @Test + void testSort(){ + //in data.txt the sorted array should be OOEEOOEE + StringBuilder afterSort = new StringBuilder(); + for (Location location : world.loc) { + afterSort.append(location != null ? location.getType() : ""); + } + assertEquals("OOEEOOEE", afterSort.toString(), "Locations should be sorted with Orcs before Elves"); + } + + @Test + void testAttack(){ + + } +} \ No newline at end of file diff --git a/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/reworks.java b/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/reworks.java new file mode 100644 index 0000000..6485581 --- /dev/null +++ b/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/reworks.java @@ -0,0 +1,60 @@ +//public void attack(int index) { +// if(((loc[index].getType() == 'O') || (aWorld[tempRow][tempColumn].getAppearance() != 'O')) && +// ((loc[index].getType() == 'E') || (aWorld[tempRow][tempColumn].getAppearance() != 'E'))) { +// loc[index].setCanMove(true); +// return; +// } +// turnSinceAtk = 0; +// if((loc[index].getType() == 'E')&&(aWorld[loc[index].getRow()][loc[index].getColumn()] != null)) { +// HP = aWorld[tempRow][tempColumn].getHitPoints(); +// aWorld[tempRow][tempColumn].setHitPoints(aWorld[tempRow][tempColumn].getHitPoints()-Entity.ELF_DAMAGE); +// HPAfter = aWorld[tempRow][tempColumn].getHitPoints(); +// if (GameStatus.debugModeOn) {//attack data for elf attackers +// status.elfAttackDebug(tempRow, tempColumn, loc[index].getRow(), loc[index].getColumn(),HP,HPAfter); +// } +// if (aWorld[tempRow][tempColumn].getHitPoints() >0){ +// return; +// } +// aWorld[tempRow][tempColumn] = null; +// orcCounter--; +// sortDead(); +// if(loc[index] != null) { +// loc[index].setCanMove(true); +// } +// if (orcCounter > 0) { +// return; +// } +// System.out.println("Elves win no more orcs left."); +// programRunning = false; +// if(GameStatus.debugModeOn) {//lose condition data +// status.orcLoseDebug(orcCounter); +// } +// } else if((loc[index].getType() == 'O')&&(aWorld[loc[index].getRow()][loc[index].getColumn()] != null)) { +// HP = aWorld[tempRow][tempColumn].getHitPoints(); +// aWorld[tempRow][tempColumn].setHitPoints(aWorld[tempRow][tempColumn].getHitPoints()-Entity.ORC_DAMAGE); +// HPAfter = aWorld[tempRow][tempColumn].getHitPoints(); +// if (GameStatus.debugModeOn) { +// //attack data for Orc attackers +// status.orcAttackDebug(tempRow, tempColumn, loc[index].getRow(), loc[index].getColumn(),HP,HPAfter); +// } +// if (aWorld[tempRow][tempColumn].getHitPoints() >0){ +// return; +// } +// aWorld[tempRow][tempColumn] = null; +// elfCounter--; +// sortDead(); +// if(loc[index] != null) { +// loc[index].setCanMove(true); +// } +// if (elfCounter>0){ +// return; +// } +// System.out.println("Orcs win no more elves left."); +// programRunning = false; +// if(GameStatus.debugModeOn) {//gives data for lose condition when no elves left standing +// status.elfLoseDebug(elfCounter); +// } +// } else { +// loc[index].setCanMove(true); +// } +//} \ No newline at end of file diff --git a/out/production/501-gitlab/Entity.class b/out/production/501-gitlab/Entity.class new file mode 100644 index 0000000000000000000000000000000000000000..1a7225408c2d8713f9069a3d35ecc3c6127ad800 GIT binary patch literal 1769 zcmZuyU2_^`7(Fj65a=dB(qPjhO4U}fZG&m8U#Y3MAq`3b4U|cHVcgIix)qiTEIR!= z-gx7Uj)^l~_yhb=PS3Nu4Vw%%?4IX&pL3qCclq!CfBpqv;%Npk#8c38B#>0dzOsI{ zN<GW%mg>i^?2f09eCW82x1|s-uC>#cK{|zujw{gVtGJ%yy;ewDo@aG_a@?+hdY<8_ zIUV!JD$I^-uY7W1TSLq3*a}+FTx-jLoQ?%tRnU20*YO$y$Mr_yuLd%C9q;0rLdJ?j zD^oJKu45T1RDC&#Q&sW2r{jI`Bwtv4t80tS4ILkdPMSK~zBP@Ha5IHlIzC46Le0(B zBhT)$)WMjQFV_5SID=AS$mE*d(6;)UGcXjE1ExZMJn{<1c44D17#6zpd-gDcJGh&| zx{eY)QCOHlqL4Zf%AQM=Vj$x;of_=n=2}}Jw_VvOKdrTn%8f>)d{EvuE9|B@a7Uiy zdTpyWw&R@PA+xR2cI1`*L}jnhdM2Pid;P$a*E*Z{mTb2n7DWr4N89DS^5cqF;<S(^ zVo9-!awdq#$gt@T&^+g44qkAa^EJn{_s9KXd)Ts$d$i<ggO1f}TSG^1Xw<xy4u?Ba z3l?URmALjV(Y;6(%_=9)eV`+<4{5@n*^KF4+$C<L$-&b4_5>|eQqU5im~F~#?pY^c zGMVOJJnYyzj--1f$Y@=rgd5zK7`rixC2Zgt6z&nlaG&_o2!25PSp<Jh{6z$RN&FR7 z&f_<UA4c%k#9I;ki1?cbE)#zn!6tLyW$<(1=KD|XIiHY=$lo-zc!T-7O;qQ3#pj~& zH<S@SMasw?o?+I|&hXA3bi`2MZ=NCGWzcv-(zwYBdka^2DRyYp0|Gq8E|HLDLvoAJ z(xjyc`SK~Hv{Rarr&yf`TxUjr5enSK9IwU#?y{0~UnCz8g(9Rx)$gLneHY4&c}BY= zC#9^Op<t|Bs3(xy2<7fk?mp#Ya1VSrNkl|~nkI7c_C4F_SA`ni;uPP*ewaduPibeu z_zR1_^Cf7XbQ_%Gq+N;gcGc0C61;jj*qj>tWNPrz<>1|^!Tjom%3I7+N=h0spUG6@ zn-7+kV1bf*FoooKTaw`vV)Ee(xqb|}^2^$<nEMkS=GM+|`!~!8w?FZ?zfw8B#RueW yF^@wm;(0_Pf3A`D+pKUveGRd!MjiegOv`-fa^^pf{V2j3&0NMP!)lT@hSnPki2kww literal 0 HcmV?d00001 diff --git a/out/production/501-gitlab/FileContainer.class b/out/production/501-gitlab/FileContainer.class new file mode 100644 index 0000000000000000000000000000000000000000..2ecbbcf4ff40baf66ca4ce50e0e643693e3c1f2d GIT binary patch literal 696 zcmZuu+fKqj5ItK86=(%20^<D*s<9t{@j()wh$d=CeB8o<CACdz@w+sUnE2oa_)*5$ z(v(ZcCNr~V&p9)h{r&s?0no*90SYo2R2^C57|Ij=#%+)LWBbmTh(W}VyL5dwx?;$* z+WkDXkk?SqQH0K5+_;|T27bg{UxW;bL!r@&P29k~o{mN$6vKPLha&7q@wSc<%ETNI zvzjucPr_obTPeQgkm5`HcAr7*21CJ6>d_dt(-%jCkKFMHF?+#)dwm|d@}7Wd^z6P$ z_R91fLilPwh9X~dVyKKow9aU@+UZoQZ)9kYVA-IyL|))TEIb6$a3CZ`L(7zI^+IkF zr?fkTzD%J*tB)&MB;^bk{auBkNw+8YpOj117npT6gJzx2V0^@a9f~GYibaY#@-VPX zr%K4lT!vlL=tc&p6NAN7gBmGR@1dEru_?>9tn~@)oeBlgJQsszY&aKZ6GMi59BdF9 N>*D%G@nPKJ=pUq3h^7Dl literal 0 HcmV?d00001 diff --git a/out/production/501-gitlab/FileInitialization.class b/out/production/501-gitlab/FileInitialization.class new file mode 100644 index 0000000000000000000000000000000000000000..55f7e6375b1e5bf7b59a8bef35d2a4ca2d887255 GIT binary patch literal 3374 zcmaJ@TT>h78Gb$?X(h1)Sq2AeaO4I%2r$%+O&iJJg9^4{0S-7|jO}`n7PCg|Dyx+X zY2x&hp3_6pByM_0(;F^&<K_Z9W+oS%X*$!3-gWv5`Y$?FpKn*z!C^X@Py3zT)AK&> zyZiV5KK=|q8lObqLyH2xiU5KF(Yx9`ZKR-?cSdHG@9H^6Ab7?w4QE`Sr9UyRAS4i2 zu<Sx!K|~<3w3MAN9mCm7MWCWh!80n_5fz9{8U;N=Nkc0buWOEBnF4BVRnM&%<{fz` zFxH=S?HSg{h4RXZZtMA3UCZlss<tmLR`(KFxky{4qZuaeL=eM%1sy6naX_H0=~Q6f z9o=cxDsZqrQPbRf=4$Iw(T#&tMbWxpfddU<^?i!;pjW|R70)5gTYJYM5V9FmmOcw~ zJkjJrJm=WNA{EA$@VtUP6-RNbDF<_#B}ZQ;^j4Xf=&bpEg>nw1b!|NrLchSFiS?qh z8DAklLvhn`R;f4cSaE4Nf&mOF7*cT@!vg!CxY?jYKq*R<1?H%;nv_Nl6Y~*#87CB+ zRPiECHT&oWL7wDRHTyi>^!H~HX~~9B6<@(uW!CA2qkB9NXzfoY>ZC~`rQnQ;F-gDJ z6W{76lWw_!Rnirl73gg|pSGMyt8C^cHgbAV@+*Y%1iM_)?cuy(M~G@##n&)FlT7Fp z+bZg|vng<FuLwPC8-tFqLN2PfBo#cnuB}Px<uqr(a8@}hIhyH|6ujJkXlACtm#o0) zi#my_72LeU4YOEw;ziq9F6irSW@M76$9CkTXq8wjRIFf{>~$k8J4Rt-E~l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T@`;`2UZ@Z6i(FM0itFyFN#yw_cf>yqP4f=N0mEWM>Z=;P~ev=;F zr&n*_O@yc+#MyoRhw%V!xk+fn2ly863C8dqzK!oN%lq&Pd>7wiIy>+VHGLlne!zHt zh){(FLJGnPg95jE6eJZkdsL{QdO!{|9Rz9z{1T~4^i~k9ojfJNFVQ`W2nFNU6lB8m zoS&f{oy0jJ5TY}AF|~`S#ZNJ_gSlyu^tX%#Is+deE%Q0QjcdoZv6S@hBDvV@-@&cy zE_xORcX0c%e>AXF`ByUNF+!1yP-={*e71|&;s7t^riLEUW*5#7=kY2NCW#i1CE`;= ze41X(U_Y+#)>Rh5t2l;vLbbpgU!&YDN?vD9Z?FyB<moN$YFOq^mdq^UxKz!X!do3g z{7q(ovALPygfp2L_IAq1%=mbJf!_^3qCZjE{4sOsrw6a#C-^CIDf4z1EfsDBYv3!G zVgi|`H6q$YH2Edxp^3jxMppbakv;e)J}+{#aKt$-a7=KV;F#e!vWu0)=u9*c+`(#g z3rF4cM6^AscpDvpyY0mD;A5=01vdDQa$XG$xcoC{?JnzOomx#+#%r`<(~3jOWxPyY z&y&Xzodcd<F6U*#nJ1Uuq1Q4(ej@w_eF|3EqyARv{~7mu_&IqD^4iDx5%{J1{~mtB Oy$IL8#qaS4bpH?FS0EYy literal 0 HcmV?d00001 diff --git a/out/production/501-gitlab/GameFrame.class b/out/production/501-gitlab/GameFrame.class new file mode 100644 index 0000000000000000000000000000000000000000..3144fff124a737ed4b425d223ca68a638f4aac0a GIT binary patch literal 641 zcmZuvU2oGc6g_UzrcJ#Mx^KqUfNiM<%?~KrOQ#`F1!%2;;LU3dcuSKiaks(0+Dj%4 zi66j^LR`1io+c~T@jb`q9$)+KzuP|mItYD~;COI3%BV0j&g6x>3iC^yd=K9rXL6(% zDsOb6%^`ymG$RjHhT2;KKFLJIK0G)+>fjz0I2N%qN9TJTIUF*GplgLgd1=B<IvS^m zN=&<XU$Tk^4CP)T&y|&3;aJ5QLp4{XuT4yL*5+cdB#%9lk=1rHvg8epO>8l268T7d zlattV;xtzu$10OXrwM}_yqj^iIUeCL11Ii@%JnaKYQ^2)>kNO&@yy~r;gQZYp|-?x zju*C3?pO}aZDN;W5Bubbc-?d`Epwt`nlDs8W!Sj?=n+YD(jiq`>gq&&n2b(U)}MK3 zSe-bMnYQbB(ltMH&QR~#)=!(;CUd=Xk`2_cw$>N#kd|#WcF0|cZW&<o(e=_C(BDru z(@ZFCz{GEOUv5w<;C~j4<pK>+DX=cw0uOC?A`0vXR^a6|Z7rcmaSt_$E{!slNp_vy gz&5JXuNrpY6Q_<A79fblXQgm}SF~byO|gX5e|}1ci~s-t literal 0 HcmV?d00001 diff --git a/out/production/501-gitlab/GamePanel$MyKeyAdapter.class b/out/production/501-gitlab/GamePanel$MyKeyAdapter.class new file mode 100644 index 0000000000000000000000000000000000000000..d10864080b129a4b78920b5ddbc727c517cc5e25 GIT binary patch literal 1197 zcmZuwTTc@~6#k|ZmM#mFQf`V`6}2rw!3!uw6uC<a#FCOIF9RLRO1n#Tryy_s4PuP? zgx5q7G4a7CpZrnAGh0$2_%JhjX20{D?_B2hpC3N~jA1SSAF4F?4OF9sp>>KE#R9iP zp)0*TE4D{-d_xL{p+>HmZdV^eU8({}>ZnCPgKnS>21CbFzR44OOD4pouw>$x|FCJ9 za)hBO8q4ZvK%<7BfhL3)+D`gSC;|pOFC?*y**W2P&IAxfi-uMMZD?l*RJ1TuZ`n>E z$DpN_)JHOaQ#h@m)4&;=rQhByL&Jt+=N(>rSh6hB$}_M>iZo*2JT4GSnnjgwb4rPN zmT<QSlvq@klx`O;X}E0Qib}WX1cKaM$sHL$3~>$J2Ck~mx>A{uT$Ws_Urwx)@@dLw z-U^@>2@QP)`f-gR=+&XXDPU&Xm7+*F+a)SPizg;w+KC0nv}8s)f)|suxWUjkuIM5~ z;)@i-6RBeWgBorbxQ!u7!=pUzNF~}(GzE*8qh;!HP)XPMWGq{YVTRBVW@?6T1QoX- zdZhiaEQ7z?o5qxBiMdj7ML3Imr9j;ZrR-H+$a2S2_Ti;pO%X%;Kayi(mZTb_g<P|9 z3!GXcC@7)zb+NtR2-j5tIu8XOn=)@&NH;Z;B6pNi`VWGkp4zawp5_~eg7l1Ca#qEp zsU$a4rm0tzjiGi<xN_QdsRhQ2WeI1jz)1#aGLF6unj9a!1b_vD>KW0O57cSgp>u?+ z5juTz>hbPxVDazJzId3swAT<4c!7Jgx0X>D#eK2}@3Ap@r$9Bqo(Bm$jtSZo?XN@H z<?aL2e^3s<5-k-fLaUS3IIV&BKG;5*_tCL~{<3lI02g=BwTI{qLVM^5T|dChs;`Ld zqEVSiGW}#Kp;b^qdnqB{B{9E34_;#sZ!m;i68;v`c!w0;V;&z#!6!V%=OYO%R}xyr jB&JCHG%?k{AL$6!5&H~TK0LszcZP{crOxOsj5OF^OsWjH literal 0 HcmV?d00001 diff --git a/out/production/501-gitlab/GamePanel.class b/out/production/501-gitlab/GamePanel.class new file mode 100644 index 0000000000000000000000000000000000000000..8c927200acee848167a852912edf89ec881e9072 GIT binary patch literal 4923 zcmcgvd0ZUj8Gb%km}N7-h8QEslAy*&mKc=uP{3$HLO>y4h(v<N4!aYWFwCs8vq|u% zT4Sr#wpwp(Y&>dOt=7=6w8m<0t-UYX+WT(peOtB1^UcgIi=qAX*FVaS-S2w8_j`}$ zeZFs>{m0`^0%*rSA}B$rf{=<blnd1C)OKlmnlif$YozI{KF!iif$}!PGTgNSr41_w zDiB76f{2QFPz5SBY2$hzSGGYnwFv>yC55U~RC^NR_Ab5M&RVX5`2uCzY{yJR5Jjn! zI!eVt9L?$7a#}#?_SRb!93wDaTGNzu4YR2~saclpRA4cdD2S=3!%~5$Ctzwcwtphy z>f-_>h9$7D+gmW~rY<X;b^BdM*T!2TScH1%=&=IFG|VaD`**xlzg%E}FH>v)4O<a} zsY%=IHf=D*bt_}oRs<)YK`LKKXBxV?Rt`kyUZaXtIEjX4bhppZcj%6zr}~Xcbb&>I z1+%oYN&}j3vVv1oG-HiGmFI~RYPU_>5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dkJOyXFU1H@uOODGSg4&3a9*u$RJ}>p6DG6#i9$? zl*OV-BAn=L33+RE(TH60o3gszma@ZW8jLQSk9(qvr*UaZc|PDV#>x+KZMlqcES#vL zs%UkzCWklVV?S&5s>VPxT1nZ8L^!HQ(b`aL8CC4f?+M1&HcHcq<YKe8QMEj>Izf|X z`jv?su9wCHYn2J<t|wMl;+}A7X6MXs4hilL(<yE!DD(~pydP@}K*F)vOz4=+IlS$0 zyaR~U<#5|fMO?^VdO#Oq1i>1dO*nM3*F)rQ=4-qc2F^hmTW|$m`PXpv7MAZm3=kgM z@CeT1D`k+JH-w+zd{Kf6#ByB7YPm>kK|)-NVGlZ;ewOnv5l#RTW**=7LB!q<JYdDd z0Dg!c5o~M38Tc`KWoQ>o_zA6(WWg78P?IlkTu$_K_~;>6BzTUR3p|Ps9@%){IT9?B zxNA0As%54Adk7RzMY*y68WGC>j0kV%{|6D9v4Dusv4p>unlVDE7$qtUqGBg=Z8E3h z99jGkWaBDg<3?P}mv;t-NgvN4ix;s=#P~yI1@?%InD7v=*3VP{0UZSdbQBQK5g=fR zXbce0ERG5gAn;Qn%)8%&Mf#B}{)~k9;34b_C8n@1Am&5Z?<4<yR@!}7G>HfA;#EM& zSPt*=IPrPT-HBQ`$4@1vd9gjlZch#$@YYtvskTz8t&~!{J@?7>5OQ(@>3!ZL9<O;a zhmXjyzjVLf>`#;@?nT(Yac9)}i~FLHd%Z)Y%1=ohpQa93i#|nf_ip#gNYR(`V!eWw z=9SFA<s{;(v6jT##R}}<Z@R6xmbG~uQvC5|;(A<)8z^xj$@wPi$IYzGTktS$#WZfi zQzY}Jai^DsdY)6w>-gsZaX*vK2Os*szzdA8B<?Cn+|}YZvh|YHu@$VuUvjntzrwHC ihA7pB->?^E@Av%t7Jucah7xU@dyzAL!^`+PYX1dbsgC6U literal 0 HcmV?d00001 diff --git a/out/production/501-gitlab/GameStatus.class b/out/production/501-gitlab/GameStatus.class new file mode 100644 index 0000000000000000000000000000000000000000..81e4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}`+e1EUiTs;2%^voRE`1nOr_6dL56Cc0ei@lFp0#W7bxZy;Smp8ZKc`~TF zRv5}K4c^PSV>R`ong;8-^v|KZd~scv;iELbXP9q+dY0&A=<_Fs_6?3o{0e@DuKfn_ z6P*FPNvoEDLA*tqiv#dB-r*>N+nvpG8k%!IBb^`l6=MoOXaM!|rh*M*IkSi|t;+X1 zLDT$J)RqFb@OyFU0Ox^tFkMI;;9`4J7&^dIXE1z#%X-iyI!Q8$qJa?<Fp61>vEtKs z7iTp2<v3eHo_V=a(FIlT9zDgfg7^79sJ%P%Qrf#qZ%BJpdP<Oc{i`s$Ra|LP)m6;4 zN2-cqXTU1v`c`q4Rh(lL1y(W6D$bMZ#Q$E!67DBw@dImC6&BT5ywt5?zD-qEv2cW| z`V|Ex$@L<cPLb<n&GA-@)ls^L2h>fqQ4!1Zl+s14&{Ikm@d3RQ*FWsf=USJ~jeo&s zhJ3DQ<z}g_YTN(Hr-s!;pCxiutVdLj9^mC8Lc}e8mCZM=6OPBh9RWu0PzxZib`s>x zzL3`ldHn>)bq#6Yqs}Fq)*AB$5B`Eu_X5T@c!**@VhID-z+-;bc};w7_*mN~+J36- kQ*FP{_A6~IZEbC(wmaH7+U{xFK#QpAitpn&zQcvT0nQsd{{R30 literal 0 HcmV?d00001 diff --git a/out/production/501-gitlab/Location.class b/out/production/501-gitlab/Location.class new file mode 100644 index 0000000000000000000000000000000000000000..802582b623ee6e0f7bbbf0e97423d36954b100e3 GIT binary patch literal 1160 zcmZ`&O>YuW6g>}ynKBOjptUWu)ne5SV_Vd%rW+Cy64XQ+7VHL`)M;SG(4kHLlN%F> zi3@*#KgxLSgHb|;&3pHqx%b?2&xPNAe*OZ`#7i4F<SiHu3NRJculyUoG4P|y#{1q? z&`%W1*I^VU=L&hZ-YH@QMGLlrdvFw1+Hv1c!Z=c}`hN5_z6lgmSF%<etYMv1qxhCs zOR%zoO~K55JQxonf$lrl#*Ts=L`j(3UEF;Uh9+~|R;yX>C>YK76S1{+7zOXf!(K4D z@OuLyWobU>_@hwXGtfvrhu5TQr^;TDDhh5th>9YErfyBzM7Jtl21yEWz!tNK=xmF@ zR1ZH;k#(KE4Oc6(2{hBG4Y#Y+4z&li(59bQ-eq&iPMf<eNj3@TR`$nuJn9E;LYb?S zN<WijphlN+T$aI;jxx%Li~6Q@`sOlt7ooVtU7i)b#>_K#SG*rko-u*t?M+bf_9xiz z4kp<8rc0|lt1x*MnQrm4vC8dkl5!U%?D2~?CBi-q_#!19P=M0WLq;O6f<ubQ6RqLV zOhSXVWEH&c*!apI$5vo70n3`&nI_Dr6^=5CON+%jnZ=Lsgmg0eeCMsj;%a8`QykBV zJGR3eto8-R&T2SElV$1e4>z^&Awm?R9QP1MC{#!ofIwV(Z375wO2-h>5%(&)< wvKEIr${gwxXIVlv7KI#Bh`U6HY*>Uevbjo&Tqoo@UBWf}-6%Y#eL1}N3j)%JSO5S3 literal 0 HcmV?d00001 diff --git a/out/production/501-gitlab/Simulator.class b/out/production/501-gitlab/Simulator.class new file mode 100644 index 0000000000000000000000000000000000000000..04efb73c6b631a816f41e51649085a1e51f9e344 GIT binary patch literal 402 zcmZusO;5r=5Pee$rKJLb!a*<Iz=J({z<43SOQVOH8slkOo4TYQ$=dS2JdtSP5Aa7B zXTg96_wXk3-o7_8U*GSa0OlAwFwn4Ix@e+B=r6@ec$p|t?=D&<aYbld$wF4wgvMkV zT4)pO8<8gq#o)lw?hbQ-%<D{4r6QQ~@;M>&d|4#7bsi<^UPKu)1HX(#778VG|4W+H zi+m+?{9VF~BXS`N!f5j3?>7o6C5v=64Otf|Wz+B<ncxIvt>R=M^~~-r_ChD&4EkjK z43IvW(dEwLN?e=gYtY+9K48=`Fh-Zr-F`q1eeP@=V!(_xUv9#f`+)VhhW)S)*iJh^ S8>fFlYz%S4M#3?pfzb~o5=$2V literal 0 HcmV?d00001 diff --git a/out/production/501-gitlab/World.class b/out/production/501-gitlab/World.class new file mode 100644 index 0000000000000000000000000000000000000000..0e7ce70287ebd826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#6*m7=fW<#{_$EV8o<AWiR&0 zP{@qr9Y0eRXR^ESDu9CoNQc>8?}cgOk5224<-F!SSeq5u{^<0IK0-v-mlqd4in$f? zyt>@ji%10@S8&ec@+lRJ-ixx+7iD=&_FXvBWBVki%cYD~NaZX`<4693>wRp~J9O*L zWVgh=@1XA>?e)6#bk;NQG=)6RSnS2+*vH!T7+b=A`t5OS;3vu5?3nlCAU0FJmGgGu z5T%DHIim5CPCJ=Cm;UPG6>y{OuhJ?GW-;YkE~fb>F;bnxXw?f#H`lx&MDthKT4!u$ z)8TscnH*&IcJ+yO$m8n6EC_qIsSmR6#M#(|$Fd}`CHZicWC`4jjijV%cxA;O?JJO+ z%+9((qT7@8V1FOMCUn3P@VVd5Z0&Cz2ZWRsBWfuVjpSt+nw%oNT+21dx|H3;-&`Er zh3+hEdvuP?yrO-{=H?umrPKazHa8EnnPk7sTH^tK^8h1Hv00brcF)q|kOOL<G_2!D z30nL4%OJ(D&rV^p{b_e@FXExbe$$G>{WWD7FaO}@Ljmu7r}49)f)%8ip9`&chX2d) zEN`06vD-e+EPjE{7jc4jy-#smmE#pP9<Qp4@tTU@b=HtKl#4gj?Kq(}<1MutZ>yL1 z&G!!8<wgF3{u-b@%f>6;`s3AvzZWNZ@kB4Kn8*nKHLWtZ+glt97`N~8_crzLLz-{D K#~*n&9ra(2iv}(L literal 0 HcmV?d00001 diff --git a/out/production/501-gitlab/data.txt b/out/production/501-gitlab/data.txt new file mode 100644 index 0000000..58bedd6 --- /dev/null +++ b/out/production/501-gitlab/data.txt @@ -0,0 +1,10 @@ + + O O + E + E + O + O + E + E + + \ No newline at end of file diff --git a/out/production/501-gitlab/refactor_1_test.class b/out/production/501-gitlab/refactor_1_test.class new file mode 100644 index 0000000000000000000000000000000000000000..6275ddd1152249ce19a35ebb157eb5a82215c4c6 GIT binary patch literal 2637 zcmai0TUQfT7~LlqCd3gjh=^J`Xba&Q(blS1TY|yH1`t84r7azj0R|^CaWVn1H``ik z@Bg7MKG$|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2bHTKAt6Ue;HZ@`m zq(<A9SG(KFAgq|X)kOlfUZq>jyfJMSP4XSGZO8LHMY_i_yPw&luV+fnE)t+c7BK&i zq^oD&U(b^KoaM4waiJ>nbkWdrvMuw?*Cf06X;pm91GVLGfqH$O1})ENeMX(iX(967 zNl(w-9MucH`ieX<QHeg}$$mB_osye1MogKn13OaEFI9)ef*s(!$jP!~^Q(?OUX1K1 z@hibMPXNN*PauBbM*z!w%3(mk3ZH6u0&ZiKE#MAE1ODRs2qMIuj+l~pg!<8^*mtAn zG4?+}%UItU4nIZPjVI84MSCw>Tj*^>mbgLQk_sBo#7n9LjcCVyl8pJgc9)SWy9RL_ zAK_y%;f;h(xF*0=P52a_5#=t?B;(Kd2EN$j_kd$Ej*&;`jFDL1Beeg9Q?b|9aJDg8 zZmh@NSi?}Y6+F2fOR=r^gO}FucKK_JUpx69M1-uHaEQEHc|#q>AdVo#n{`XIkqZC2 zWFZ-T$v1FslVJ~AlHoJbx7UD(T|vIu1o@j`%B)^~iV5mH$y_kZsnOo`3&GQ&=Fkg2 zqocPubn;xdr#1Ws8d}4T@y;4Pc!+Q;_Zain?}fy}jlW_`l*oz|*5JxegT4_C`^X&( zwUc4Safa^;=;kfa<1^Gaubnd7$JcZfIaIhtki-Lg!{EMU?-W8C{L2zna7@93g6{-_ z-k?%-H9ZPzzu@o&7wzm1_{#zts0TkK2vP6yw<YTLn|eG~)D!<Bs=yC~4B*Fq0WwN* ANdN!< literal 0 HcmV?d00001 -- GitLab From e0863597e3e809388191adf14b843be33559d112 Mon Sep 17 00:00:00 2001 From: Devon Harstrom <devonharstrom@gmail.com> Date: Sun, 16 Feb 2025 21:08:05 -0700 Subject: [PATCH 03/17] finished refactor 1 and the tests for each also compared it to the original. The refactor_1_test is for the new version and refactor_1_testOG is for the original but they are identical and the results showed the same. All tests passed --- .../src/refactor_1_testOG.java | 90 ++++++++++-- .../src/World.java | 131 ++++++++++-------- .../src/attackTest.txt | 10 ++ .../src/data2.txt | 10 ++ .../src/refactor_1_test.java | 83 +++++++++-- .../src/reworks.java | 74 +++------- .../src/reworks2.java | 39 ++++++ out/production/501-gitlab/World.class | Bin 5400 -> 5455 bytes .../501-gitlab/refactor_1_test.class | Bin 2637 -> 4846 bytes 9 files changed, 302 insertions(+), 135 deletions(-) create mode 100644 Assignment_1/refactored_code/assignment3GUI - Classmate's/src/attackTest.txt create mode 100644 Assignment_1/refactored_code/assignment3GUI - Classmate's/src/data2.txt create mode 100644 Assignment_1/refactored_code/assignment3GUI - Classmate's/src/reworks2.java diff --git a/Assignment_1/original_code/assignment3GUI - Classmate's/src/refactor_1_testOG.java b/Assignment_1/original_code/assignment3GUI - Classmate's/src/refactor_1_testOG.java index f612ac8..49d19d4 100644 --- a/Assignment_1/original_code/assignment3GUI - Classmate's/src/refactor_1_testOG.java +++ b/Assignment_1/original_code/assignment3GUI - Classmate's/src/refactor_1_testOG.java @@ -4,21 +4,33 @@ import java.io.InputStream; import static org.junit.jupiter.api.Assertions.*; import org.junit.jupiter.api.*; -class refactor_1_testOG { +import java.awt.*; +import javax.swing.*; + +class refactor_1_test { private static World world; - @BeforeEach - void setUp() { +// @BeforeEach +// void setUp() { +// String simulatedInput = "Assignment_1/original_code/assignment3GUI - Classmate's/src/data.txt"; + //// String simulatedInput = "Assignment_1/refactored_code/assignment3GUI - Classmate's/src/attackTest.txt\n"; +// InputStream originalSystemInStream = System.in; // Save the original System.in +// ByteArrayInputStream simulatedInputStream = new ByteArrayInputStream(simulatedInput.getBytes()); +// System.setIn(simulatedInputStream); // Set System.in to the new input stream +// world = new World(); // This will call FileInitialization.read() and use the simulated input +// System.setIn(originalSystemInStream); // Restore the original System.in +// } + + @Test + void testBoardInitialization() { String simulatedInput = "Assignment_1/original_code/assignment3GUI - Classmate's/src/data.txt"; +// String simulatedInput = "Assignment_1/refactored_code/assignment3GUI - Classmate's/src/attackTest.txt\n"; InputStream originalSystemInStream = System.in; // Save the original System.in ByteArrayInputStream simulatedInputStream = new ByteArrayInputStream(simulatedInput.getBytes()); System.setIn(simulatedInputStream); // Set System.in to the new input stream world = new World(); // This will call FileInitialization.read() and use the simulated input System.setIn(originalSystemInStream); // Restore the original System.in - } - @Test - void testBoardInitialization() { System.out.println("Test 1 running."); assertNotNull(world.aWorld, "Board should be initialized"); assertEquals(World.SIZE, world.aWorld.length, "Board should have correct rows"); @@ -29,18 +41,76 @@ class refactor_1_testOG { @Test void sortDeadTest(){ - + // not sure how to test because the comment just says doesn't work as intended?? + //but works in gui } @Test - void test3(){ + void testSort(){ + String simulatedInput = "Assignment_1/original_code/assignment3GUI - Classmate's/src/data.txt"; +// String simulatedInput = "Assignment_1/refactored_code/assignment3GUI - Classmate's/src/attackTest.txt\n"; + InputStream originalSystemInStream = System.in; // Save the original System.in + ByteArrayInputStream simulatedInputStream = new ByteArrayInputStream(simulatedInput.getBytes()); + System.setIn(simulatedInputStream); // Set System.in to the new input stream + world = new World(); // This will call FileInitialization.read() and use the simulated input + System.setIn(originalSystemInStream); // Restore the original System.in + //in data.txt the sorted array should be OOEEOOEE StringBuilder afterSort = new StringBuilder(); for (Location location : world.loc) { afterSort.append(location != null ? location.getType() : ""); } - assertEquals("OOEEOOEE", afterSort.toString(), "Locations should be sorted with Orcs before Elves"); + assertEquals("OOEEOOEE", afterSort.toString(), "Locations should be sorted like this"); } -} + @Test + void testAttack(){ + // create world and tell them to attack + String simulatedInput = "Assignment_1/refactored_code/assignment3GUI - Classmate's/src/attackTest.txt\n"; + InputStream originalSystemInStream = System.in; // Save the original System.in + ByteArrayInputStream simulatedInputStream = new ByteArrayInputStream(simulatedInput.getBytes()); + System.setIn(simulatedInputStream); // Set System.in to the new input stream + world = new World(); // This will call FileInitialization.read() and use the simulated input + System.setIn(originalSystemInStream); // Restore the original System.in + + world.tempRow = 0; + world.tempColumn = 0; + world.attack(0); //elf will attack + int Hp = world.aWorld[world.loc[1].getRow()][world.loc[1].getColumn()].getHitPoints(); + System.out.println("health after attack: " + Hp); + assertTrue(world.aWorld[world.loc[1].getRow()][world.loc[1].getColumn()].getHitPoints() < 10, "Orc should lose HP after attack"); + } + + @Test + void checkPerimTest(){ + String simulatedInput = "Assignment_1/refactored_code/assignment3GUI - Classmate's/src/perimTest.txt\n"; + InputStream originalSystemInStream = System.in; // Save the original System.in + ByteArrayInputStream simulatedInputStream = new ByteArrayInputStream(simulatedInput.getBytes()); + System.setIn(simulatedInputStream); // Set System.in to the new input stream + world = new World(); // This will call FileInitialization.read() and use the simulated input + System.setIn(originalSystemInStream); // Restore the original System.in + + assertTrue(world.checkPerim(0), "should be true, something next to the elf"); + assertTrue(world.checkPerim(1), "should be true, something next to the orc"); + assertFalse(world.checkPerim(2), "should be false, nothing next to the elf"); + assertFalse(world.checkPerim(3), "should be false, spot is null"); + } + + @Test + void testMove(){ + String simulatedInput = "Assignment_1/refactored_code/assignment3GUI - Classmate's/src/moveTest.txt\n"; + InputStream originalSystemInStream = System.in; // Save the original System.in + ByteArrayInputStream simulatedInputStream = new ByteArrayInputStream(simulatedInput.getBytes()); + System.setIn(simulatedInputStream); // Set System.in to the new input stream + world = new World(); // This will call FileInitialization.read() and use the simulated input + System.setIn(originalSystemInStream); // Restore the original System.in + + assertEquals('O', world.aWorld[0][0].getAppearance(), "should be an Orc at 0,0"); + System.out.println(world.aWorld[0][0].getAppearance()+ " at: 0:0"); + world.move(1); + assertEquals('O', world.aWorld[1][1].getAppearance(), "should be an Orc"); + System.out.println(world.aWorld[1][1].getAppearance() + " at: 1:1, from move function" ); + + } +} \ No newline at end of file diff --git a/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/World.java b/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/World.java index f9a66f3..f10c667 100644 --- a/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/World.java +++ b/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/World.java @@ -84,7 +84,7 @@ public class World if (loc[j+orcCounter] == null){ continue; } - if(((loc[j].getType() != 'O')&&(loc[j+orcCounter].getType() != 'E'))) { + if(((loc[j].getType() != 'O')||(loc[j+orcCounter].getType() != 'E'))) { continue; } tempRow = loc[j+orcCounter].getRow(); @@ -98,10 +98,14 @@ public class World loc[j].setType(tempType); } } - public void attack(int index) { - if(((loc[index].getType() == 'O') || (aWorld[tempRow][tempColumn].getAppearance() != 'O')) && - ((loc[index].getType() == 'E') || (aWorld[tempRow][tempColumn].getAppearance() != 'E'))) { - loc[index].setCanMove(true); + public void attack(int index) {// new + if(aWorld[tempRow][tempColumn] == null){ + return; + } + if((loc[index].getType() == 'O') && (aWorld[tempRow][tempColumn].getAppearance() == 'O')) { + return; + } + if((loc[index].getType() == 'E') && (aWorld[tempRow][tempColumn].getAppearance() == 'E')) { return; } turnSinceAtk = 0; @@ -158,61 +162,66 @@ public class World loc[index].setCanMove(true); } } - public boolean checkPerim(int index) {//looks at all the spaces around the current index of loc[index] looking for things not null - if (loc[index] != null) { - for(int r = loc[index].getRow()-1; r<loc[index].getRow()+2;r++) { - for(int c = loc[index].getColumn()-1; c<loc[index].getColumn()+2;c++ ) { - if((r <= 9)&&(c <= 9)&&(r > - 1)&&(c > -1)) {//ensuring r/c is in aWorld - if((aWorld[r][c] != null) && (loc[index].getType() != aWorld[r][c].getAppearance())) { - - loc[index].setCanMove(false); - tempRow = r; - tempColumn = c; - attack(index); - return true; - } - } - } - } - loc[index].setCanMove(true); - return false; - } - return false; - } + public boolean checkPerim(int index) {//looks at all the spaces around the current index of loc[index] looking for things not null + if (loc[index] == null){ + return false; + } + for(int r = loc[index].getRow()-1; r<loc[index].getRow()+2;r++) { + for(int c = loc[index].getColumn()-1; c<loc[index].getColumn()+2;c++ ) { + if((r > 9)||(c > 9)||(r <= - 1)||(c <= -1)){ //ensuring r/c is in aWorld + continue; + } + if((aWorld[r][c] == null) || (loc[index].getType() == aWorld[r][c].getAppearance())) { + continue; + } + loc[index].setCanMove(false); + tempRow = r; + tempColumn = c; + attack(index); + return true; + } + } + loc[index].setCanMove(true); + return false; + } // these methods could be broken up into smaller ones - public void move(int index) {//changes the value of aWorld[][] must set old position to null then update it to the new position. - if (checkPerim(index) == false) {//checks the perim for things not null if it finds something it returns true and the move code below doesn't run - if (loc[index] != null) { - if (loc[index].getCanMove()) { - if((loc[index].getRow()-1 != -1)&&(loc[index].getColumn()-1 != -1)) { - if ((loc[index].getType() == 'E')&&(aWorld[loc[index].getRow()-1][loc[index].getColumn()-1]== null)) { - oldRow = loc[index].getRow(); - oldCol = loc[index].getColumn(); - loc[index].setRow(oldRow-1); - loc[index].setColumn(oldCol-1); - aWorld[oldRow-1][oldCol-1] = aWorld[oldRow][oldCol]; - aWorld[oldRow][oldCol] = null; - } - } - if((loc[index].getRow()+1 != 10)&&(loc[index].getColumn()+1 != 10)) { - if ((loc[index].getType() == 'O')&&(aWorld[loc[index].getRow()+1][loc[index].getColumn()+1]== null)) { - oldRow = loc[index].getRow(); - oldCol = loc[index].getColumn(); - loc[index].setRow(oldRow+1); - loc[index].setColumn(oldCol+1); - aWorld[oldRow+1][oldCol+1] = aWorld[oldRow][oldCol]; - aWorld[oldRow][oldCol] = null; - } - } - if ((GameStatus.debugModeOn)&&(loc[index]!= null)) { - if (loc[index].getType() == 'E') {//elf move data - status.elfMoveDebug(oldRow,oldCol,loc[index].getRow(),loc[index].getRow()); - } else if (loc[index].getType() == 'O') {//orc move data - status.orcMoveDebug(oldRow,oldCol,loc[index].getRow(),loc[index].getRow()); - } - } - } - } - } - } + public void move(int index) {//changes the value of aWorld[][] must set old position to null then update it to the new position. + if (checkPerim(index) == true){ //checks the perim for things not null if it finds something it returns true and the move code below doesn't run + return; + } + if (loc[index] == null) { + return; + } + if (loc[index].getCanMove()==false){ + return; + } + if((loc[index].getRow()-1 != -1)&&(loc[index].getColumn()-1 != -1)) { + if ((loc[index].getType() == 'E')&&(aWorld[loc[index].getRow()-1][loc[index].getColumn()-1]== null)) { + oldRow = loc[index].getRow(); + oldCol = loc[index].getColumn(); + loc[index].setRow(oldRow-1); + loc[index].setColumn(oldCol-1); + aWorld[oldRow-1][oldCol-1] = aWorld[oldRow][oldCol]; + aWorld[oldRow][oldCol] = null; + } + } + if((loc[index].getRow()+1 != 10)&&(loc[index].getColumn()+1 != 10)) { + if ((loc[index].getType() == 'O')&&(aWorld[loc[index].getRow()+1][loc[index].getColumn()+1]== null)) { + oldRow = loc[index].getRow(); + oldCol = loc[index].getColumn(); + loc[index].setRow(oldRow+1); + loc[index].setColumn(oldCol+1); + aWorld[oldRow+1][oldCol+1] = aWorld[oldRow][oldCol]; + aWorld[oldRow][oldCol] = null; + } + } + if ((GameStatus.debugModeOn == false)||(loc[index] == null)) { + return; + } + if (loc[index].getType() == 'E') {//elf move data + status.elfMoveDebug(oldRow,oldCol,loc[index].getRow(),loc[index].getRow()); + } else if (loc[index].getType() == 'O') {//orc move data + status.orcMoveDebug(oldRow,oldCol,loc[index].getRow(),loc[index].getRow()); + } + } } \ No newline at end of file diff --git a/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/attackTest.txt b/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/attackTest.txt new file mode 100644 index 0000000..d96c03d --- /dev/null +++ b/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/attackTest.txt @@ -0,0 +1,10 @@ +O +E + + + + + + + + \ No newline at end of file diff --git a/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/data2.txt b/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/data2.txt new file mode 100644 index 0000000..925cdc3 --- /dev/null +++ b/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/data2.txt @@ -0,0 +1,10 @@ + + O O + E + E + O + OE E + E + E + + \ No newline at end of file diff --git a/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/refactor_1_test.java b/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/refactor_1_test.java index 872812d..04413b8 100644 --- a/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/refactor_1_test.java +++ b/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/refactor_1_test.java @@ -4,21 +4,33 @@ import java.io.InputStream; import static org.junit.jupiter.api.Assertions.*; import org.junit.jupiter.api.*; +import java.awt.*; +import javax.swing.*; + class refactor_1_test { private static World world; - @BeforeEach - void setUp() { - String simulatedInput = "Assignment_1/refactored_code/assignment3GUI - Classmate's/src/data.txt\n"; +// @BeforeEach +// void setUp() { +// String simulatedInput = "Assignment_1/original_code/assignment3GUI - Classmate's/src/data.txt"; +//// String simulatedInput = "Assignment_1/refactored_code/assignment3GUI - Classmate's/src/attackTest.txt\n"; +// InputStream originalSystemInStream = System.in; // Save the original System.in +// ByteArrayInputStream simulatedInputStream = new ByteArrayInputStream(simulatedInput.getBytes()); +// System.setIn(simulatedInputStream); // Set System.in to the new input stream +// world = new World(); // This will call FileInitialization.read() and use the simulated input +// System.setIn(originalSystemInStream); // Restore the original System.in +// } + + @Test + void testBoardInitialization() { + String simulatedInput = "Assignment_1/original_code/assignment3GUI - Classmate's/src/data.txt"; +// String simulatedInput = "Assignment_1/refactored_code/assignment3GUI - Classmate's/src/attackTest.txt\n"; InputStream originalSystemInStream = System.in; // Save the original System.in ByteArrayInputStream simulatedInputStream = new ByteArrayInputStream(simulatedInput.getBytes()); System.setIn(simulatedInputStream); // Set System.in to the new input stream world = new World(); // This will call FileInitialization.read() and use the simulated input System.setIn(originalSystemInStream); // Restore the original System.in - } - @Test - void testBoardInitialization() { System.out.println("Test 1 running."); assertNotNull(world.aWorld, "Board should be initialized"); assertEquals(World.SIZE, world.aWorld.length, "Board should have correct rows"); @@ -29,21 +41,76 @@ class refactor_1_test { @Test void sortDeadTest(){ - // not sure how to test because the comment just says doesnt work as intended?? + // not sure how to test because the comment just says doesn't work as intended?? + //but works in gui } @Test void testSort(){ + String simulatedInput = "Assignment_1/original_code/assignment3GUI - Classmate's/src/data.txt"; +// String simulatedInput = "Assignment_1/refactored_code/assignment3GUI - Classmate's/src/attackTest.txt\n"; + InputStream originalSystemInStream = System.in; // Save the original System.in + ByteArrayInputStream simulatedInputStream = new ByteArrayInputStream(simulatedInput.getBytes()); + System.setIn(simulatedInputStream); // Set System.in to the new input stream + world = new World(); // This will call FileInitialization.read() and use the simulated input + System.setIn(originalSystemInStream); // Restore the original System.in //in data.txt the sorted array should be OOEEOOEE StringBuilder afterSort = new StringBuilder(); for (Location location : world.loc) { afterSort.append(location != null ? location.getType() : ""); } - assertEquals("OOEEOOEE", afterSort.toString(), "Locations should be sorted with Orcs before Elves"); + assertEquals("OOEEOOEE", afterSort.toString(), "Locations should be sorted like this"); } @Test void testAttack(){ + // create world and tell them to attack + String simulatedInput = "Assignment_1/refactored_code/assignment3GUI - Classmate's/src/attackTest.txt\n"; + InputStream originalSystemInStream = System.in; // Save the original System.in + ByteArrayInputStream simulatedInputStream = new ByteArrayInputStream(simulatedInput.getBytes()); + System.setIn(simulatedInputStream); // Set System.in to the new input stream + world = new World(); // This will call FileInitialization.read() and use the simulated input + System.setIn(originalSystemInStream); // Restore the original System.in + + world.tempRow = 0; + world.tempColumn = 0; + world.attack(0); //elf will attack + int Hp = world.aWorld[world.loc[1].getRow()][world.loc[1].getColumn()].getHitPoints(); + System.out.println("health after attack: " + Hp); + assertTrue(world.aWorld[world.loc[1].getRow()][world.loc[1].getColumn()].getHitPoints() < 10, "Orc should lose HP after attack"); + } + @Test + void checkPerimTest(){ + String simulatedInput = "Assignment_1/refactored_code/assignment3GUI - Classmate's/src/perimTest.txt\n"; + InputStream originalSystemInStream = System.in; // Save the original System.in + ByteArrayInputStream simulatedInputStream = new ByteArrayInputStream(simulatedInput.getBytes()); + System.setIn(simulatedInputStream); // Set System.in to the new input stream + world = new World(); // This will call FileInitialization.read() and use the simulated input + System.setIn(originalSystemInStream); // Restore the original System.in + + assertTrue(world.checkPerim(0), "should be true, something next to the elf"); + assertTrue(world.checkPerim(1), "should be true, something next to the orc"); + assertFalse(world.checkPerim(2), "should be false, nothing next to the elf"); + assertFalse(world.checkPerim(3), "should be false, spot is null"); } + + @Test + void testMove(){ + String simulatedInput = "Assignment_1/refactored_code/assignment3GUI - Classmate's/src/moveTest.txt\n"; + InputStream originalSystemInStream = System.in; // Save the original System.in + ByteArrayInputStream simulatedInputStream = new ByteArrayInputStream(simulatedInput.getBytes()); + System.setIn(simulatedInputStream); // Set System.in to the new input stream + world = new World(); // This will call FileInitialization.read() and use the simulated input + System.setIn(originalSystemInStream); // Restore the original System.in + + assertEquals('O', world.aWorld[0][0].getAppearance(), "should be an Orc at 0,0"); + System.out.println(world.aWorld[0][0].getAppearance()+ " at: 0:0"); + world.move(1); + assertEquals('O', world.aWorld[1][1].getAppearance(), "should be an Orc"); + System.out.println(world.aWorld[1][1].getAppearance() + " at: 1:1, from move function" ); + + } + + } \ No newline at end of file diff --git a/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/reworks.java b/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/reworks.java index 6485581..e56a211 100644 --- a/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/reworks.java +++ b/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/reworks.java @@ -1,60 +1,22 @@ -//public void attack(int index) { -// if(((loc[index].getType() == 'O') || (aWorld[tempRow][tempColumn].getAppearance() != 'O')) && -// ((loc[index].getType() == 'E') || (aWorld[tempRow][tempColumn].getAppearance() != 'E'))) { -// loc[index].setCanMove(true); -// return; +//public boolean checkPerim(int index) {//looks at all the spaces around the current index of loc[index] looking for things not null +// if (loc[index] == null){ +// return false; // } -// turnSinceAtk = 0; -// if((loc[index].getType() == 'E')&&(aWorld[loc[index].getRow()][loc[index].getColumn()] != null)) { -// HP = aWorld[tempRow][tempColumn].getHitPoints(); -// aWorld[tempRow][tempColumn].setHitPoints(aWorld[tempRow][tempColumn].getHitPoints()-Entity.ELF_DAMAGE); -// HPAfter = aWorld[tempRow][tempColumn].getHitPoints(); -// if (GameStatus.debugModeOn) {//attack data for elf attackers -// status.elfAttackDebug(tempRow, tempColumn, loc[index].getRow(), loc[index].getColumn(),HP,HPAfter); +// for(int r = loc[index].getRow()-1; r<loc[index].getRow()+2;r++) { +// for(int c = loc[index].getColumn()-1; c<loc[index].getColumn()+2;c++ ) { +// if((r > 9)||(c > 9)||(r <= - 1)||(c <= -1)){ //ensuring r/c is in aWorld +// continue; +// } +// if((aWorld[r][c] == null) || (loc[index].getType() == aWorld[r][c].getAppearance())) { +// continue; +// } +// loc[index].setCanMove(false); +// tempRow = r; +// tempColumn = c; +// attack(index); +// return true; // } -// if (aWorld[tempRow][tempColumn].getHitPoints() >0){ -// return; -// } -// aWorld[tempRow][tempColumn] = null; -// orcCounter--; -// sortDead(); -// if(loc[index] != null) { -// loc[index].setCanMove(true); -// } -// if (orcCounter > 0) { -// return; -// } -// System.out.println("Elves win no more orcs left."); -// programRunning = false; -// if(GameStatus.debugModeOn) {//lose condition data -// status.orcLoseDebug(orcCounter); -// } -// } else if((loc[index].getType() == 'O')&&(aWorld[loc[index].getRow()][loc[index].getColumn()] != null)) { -// HP = aWorld[tempRow][tempColumn].getHitPoints(); -// aWorld[tempRow][tempColumn].setHitPoints(aWorld[tempRow][tempColumn].getHitPoints()-Entity.ORC_DAMAGE); -// HPAfter = aWorld[tempRow][tempColumn].getHitPoints(); -// if (GameStatus.debugModeOn) { -// //attack data for Orc attackers -// status.orcAttackDebug(tempRow, tempColumn, loc[index].getRow(), loc[index].getColumn(),HP,HPAfter); -// } -// if (aWorld[tempRow][tempColumn].getHitPoints() >0){ -// return; -// } -// aWorld[tempRow][tempColumn] = null; -// elfCounter--; -// sortDead(); -// if(loc[index] != null) { -// loc[index].setCanMove(true); -// } -// if (elfCounter>0){ -// return; -// } -// System.out.println("Orcs win no more elves left."); -// programRunning = false; -// if(GameStatus.debugModeOn) {//gives data for lose condition when no elves left standing -// status.elfLoseDebug(elfCounter); -// } -// } else { -// loc[index].setCanMove(true); // } +// loc[index].setCanMove(true); +// return false; //} \ No newline at end of file diff --git a/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/reworks2.java b/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/reworks2.java new file mode 100644 index 0000000..4aac898 --- /dev/null +++ b/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/reworks2.java @@ -0,0 +1,39 @@ +//public void move(int index) {//changes the value of aWorld[][] must set old position to null then update it to the new position. +// if (checkPerim(index) == true){ //checks the perim for things not null if it finds something it returns true and the move code below doesn't run +// return; +// } +// if (loc[index] == null) { +// return; +// } +// if (loc[index].getCanMove()==false){ +// return; +// } +// if((loc[index].getRow()-1 != -1)&&(loc[index].getColumn()-1 != -1)) { +// if ((loc[index].getType() == 'E')&&(aWorld[loc[index].getRow()-1][loc[index].getColumn()-1]== null)) { +// oldRow = loc[index].getRow(); +// oldCol = loc[index].getColumn(); +// loc[index].setRow(oldRow-1); +// loc[index].setColumn(oldCol-1); +// aWorld[oldRow-1][oldCol-1] = aWorld[oldRow][oldCol]; +// aWorld[oldRow][oldCol] = null; +// } +// } +// if((loc[index].getRow()+1 != 10)&&(loc[index].getColumn()+1 != 10)) { +// if ((loc[index].getType() == 'O')&&(aWorld[loc[index].getRow()+1][loc[index].getColumn()+1]== null)) { +// oldRow = loc[index].getRow(); +// oldCol = loc[index].getColumn(); +// loc[index].setRow(oldRow+1); +// loc[index].setColumn(oldCol+1); +// aWorld[oldRow+1][oldCol+1] = aWorld[oldRow][oldCol]; +// aWorld[oldRow][oldCol] = null; +// } +// } +// if ((GameStatus.debugModeOn)&&(loc[index]== null)) { +// return; +// } +// if (loc[index].getType() == 'E') {//elf move data +// status.elfMoveDebug(oldRow,oldCol,loc[index].getRow(),loc[index].getRow()); +// } else if (loc[index].getType() == 'O') {//orc move data +// status.orcMoveDebug(oldRow,oldCol,loc[index].getRow(),loc[index].getRow()); +// } +//} \ No newline at end of file diff --git a/out/production/501-gitlab/World.class b/out/production/501-gitlab/World.class index 0e7ce70287ebd826cecad6540b22e7a9a55e6078..3d3202607e18fd3e1f5d9d9040e360d29386b86a 100644 GIT binary patch delta 1444 zcma)*X-r&I6vuz}&10G2v6C8L25H2$PBf*{q-x_v2n`miBrcU!6G4W8tzcn5D70hQ zS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(x$BAl>Kw%g>ro5$M?mCZ4j#W35XZBlEAP33V?R39agF>)E_2~P4H@6yEkI+YLT z;6wdzCOE<*z3T5*+z?ahomNly)UED#^>76`(mCykjSRXtubO@!8noCk)&ASD_#0%% z4YDLk`Cr88y;58CJ@v7M8H2=I@p9cd$;hDm9xH!Neu*g&#s}n@cV>81r6hL^P`l{I zXS!T9;R-VK<)7$J<5SZ3439GFQNGX;zoe0`^gnW%qkOHy{YK>(7WkGwm=ibWC65d8 z5ErGGOUkY9B*?t%XF+<oEF=6N=eQzQxGH~g?O$rh^?wek+I+?mHyqfbEJT@!ve8_d Gk@q*wm`B?H diff --git a/out/production/501-gitlab/refactor_1_test.class b/out/production/501-gitlab/refactor_1_test.class index 6275ddd1152249ce19a35ebb157eb5a82215c4c6..2d279dfae2a620f21ff07caec8e616acc01d398e 100644 GIT binary patch literal 4846 zcmbtX`Fj)B6+L6gj4XyF0s~H1h6IXDzyd=E*p$Q;n}UoD1`}|I8Kkj2cr+tsMh2%% z+NRJZ-51)Dq$^!$(>0J77h1ZfZMv`NzNLHrg8ou^-i%gI^7;GngQU0Kckemp-uLv} z|1MtzkidVUs6$9bSV29eNtk_18`I*ZW(~)Cjvmv~o`h+e4a@MhNC-8z^hXepu(i{5 zjbSURTi)Q>xa}CjhNYQ<X*;9GwbInO9s85&YBgbUD64t;3ODXL>3Bx-v{vt=*MKOd z%TN@|z|5+H`^H^Q&q}B>ED4P%-y_40C#_uG>+>94%XY|^En#7Crfb~OI~_+GuUHaA z40B}6RnUle)#g3Nu!bc>hILQubR~qFTL!wKn1uxbh9(L1%>!L6{ZYDji-Lt%#1U8b zlJsXmb4`a@`eiKPsspxTW};Y(Py=qoZ8DZASdLdnnC0k0TH3Rn!L@@tlepHO5NjpK zDSuOk0Hj$#3sw?pJI@v6*n8=6G4=>n(cC`TP}izX-m(}?YZR@B%UGjeE!rf^DMC}R zktgMZ8B?HIh{7kDn9@W?OMe6XUa#N|Y#{5J@0En;z(8u7<r&_1M+6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3bf(gxjx_aA6e}7om7YOBfrTmBnKDtLJL0gmKTrDsq<74*Q?lY~~1O?c$t! z3+QDKM-(R!vo!|zFi0cj@QA-o5mmJ=^kE(g9Pcr+Ly*hxK~WJ>F{t8+;Miq)<!s2P s7=d89Owhl1$%aYUGBhx@SV&vssyp(u=E$bL9@xa!za#?BNGaj@A4o)feE<Le -- GitLab From fd1f69227b5b20e83035d5fcfe4600747e60ec26 Mon Sep 17 00:00:00 2001 From: Devon Harstrom <devonharstrom@gmail.com> Date: Sun, 16 Feb 2025 21:09:06 -0700 Subject: [PATCH 04/17] forgot to add the txt world files for the tests --- .../assignment3GUI - Classmate's/src/moveTest.txt | 10 ++++++++++ .../assignment3GUI - Classmate's/src/perimTest.txt | 10 ++++++++++ out/production/501-gitlab/attackTest.txt | 10 ++++++++++ out/production/501-gitlab/data2.txt | 10 ++++++++++ 4 files changed, 40 insertions(+) create mode 100644 Assignment_1/refactored_code/assignment3GUI - Classmate's/src/moveTest.txt create mode 100644 Assignment_1/refactored_code/assignment3GUI - Classmate's/src/perimTest.txt create mode 100644 out/production/501-gitlab/attackTest.txt create mode 100644 out/production/501-gitlab/data2.txt diff --git a/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/moveTest.txt b/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/moveTest.txt new file mode 100644 index 0000000..786c2c2 --- /dev/null +++ b/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/moveTest.txt @@ -0,0 +1,10 @@ +O + + + + + + + + +E \ No newline at end of file diff --git a/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/perimTest.txt b/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/perimTest.txt new file mode 100644 index 0000000..87316a9 --- /dev/null +++ b/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/perimTest.txt @@ -0,0 +1,10 @@ +O +E + + + + + O + + + \ No newline at end of file diff --git a/out/production/501-gitlab/attackTest.txt b/out/production/501-gitlab/attackTest.txt new file mode 100644 index 0000000..d96c03d --- /dev/null +++ b/out/production/501-gitlab/attackTest.txt @@ -0,0 +1,10 @@ +O +E + + + + + + + + \ No newline at end of file diff --git a/out/production/501-gitlab/data2.txt b/out/production/501-gitlab/data2.txt new file mode 100644 index 0000000..925cdc3 --- /dev/null +++ b/out/production/501-gitlab/data2.txt @@ -0,0 +1,10 @@ + + O O + E + E + O + OE E + E + E + + \ No newline at end of file -- GitLab From 0b9573df8aca6a05c330abe03346d2f27516f0ee Mon Sep 17 00:00:00 2001 From: Devon Harstrom <devonharstrom@gmail.com> Date: Sun, 16 Feb 2025 22:39:16 -0700 Subject: [PATCH 05/17] added some functions separated attack function to add readability as well as duplicate code pushing to save changes --- Assignment_1/README.md | 10 +- .../src/GamePanel.java | 1 - .../src/World.java | 161 +++++++++++------- .../src/reworks2.java | 99 ++++++++--- .../501-gitlab/GamePanel$MyKeyAdapter.class | Bin 1197 -> 1197 bytes out/production/501-gitlab/GamePanel.class | Bin 4923 -> 4923 bytes out/production/501-gitlab/World.class | Bin 5455 -> 6409 bytes out/production/501-gitlab/moveTest.txt | 10 ++ out/production/501-gitlab/perimTest.txt | 10 ++ .../501-gitlab/refactor_1_test.class | Bin 4846 -> 4866 bytes 10 files changed, 193 insertions(+), 98 deletions(-) create mode 100644 out/production/501-gitlab/moveTest.txt create mode 100644 out/production/501-gitlab/perimTest.txt diff --git a/Assignment_1/README.md b/Assignment_1/README.md index 1738476..3c54b7d 100644 --- a/Assignment_1/README.md +++ b/Assignment_1/README.md @@ -8,12 +8,12 @@ Used code from __ and refactored Refactor branch 1: De-nesting code in world -refactor branch 2: comments +refactor branch 2: pulling out methods -refactor branch 3: pulling out methods +refactor branch 3: rearrange classes? -refactor branch 4: rearrange classes? +refactor branch 4: new class? for elves and dwarves? -refactor branch 5: new class? for elves and dwarves? +refactor branch last: comments -refactor: _ maybe renaming? or getting rid of temp \ No newline at end of file +refactor: _ maybe renaming? or getting rid of temp variables or unused ones diff --git a/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/GamePanel.java b/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/GamePanel.java index 4a58933..5a21c73 100644 --- a/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/GamePanel.java +++ b/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/GamePanel.java @@ -52,7 +52,6 @@ public class GamePanel extends JPanel implements ActionListener{ public void drawWorld(Graphics g) { for (int r = 0; r<world.SIZE;r++) { - for (int c = 0; c<world.SIZE; c++) { if(world.aWorld[r][c] == null) { g.setColor(Color.white); diff --git a/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/World.java b/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/World.java index f10c667..67bea8f 100644 --- a/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/World.java +++ b/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/World.java @@ -36,33 +36,38 @@ public class World { aWorld = new Entity[SIZE][SIZE]; // this is null anyway aWorld = FileInitialization.read(); - // refactor 1 this could be de-nested for readability - for (int r = 0; r < SIZE; r++) - { + initializeGrid(); + } + + public void initializeGrid(){ + for (int r = 0; r < SIZE; r++){ System.out.println("\n - "+"- "+"- "+"- "+"- "+"- "+"- "+"- "+"- "+ "- "); // removed unnecessary print - for (int c = 0; c < SIZE; c++) - { - if (aWorld[r][c] == null) { - System.out.print("| "); - continue; - } - char currentCellAppearance = aWorld[r][c].getAppearance(); - System.out.print("|"+currentCellAppearance); - loc[i] = new Location(r,c,currentCellAppearance);//Initializes each Entities location/type - if (loc[i].getType() == 'O') {//this checks the type and counts +1 if it's an orc - orcCounter++; - } - if (loc[i].getType() == 'E') { - elfCounter++; - } - i++;//Cause each initialization of the loc[i] to go to the next element + for (int c = 0; c < SIZE; c++){ + initalizeLocations(r, c); } System.out.print("|"); } System.out.println("\n - "+"- "+"- "+"- "+"- "+"- "+"- "+"- "+"- "+ "- "); sortLocations(); } - // Same here this could be de-nested + + public void initalizeLocations(int r, int c){ + if (aWorld[r][c] == null) { + System.out.print("| "); + return; + } + char currentCellAppearance = aWorld[r][c].getAppearance(); + System.out.print("|"+currentCellAppearance); + loc[i] = new Location(r,c,currentCellAppearance);//Initializes each Entities location/type + if (loc[i].getType() == 'O') {//this checks the type and counts +1 if it's an orc + orcCounter++; + } + if (loc[i].getType() == 'E') { + elfCounter++; + } + i++;//Cause each initialization of the loc[i] to go to the next element + } + public void sortDead() {//supposed to try and sort null elements and bring them to the end doesn't always work as intended for (int i = 0; i<=elfCounter+orcCounter;i++) { if (loc[i] == null) { @@ -78,7 +83,7 @@ public class World } } } - // and potenitally here + public void sortLocations() {//puts the elfs in the beginning of the array, checks if there is an orc before and elf and if there is it swaps positions in the array for (int j = 0; j<elfCounter+orcCounter; j++) { if (loc[j+orcCounter] == null){ @@ -110,58 +115,82 @@ public class World } turnSinceAtk = 0; if((loc[index].getType() == 'E')&&(aWorld[loc[index].getRow()][loc[index].getColumn()] != null)) { - HP = aWorld[tempRow][tempColumn].getHitPoints(); - aWorld[tempRow][tempColumn].setHitPoints(aWorld[tempRow][tempColumn].getHitPoints()-Entity.ELF_DAMAGE); - HPAfter = aWorld[tempRow][tempColumn].getHitPoints(); - if (GameStatus.debugModeOn) {//attack data for elf attackers - status.elfAttackDebug(tempRow, tempColumn, loc[index].getRow(), loc[index].getColumn(),HP,HPAfter); - } - if (aWorld[tempRow][tempColumn].getHitPoints() >0){ - return; - } - aWorld[tempRow][tempColumn] = null; - orcCounter--; - sortDead(); - if(loc[index] != null) { - loc[index].setCanMove(true); - } - if (orcCounter > 0) { - return; - } - System.out.println("Elves win no more orcs left."); - programRunning = false; - if(GameStatus.debugModeOn) {//lose condition data - status.orcLoseDebug(orcCounter); - } + attackLogic("elves", index); } else if((loc[index].getType() == 'O')&&(aWorld[loc[index].getRow()][loc[index].getColumn()] != null)) { - HP = aWorld[tempRow][tempColumn].getHitPoints(); - aWorld[tempRow][tempColumn].setHitPoints(aWorld[tempRow][tempColumn].getHitPoints()-Entity.ORC_DAMAGE); - HPAfter = aWorld[tempRow][tempColumn].getHitPoints(); - if (GameStatus.debugModeOn) { - //attack data for Orc attackers - status.orcAttackDebug(tempRow, tempColumn, loc[index].getRow(), loc[index].getColumn(),HP,HPAfter); - } - if (aWorld[tempRow][tempColumn].getHitPoints() >0){ + attackLogic("orcs", index); + } else { + loc[index].setCanMove(true); + } + } + + public void attackLogic(String attackingEntity, int index){ + int entityDmg = 0; + if (attackingEntity.equals("elves")) { + entityDmg = Entity.ELF_DAMAGE; // Define the Elf damage constant or value + } else if (attackingEntity.equals("orcs")) { + entityDmg = Entity.ORC_DAMAGE; // Define the Orc damage constant or value + } + HP = aWorld[tempRow][tempColumn].getHitPoints(); + aWorld[tempRow][tempColumn].setHitPoints(aWorld[tempRow][tempColumn].getHitPoints()-entityDmg); + HPAfter = aWorld[tempRow][tempColumn].getHitPoints(); + + if (GameStatus.debugModeOn) {//attack data for elf attackers + debugAttack(attackingEntity, index); + } + deathLogic(attackingEntity, index); + victoryLogic(attackingEntity); + if(GameStatus.debugModeOn) {//lose condition data + debugLossConditions(attackingEntity); + } + } + + public void debugAttack(String attackingEntity, int index){ + if (attackingEntity.equals("elves")) { + status.elfAttackDebug(tempRow, tempColumn, loc[index].getRow(), loc[index].getColumn(),HP,HPAfter); + } else if (attackingEntity.equals("orcs")) { + status.orcAttackDebug(tempRow, tempColumn, loc[index].getRow(), loc[index].getColumn(),HP,HPAfter); + } + } + + public void debugLossConditions(String attackingEntity){ + if (attackingEntity.equals("elves")) { + status.orcLoseDebug(orcCounter); + } else if (attackingEntity.equals("orcs")) { + status.elfLoseDebug(elfCounter); + } + } + + public void deathLogic(String attackingEntity, int index){ + if (aWorld[tempRow][tempColumn].getHitPoints() >0){ + return; + } + aWorld[tempRow][tempColumn] = null; + + if (attackingEntity.equals("elves")) { + orcCounter--; //here // Define the Elf damage constant or value + } else if (attackingEntity.equals("orcs")) { + elfCounter--; //here // Define the Orc damage constant or value + } + sortDead(); + if(loc[index] != null) { + loc[index].setCanMove(true); + } + } + + public void victoryLogic(String attackingEntity){ + if (attackingEntity.equals("elves")) { + if (orcCounter > 0) { //here return; } - aWorld[tempRow][tempColumn] = null; - elfCounter--; - sortDead(); - if(loc[index] != null) { - loc[index].setCanMove(true); - } - if (elfCounter>0){ + } else if (attackingEntity.equals("orcs")) { + if (elfCounter > 0) { //here return; } - System.out.println("Orcs win no more elves left."); - programRunning = false; - if(GameStatus.debugModeOn) {//gives data for lose condition when no elves left standing - status.elfLoseDebug(elfCounter); - } - } else { - loc[index].setCanMove(true); } + System.out.println(attackingEntity + "win no more orcs left."); + programRunning = false; } + public boolean checkPerim(int index) {//looks at all the spaces around the current index of loc[index] looking for things not null if (loc[index] == null){ return false; diff --git a/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/reworks2.java b/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/reworks2.java index 4aac898..38a48a1 100644 --- a/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/reworks2.java +++ b/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/reworks2.java @@ -1,39 +1,86 @@ -//public void move(int index) {//changes the value of aWorld[][] must set old position to null then update it to the new position. -// if (checkPerim(index) == true){ //checks the perim for things not null if it finds something it returns true and the move code below doesn't run +//public void attack(int index) {// new +// if(aWorld[tempRow][tempColumn] == null){ // return; // } -// if (loc[index] == null) { +// if((loc[index].getType() == 'O') && (aWorld[tempRow][tempColumn].getAppearance() == 'O')) { // return; // } -// if (loc[index].getCanMove()==false){ +// if((loc[index].getType() == 'E') && (aWorld[tempRow][tempColumn].getAppearance() == 'E')) { // return; // } -// if((loc[index].getRow()-1 != -1)&&(loc[index].getColumn()-1 != -1)) { -// if ((loc[index].getType() == 'E')&&(aWorld[loc[index].getRow()-1][loc[index].getColumn()-1]== null)) { -// oldRow = loc[index].getRow(); -// oldCol = loc[index].getColumn(); -// loc[index].setRow(oldRow-1); -// loc[index].setColumn(oldCol-1); -// aWorld[oldRow-1][oldCol-1] = aWorld[oldRow][oldCol]; -// aWorld[oldRow][oldCol] = null; -// } +// turnSinceAtk = 0; +// if((loc[index].getType() == 'E')&&(aWorld[loc[index].getRow()][loc[index].getColumn()] != null)) { +// attackLogic("elves"); +// } else if((loc[index].getType() == 'O')&&(aWorld[loc[index].getRow()][loc[index].getColumn()] != null)) { +// attackLogic("orcs"); +// } else { +// loc[index].setCanMove(true); +// } +//} +// +//void attackLogic(String attackingEntity){ +// if (attackingEntity.equals("elves")) { +// entityDmg = Entity.ELF_DAMAGE; // Define the Elf damage constant or value +// } else if (attackingEntity.equals("orcs")) { +// entityDmg = Entity.ORC_DAMAGE; // Define the Orc damage constant or value // } -// if((loc[index].getRow()+1 != 10)&&(loc[index].getColumn()+1 != 10)) { -// if ((loc[index].getType() == 'O')&&(aWorld[loc[index].getRow()+1][loc[index].getColumn()+1]== null)) { -// oldRow = loc[index].getRow(); -// oldCol = loc[index].getColumn(); -// loc[index].setRow(oldRow+1); -// loc[index].setColumn(oldCol+1); -// aWorld[oldRow+1][oldCol+1] = aWorld[oldRow][oldCol]; -// aWorld[oldRow][oldCol] = null; +// +// HP = aWorld[tempRow][tempColumn].getHitPoints(); +// aWorld[tempRow][tempColumn].setHitPoints(aWorld[tempRow][tempColumn].getHitPoints()-entityDmg); +// HPAfter = aWorld[tempRow][tempColumn].getHitPoints(); +// +// if (GameStatus.debugModeOn) {//attack data for elf attackers +// debugAttack(attackingEntity); +// } +// +// deathLogic(attackingEntity, index); +// +// if (attackingEntity.equals("elves")) { +// if (orcCounter > 0) { //here +// return; +// } +// } else if (attackingEntity.equals("orcs")) { +// if (elfCounter > 0) { //here +// return; // } // } -// if ((GameStatus.debugModeOn)&&(loc[index]== null)) { +// +// System.out.println(entity + "win no more orcs left."); +// programRunning = false; +// if(GameStatus.debugModeOn) {//lose condition data +// debugLossConditions(attackingEntity); +// } +//} +// +//public void debugAttack(String attackingEntity){ +// if (attackingEntity.equals("elves")) { +// status.elfAttackDebug(tempRow, tempColumn, loc[index].getRow(), loc[index].getColumn(),HP,HPAfter); +// } else if (attackingEntity.equals("orcs")) { +// status.orcAttackDebug(tempRow, tempColumn, loc[index].getRow(), loc[index].getColumn(),HP,HPAfter); +// } +//} +// +//public void debugLossConditions(String attackingEntity){ +// if (attackingEntity.equals("elves")) { +// status.orcLoseDebug(orcCounter); +// } else if (attackingEntity.equals("orcs")) { +// status.elfLoseDebug(elfCounter); +// } +//} +// +//public void deathLogic(String attackingEntity, int index){ +// if (aWorld[tempRow][tempColumn].getHitPoints() >0){ // return; // } -// if (loc[index].getType() == 'E') {//elf move data -// status.elfMoveDebug(oldRow,oldCol,loc[index].getRow(),loc[index].getRow()); -// } else if (loc[index].getType() == 'O') {//orc move data -// status.orcMoveDebug(oldRow,oldCol,loc[index].getRow(),loc[index].getRow()); +// aWorld[tempRow][tempColumn] = null; +// +// if (attackingEntity.equals("elves")) { +// orcCounter--; //here // Define the Elf damage constant or value +// } else if (attackingEntity.equals("orcs")) { +// elfCounter--; //here // Define the Orc damage constant or value +// } +// sortDead(); +// if(loc[index] != null) { +// loc[index].setCanMove(true); // } //} \ No newline at end of file diff --git a/out/production/501-gitlab/GamePanel$MyKeyAdapter.class b/out/production/501-gitlab/GamePanel$MyKeyAdapter.class index d10864080b129a4b78920b5ddbc727c517cc5e25..1385e25362c535dd0485d8e609a6625088f3a994 100644 GIT binary patch delta 59 zcmV-B0L1^T39SjRkplsmlad3dDVzWx0G<FX0G|Li0H6Rm0Hy#y0H***0H^>=0I2{^ R0IL930IUF80I!o{1WEw$5IFz< delta 59 zcmV-B0L1^T39SjRkplsnlad3dDV+cy0G|LY0H6Rj0HFXn0H**z0H^>+0I2{>0IC2_ R0IUF40IdL90I-u|1WE!o5Jdn0 diff --git a/out/production/501-gitlab/GamePanel.class b/out/production/501-gitlab/GamePanel.class index 8c927200acee848167a852912edf89ec881e9072..91fe0cc0bbae24617fed89744a345f5612f04abd 100644 GIT binary patch delta 326 zcmWNMNlOA?5Qd*GIwn!a@+cBrLW8u0OhnK&%CfQ*!xphUTfitPrR`8;8${HhQxOOr zA`Ciu=os_^y7U)1_Fje=W|-%B3-*FN_f_U_QH7ft8mXfRAI-GWLX=jLcu3R6HC`TZ z@k9eT{P|MLkBJ1Z5~N<oJ~~u8>8Fcfx{1@n620sYB10b++T0P=iveC3<eectb@|JP zDPh#u7&8IJO^6AzOf>H)e>1@t)lA`JT3$0k%nA`FLV`)=)XlTP0=q17CfL2E0;_z> z`HwYYW!>1>Fn%`k-U^2ar?9Yvjcsb><y7xxPZ9T(AuaEW91rAlNQ@%^j!AK%?J2hc XJa8`iEYHgF$|WCMQRF6DtW5p`3ol4J delta 326 zcmWNNOD{tK5QV=HOO3Fk%jQOGq$E<$Dj_aPl%n1mO2w<xD>R5lycU%f5fK(vMAGCg zM6SfL3rmR~VB;@Xn%&G~&N<(VZP-TUE6?qrh$>2`ri>bzsHKfMCh!ucfdhP8)5s$p zo~R^4i<Rs6k&uZ~7b|F2NrzT`dg)}4E~0d^M1UQ7IMivHAb0esML#bL@J@(NhWKSz zau^X8qteQl1Q?eXVauEUCgv2yL?~xk*=95%su8m)oFmM<b_*=C$esoziE+;gw(@?n z${%auWL*q4q?t|2SKyZ5HVzWFl&O?mwN2<b`_$`srZW0DQqE(gKVgzn4LM_rbKOXC Z%LNalls?Tfm%MVthrT4sO)6U${|7pbNQVFb diff --git a/out/production/501-gitlab/World.class b/out/production/501-gitlab/World.class index 3d3202607e18fd3e1f5d9d9040e360d29386b86a..9256c6a0d354b8f16e004d1d84ffbbc4f9231a12 100644 GIT binary patch literal 6409 zcma)A33yc175?AMkV%FY5)ueP5{)%Nn6O501A-w55)C908n#+8WFBP5WF|~rf>7I{ zqSh)>wTdesi*cbU(F_W8X{!QaU8~kwt=6@+?zUB+wg0*A&CHABvyyM#d-vRP?>*-~ z>*dM+?s*tMrRMR$1-BO-9RrZ2A$vujD=<DBh%6spw{(TkY-&iG8j6I>at-d1(Ty2M zM}`+Z9Rs0j7%)E?3kNl5A^vK-7^ES+HrgC8L(zz^X6qP?94-w<n>7qvT$`AjBC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HvMFlOUEqZJzs3lA8b z*kr`;kg*&O8+~}hScA>RdTcfB#rC5q%0$a1ro6qWlU3TpaVQ>HQ*#)*j++>$K8zhQ z6f#A5>Ce{5d2Bbl8(^;+GOr=ex7&SX8}LV`4Mufd+g99|W7+=b`Bg_J!fLN9E!>8d zDtXSSG`8c?Dr1{e&oIR%Rn}G29m2V}6$^4SCj1r=I?3huB*-hJzE(*|t;pbE|L(Ou z_U{e4r#r5g<brQEt#+IE4EhiJR4GJ1yTs#c(ND10?PAH>&2sl7*5D~zhdpetd-=ik z4DR6v$Nd<<CdzH0{A0ZJJ<WEVYs7U(==SU5Rp3tDex;M_%^}P;FTw>Qj$nj3g3)SB z4f`*fuXLhc=1QTlmpzH=)faM{E&jpk<}HTXH+hO4aW^*Ou^d>$n$wNBDZA1Ztm8~d zhg)#`(W4!P!mP5(B<@|_0CpaouutuB8GP>aGmi)R%PyHp7ZSDPiAK_L1U;>jcCYz* z%8HfS#otyM+>HL*+;-<4n_1PrX7gZIr1bx6bK6jxIUTfFYux2;8)D=!HtWJ|x|Vuf zpm7~Ty1=!QzbsVD16P<Y89dpKqgd;^Y0bB-*gIHm`q+zs7Z|7q5#*;r8D3(FzRd3Y z3U8Z-Z~=oY&M;fWd*02w=WSr$-OgZph2iuzeuK~Pma69W-*~*ua`TRAz`JTb-cu{_ zzPbe;s{8oGw2_}eJMfWu9UrUr@rn8u{xn!7)EBuR=G$Npm!L3MXdcF%!+53`lP55* fenmqK{F<ABUrUPHE4;<}$M0{xeTYBsN;~R5H)#@h diff --git a/out/production/501-gitlab/moveTest.txt b/out/production/501-gitlab/moveTest.txt new file mode 100644 index 0000000..786c2c2 --- /dev/null +++ b/out/production/501-gitlab/moveTest.txt @@ -0,0 +1,10 @@ +O + + + + + + + + +E \ No newline at end of file diff --git a/out/production/501-gitlab/perimTest.txt b/out/production/501-gitlab/perimTest.txt new file mode 100644 index 0000000..87316a9 --- /dev/null +++ b/out/production/501-gitlab/perimTest.txt @@ -0,0 +1,10 @@ +O +E + + + + + O + + + \ No newline at end of file diff --git a/out/production/501-gitlab/refactor_1_test.class b/out/production/501-gitlab/refactor_1_test.class index 2d279dfae2a620f21ff07caec8e616acc01d398e..a65f06e71ad125eed976952294dca3078788afe0 100644 GIT binary patch delta 43 ycmaE-+N8FDg<DRRQ6aI!O2N>|P)8xHC_h&rH@_@ZA+0noxg;|`Z!;hF19kuzvkkHU delta 23 ecmZotd#AdAg`10$Q6aI!O2N>|aI+Hk19kvSdImuN -- GitLab From a144509c43132183846d504308374bed8bf2e49c Mon Sep 17 00:00:00 2001 From: Devon Harstrom <devonharstrom@gmail.com> Date: Sun, 16 Feb 2025 23:22:59 -0700 Subject: [PATCH 06/17] changed the move function to be split into different functions to eliminate repetitive code and length --- Assignment_1/Notes.txt | 99 +++++++----------- .../src/World.java | 37 +++---- .../src/reworks.java | 60 +++++++---- out/production/501-gitlab/World.class | Bin 6409 -> 6511 bytes 4 files changed, 97 insertions(+), 99 deletions(-) diff --git a/Assignment_1/Notes.txt b/Assignment_1/Notes.txt index 39a212a..1b7313c 100644 --- a/Assignment_1/Notes.txt +++ b/Assignment_1/Notes.txt @@ -7,63 +7,42 @@ classmate's, ------------- -//public void attack(int index) { -// if(((loc[index].getType() == 'O') && (aWorld[tempRow][tempColumn].getAppearance() != 'O')) || -// ((loc[index].getType() == 'E') && (aWorld[tempRow][tempColumn].getAppearance() != 'E'))) { -// loc[index].setCanMove(true); -// return; -// } -// turnSinceAtk = 0; -// if((loc[index].getType() == 'E')&&(aWorld[loc[index].getRow()][loc[index].getColumn()] != null)) { -// HP = aWorld[tempRow][tempColumn].getHitPoints(); -// aWorld[tempRow][tempColumn].setHitPoints(aWorld[tempRow][tempColumn].getHitPoints()-Entity.ELF_DAMAGE); -// HPAfter = aWorld[tempRow][tempColumn].getHitPoints(); -// if (GameStatus.debugModeOn) {//attack data for elf attackers -// status.elfAttackDebug(tempRow, tempColumn, loc[index].getRow(), loc[index].getColumn(),HP,HPAfter); -// } -// if (aWorld[tempRow][tempColumn].getHitPoints() >0){ -// return; -// } -// aWorld[tempRow][tempColumn] = null; -// orcCounter--; -// sortDead(); -// if(loc[index] != null) { -// loc[index].setCanMove(true); -// } -// if (orcCounter > 0) { -// return; -// } -// System.out.println("Elves win no more orcs left."); -// programRunning = false; -// if(GameStatus.debugModeOn) {//lose condition data -// status.orcLoseDebug(orcCounter); -// } -// } else if((loc[index].getType() == 'O')&&(aWorld[loc[index].getRow()][loc[index].getColumn()] != null)) { -// HP = aWorld[tempRow][tempColumn].getHitPoints(); -// aWorld[tempRow][tempColumn].setHitPoints(aWorld[tempRow][tempColumn].getHitPoints()-Entity.ORC_DAMAGE); -// HPAfter = aWorld[tempRow][tempColumn].getHitPoints(); -// if (GameStatus.debugModeOn) { -// //attack data for Orc attackers -// status.orcAttackDebug(tempRow, tempColumn, loc[index].getRow(), loc[index].getColumn(),HP,HPAfter); -// } -// if (aWorld[tempRow][tempColumn].getHitPoints() >0){ -// return; -// } -// aWorld[tempRow][tempColumn] = null; -// elfCounter--; -// sortDead(); -// if(loc[index] != null) { -// loc[index].setCanMove(true); -// } -// if (elfCounter>0){ -// return; -// } -// System.out.println("Orcs win no more elves left."); -// programRunning = false; -// if(GameStatus.debugModeOn) {//gives data for lose condition when no elves left standing -// status.elfLoseDebug(elfCounter); -// } -// } else { -// loc[index].setCanMove(true); -// } -//} \ No newline at end of file +public void move(int index) {//changes the value of aWorld[][] must set old position to null then update it to the new position. + if (checkPerim(index) == true){ //checks the perim for things not null if it finds something it returns true and the move code below doesn't run + return; + } + if (loc[index] == null) { + return; + } + if (loc[index].getCanMove()==false){ + return; + } + if((loc[index].getRow()-1 != -1)&&(loc[index].getColumn()-1 != -1)) { + if ((loc[index].getType() == 'E')&&(aWorld[loc[index].getRow()-1][loc[index].getColumn()-1]== null)) { + oldRow = loc[index].getRow(); + oldCol = loc[index].getColumn(); + loc[index].setRow(oldRow-1); + loc[index].setColumn(oldCol-1); + aWorld[oldRow-1][oldCol-1] = aWorld[oldRow][oldCol]; + aWorld[oldRow][oldCol] = null; + } + } + if((loc[index].getRow()+1 != 10)&&(loc[index].getColumn()+1 != 10)) { + if ((loc[index].getType() == 'O')&&(aWorld[loc[index].getRow()+1][loc[index].getColumn()+1]== null)) { + oldRow = loc[index].getRow(); + oldCol = loc[index].getColumn(); + loc[index].setRow(oldRow+1); + loc[index].setColumn(oldCol+1); + aWorld[oldRow+1][oldCol+1] = aWorld[oldRow][oldCol]; + aWorld[oldRow][oldCol] = null; + } + } + if ((GameStatus.debugModeOn == false)||(loc[index] == null)) { + return; + } + if (loc[index].getType() == 'E') {//elf move data + status.elfMoveDebug(oldRow,oldCol,loc[index].getRow(),loc[index].getRow()); + } else if (loc[index].getType() == 'O') {//orc move data + status.orcMoveDebug(oldRow,oldCol,loc[index].getRow(),loc[index].getRow()); + } + } \ No newline at end of file diff --git a/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/World.java b/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/World.java index 67bea8f..2a3afdd 100644 --- a/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/World.java +++ b/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/World.java @@ -224,33 +224,34 @@ public class World if (loc[index].getCanMove()==false){ return; } + if((loc[index].getRow()-1 != -1)&&(loc[index].getColumn()-1 != -1)) { - if ((loc[index].getType() == 'E')&&(aWorld[loc[index].getRow()-1][loc[index].getColumn()-1]== null)) { - oldRow = loc[index].getRow(); - oldCol = loc[index].getColumn(); - loc[index].setRow(oldRow-1); - loc[index].setColumn(oldCol-1); - aWorld[oldRow-1][oldCol-1] = aWorld[oldRow][oldCol]; - aWorld[oldRow][oldCol] = null; - } + moveLogic('E', index, -1); } if((loc[index].getRow()+1 != 10)&&(loc[index].getColumn()+1 != 10)) { - if ((loc[index].getType() == 'O')&&(aWorld[loc[index].getRow()+1][loc[index].getColumn()+1]== null)) { - oldRow = loc[index].getRow(); - oldCol = loc[index].getColumn(); - loc[index].setRow(oldRow+1); - loc[index].setColumn(oldCol+1); - aWorld[oldRow+1][oldCol+1] = aWorld[oldRow][oldCol]; - aWorld[oldRow][oldCol] = null; - } + moveLogic('O', index, 1); } - if ((GameStatus.debugModeOn == false)||(loc[index] == null)) { - return; + if ((GameStatus.debugModeOn == true)&&(loc[index] != null)) { + debugMovement(index); } + } + + public void debugMovement(int index){ if (loc[index].getType() == 'E') {//elf move data status.elfMoveDebug(oldRow,oldCol,loc[index].getRow(),loc[index].getRow()); } else if (loc[index].getType() == 'O') {//orc move data status.orcMoveDebug(oldRow,oldCol,loc[index].getRow(),loc[index].getRow()); } } + + public void moveLogic(char entityType, int index, int increment){ + if ((loc[index].getType() == entityType)&&(aWorld[loc[index].getRow()+ increment][loc[index].getColumn()+increment]== null)) { + oldRow = loc[index].getRow(); + oldCol = loc[index].getColumn(); + loc[index].setRow(oldRow+increment); + loc[index].setColumn(oldCol+increment); + aWorld[oldRow+increment][oldCol+increment] = aWorld[oldRow][oldCol]; + aWorld[oldRow][oldCol] = null; + } + } } \ No newline at end of file diff --git a/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/reworks.java b/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/reworks.java index e56a211..14d3272 100644 --- a/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/reworks.java +++ b/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/reworks.java @@ -1,22 +1,40 @@ -//public boolean checkPerim(int index) {//looks at all the spaces around the current index of loc[index] looking for things not null -// if (loc[index] == null){ -// return false; -// } -// for(int r = loc[index].getRow()-1; r<loc[index].getRow()+2;r++) { -// for(int c = loc[index].getColumn()-1; c<loc[index].getColumn()+2;c++ ) { -// if((r > 9)||(c > 9)||(r <= - 1)||(c <= -1)){ //ensuring r/c is in aWorld -// continue; -// } -// if((aWorld[r][c] == null) || (loc[index].getType() == aWorld[r][c].getAppearance())) { -// continue; -// } -// loc[index].setCanMove(false); -// tempRow = r; -// tempColumn = c; -// attack(index); -// return true; -// } -// } -// loc[index].setCanMove(true); -// return false; +//public void move(int index) {//changes the value of aWorld[][] must set old position to null then update it to the new position. +// if (checkPerim(index) == true){ //checks the perim for things not null if it finds something it returns true and the move code below doesn't run +// return; +// } +// if (loc[index] == null) { +// return; +// } +// if (loc[index].getCanMove()==false){ +// return; +// } +// +// if((loc[index].getRow()-1 != -1)&&(loc[index].getColumn()-1 != -1)) { +// moveLogic('E', index, -1); +// } +// if((loc[index].getRow()+1 != 10)&&(loc[index].getColumn()+1 != 10)) { +// moveLogic('O', index, 1); +// } +// if ((GameStatus.debugModeOn == true)&&(loc[index] != null)) { +// debugMovement(index); +// } +//} +// +//public void debugMovement(int index){ +// if (loc[index].getType() == 'E') {//elf move data +// status.elfMoveDebug(oldRow,oldCol,loc[index].getRow(),loc[index].getRow()); +// } else if (loc[index].getType() == 'O') {//orc move data +// status.orcMoveDebug(oldRow,oldCol,loc[index].getRow(),loc[index].getRow()); +// } +//} +// +//public void moveLogic(String entityType, int index, int increment){ +// if ((loc[index].getType() == entityType)&&(aWorld[loc[index].getRow()+ increment][loc[index].getColumn()+increment]== null)) { +// oldRow = loc[index].getRow(); +// oldCol = loc[index].getColumn(); +// loc[index].setRow(oldRow+increment); +// loc[index].setColumn(oldCol+increment); +// aWorld[oldRow+increment][oldCol+increment] = aWorld[oldRow][oldCol]; +// aWorld[oldRow][oldCol] = null; +// } //} \ No newline at end of file diff --git a/out/production/501-gitlab/World.class b/out/production/501-gitlab/World.class index 9256c6a0d354b8f16e004d1d84ffbbc4f9231a12..ec16af92db7fb84aac15086e52800370a82dcba9 100644 GIT binary patch delta 1882 zcmZ`)ZERCj7=BLM_2c$->$cLlbu(kk3=45v2NJWujB_px2u8p^hB&uf*O9WSnIj`6 z#e_wPS%|q)W1`#mqcPEh4c8yU_`@YC^J6kl5mZ1>w;_U`z!=l#+}_@nAExcO=RN0n zpYuHLx#x6$<Z?urS~~IpfM($vQ+7C$3fwrVVhW!Mcy=ZFv`vYw?hXOx%I0YF&PU|* z=PJHHzksh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H8)Tf&S;8RkughC%+#bk7Vxve_CO2cJ`Ge<XF6PO#nms(Sm0yEFK|e&ps45&BTpA? zderQ01a0~x*;&b3`gBSCLl)am*82*;<w?OKQYaDOPzi@5JttStCE58g4sl`_FXptD zS5$ZJFaH?c(#QxBj#gVgdQBMfwG3b<QH{A1ceF;#HJu}e@pQR~<HH!WKw=nU=>ytP zN9zb)wBVS89fXpWXWf#Lo92!VBM&WsLPA|*+!6ID{WxIaL>gy_zJHnMXqM>cGSS_) zQXO5YnlPhUryO%cm#ADOdI)`cpr)lBhGWnat#>v|BvW^f(iq(uLEQ9-kKpSAu$0Gq ztSe-M+%jT(kW*oYoc<1!(VpS-pM`>R@bfke@CFUyJXX`AiQhqj^V8MMEAcfB*Dj9L z2fUuX<V7{X;he!`5yZ5(8&||yTooH}O+11b@dB=k*ZCi@8?&Mp^I{(s#1W*#DclgV zxS9F9#GE;vTxG5kFWib-UBKW14(6k_s)~ZIQmPHtm=nn7YL<g~UAO;Yk$Vd9O(BFG GtNsUP{kJ{< -- GitLab From 3c8d0b3efd85bccddcdc17b1dc7c1e7d00c67227 Mon Sep 17 00:00:00 2001 From: Devon Harstrom <devonharstrom@gmail.com> Date: Sun, 16 Feb 2025 23:36:49 -0700 Subject: [PATCH 07/17] done with refactor 2 on world splitting up and extracting methods all test pass like usual and running the gui is the same --- .../src/reworks2.java | 86 ------------------- 1 file changed, 86 deletions(-) diff --git a/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/reworks2.java b/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/reworks2.java index 38a48a1..e69de29 100644 --- a/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/reworks2.java +++ b/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/reworks2.java @@ -1,86 +0,0 @@ -//public void attack(int index) {// new -// if(aWorld[tempRow][tempColumn] == null){ -// return; -// } -// if((loc[index].getType() == 'O') && (aWorld[tempRow][tempColumn].getAppearance() == 'O')) { -// return; -// } -// if((loc[index].getType() == 'E') && (aWorld[tempRow][tempColumn].getAppearance() == 'E')) { -// return; -// } -// turnSinceAtk = 0; -// if((loc[index].getType() == 'E')&&(aWorld[loc[index].getRow()][loc[index].getColumn()] != null)) { -// attackLogic("elves"); -// } else if((loc[index].getType() == 'O')&&(aWorld[loc[index].getRow()][loc[index].getColumn()] != null)) { -// attackLogic("orcs"); -// } else { -// loc[index].setCanMove(true); -// } -//} -// -//void attackLogic(String attackingEntity){ -// if (attackingEntity.equals("elves")) { -// entityDmg = Entity.ELF_DAMAGE; // Define the Elf damage constant or value -// } else if (attackingEntity.equals("orcs")) { -// entityDmg = Entity.ORC_DAMAGE; // Define the Orc damage constant or value -// } -// -// HP = aWorld[tempRow][tempColumn].getHitPoints(); -// aWorld[tempRow][tempColumn].setHitPoints(aWorld[tempRow][tempColumn].getHitPoints()-entityDmg); -// HPAfter = aWorld[tempRow][tempColumn].getHitPoints(); -// -// if (GameStatus.debugModeOn) {//attack data for elf attackers -// debugAttack(attackingEntity); -// } -// -// deathLogic(attackingEntity, index); -// -// if (attackingEntity.equals("elves")) { -// if (orcCounter > 0) { //here -// return; -// } -// } else if (attackingEntity.equals("orcs")) { -// if (elfCounter > 0) { //here -// return; -// } -// } -// -// System.out.println(entity + "win no more orcs left."); -// programRunning = false; -// if(GameStatus.debugModeOn) {//lose condition data -// debugLossConditions(attackingEntity); -// } -//} -// -//public void debugAttack(String attackingEntity){ -// if (attackingEntity.equals("elves")) { -// status.elfAttackDebug(tempRow, tempColumn, loc[index].getRow(), loc[index].getColumn(),HP,HPAfter); -// } else if (attackingEntity.equals("orcs")) { -// status.orcAttackDebug(tempRow, tempColumn, loc[index].getRow(), loc[index].getColumn(),HP,HPAfter); -// } -//} -// -//public void debugLossConditions(String attackingEntity){ -// if (attackingEntity.equals("elves")) { -// status.orcLoseDebug(orcCounter); -// } else if (attackingEntity.equals("orcs")) { -// status.elfLoseDebug(elfCounter); -// } -//} -// -//public void deathLogic(String attackingEntity, int index){ -// if (aWorld[tempRow][tempColumn].getHitPoints() >0){ -// return; -// } -// aWorld[tempRow][tempColumn] = null; -// -// if (attackingEntity.equals("elves")) { -// orcCounter--; //here // Define the Elf damage constant or value -// } else if (attackingEntity.equals("orcs")) { -// elfCounter--; //here // Define the Orc damage constant or value -// } -// sortDead(); -// if(loc[index] != null) { -// loc[index].setCanMove(true); -// } -//} \ No newline at end of file -- GitLab From f48e707d4dd492bba6c38908c0350463543e4f3e Mon Sep 17 00:00:00 2001 From: Devon Harstrom <devonharstrom@gmail.com> Date: Mon, 17 Feb 2025 12:14:10 -0700 Subject: [PATCH 08/17] refactor 3 done made elf and orc subclass seperated debugs into those classes and also move orc and elf counter to the entity class as i think that makes more sense for the entity to store the number of entities, tests all pass need to adjust some test with new class stuff --- .../assignment3GUI - Classmate's/src/Elf.java | 20 ++++ .../src/Entity.java | 108 +++++++----------- .../src/FileInitialization.java | 45 +++++--- .../src/GamePanel.java | 4 +- .../assignment3GUI - Classmate's/src/Orc.java | 21 ++++ .../src/World.java | 101 +++++++++------- .../src/refactor_1_test.java | 13 ++- .../src/reworks2.java | 62 ++++++++++ out/production/501-gitlab/Elf.class | Bin 0 -> 860 bytes out/production/501-gitlab/Entity.class | Bin 1769 -> 1715 bytes .../501-gitlab/FileInitialization.class | Bin 3374 -> 3308 bytes out/production/501-gitlab/GamePanel.class | Bin 4923 -> 4913 bytes out/production/501-gitlab/Orc.class | Bin 0 -> 859 bytes out/production/501-gitlab/World.class | Bin 6511 -> 6271 bytes .../501-gitlab/refactor_1_test.class | Bin 4866 -> 5048 bytes 15 files changed, 242 insertions(+), 132 deletions(-) create mode 100644 Assignment_1/refactored_code/assignment3GUI - Classmate's/src/Elf.java create mode 100644 Assignment_1/refactored_code/assignment3GUI - Classmate's/src/Orc.java create mode 100644 out/production/501-gitlab/Elf.class create mode 100644 out/production/501-gitlab/Orc.class diff --git a/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/Elf.java b/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/Elf.java new file mode 100644 index 0000000..5cb8403 --- /dev/null +++ b/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/Elf.java @@ -0,0 +1,20 @@ + +public class Elf extends Entity { + public static final char ELF = 'E'; + public static final int ELF_DAMAGE = 7; + public static final int ELF_HP = 15; + + public Elf() { + super(ELF, ELF_HP, ELF_DAMAGE); + } + + @Override + public void debugAttack(GameStatus status, int tempRow, int tempColumn, int targetRow, int targetColumn, int HP, int HPAfter) { + status.elfAttackDebug(tempRow, tempColumn, targetRow, targetColumn, HP, HPAfter); + } + + @Override + public void debugLossConditions(GameStatus status, int entityCounter){ + status.orcLoseDebug(entityCounter); + } +} \ No newline at end of file diff --git a/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/Entity.java b/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/Entity.java index b4427b1..936b9ef 100644 --- a/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/Entity.java +++ b/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/Entity.java @@ -1,65 +1,43 @@ -//Author Ethan McCorquodale - -/* - Version Feb 17A, 2021 - * Added method so an Entity can damage another Entity. - - Version: Feb 12A, 2021 - * Added attribute to track if Entity has been moved or not. - - Version: Feb 11B, 2021 - * Changed references from dwarves to elves. - * Added a new damage attribute. - -*/ - -// do i make sub classes for elf and Orc? - -public class Entity +public abstract class Entity { - public static final char DEFAULT_APPEARANCE = 'X'; - public static final char ELF = 'E'; +// public static final char DEFAULT_APPEARANCE = 'X'; public static final char EMPTY = ' '; - public static final char ORC = 'O'; - public static final int DEFAULT_HP = 1; - public static final int ORC_DAMAGE = 3; - public static final int ELF_DAMAGE = 7; - public static final int ORC_HP = 10; - public static final int ELF_HP = 15; +// public static final int DEFAULT_HP = 1; private char appearance; private int hitPoints; private int damage; - - boolean attacking= false; - public Entity() - { - setAppearance(DEFAULT_APPEARANCE); - setHitPoints(DEFAULT_HP); + + private static int orcCounter = 0; + private static int elfCounter = 0; + + public Entity(char appearance, int hitPoints, int damage) { + this.appearance = appearance; + this.hitPoints = hitPoints; + this.damage = damage; } - public Entity(char newAppearance) + public abstract void debugAttack(GameStatus status, int tempRow, int tempColumn, int targetRow, int targetColumn, int HP, int HPAfter); + public abstract void debugLossConditions(GameStatus status, int entityCounter); + + public char getAppearance() { - appearance = newAppearance; - hitPoints = DEFAULT_HP; - damage = ORC_DAMAGE; + return(appearance); } - public Entity(char newAppearance, int newHitPoints, int newDamage) + public int getHitPoints() { - setAppearance(newAppearance); - setDamage(newDamage); - setHitPoints(newHitPoints); + return(hitPoints); } - /* public void setAtt(boolean isAttacking) { - attacking = isAttacking; + + public void setAppearance(char newAppearance) + { + appearance = newAppearance; } - public boolean getAtt() { - return attacking; - }*/ - public char getAppearance() + + public void setHitPoints(int newHitPoints) { - return(appearance); + hitPoints = newHitPoints; } public int getDamage() @@ -67,32 +45,28 @@ public class Entity return(damage); } - public int getHitPoints() - { - return(hitPoints); + public static int getElfCounter() { + return elfCounter; } - public void setAppearance(char newAppearance)//changed this from private to public to change the entity appearance to ' ' - { - appearance = newAppearance; + public static int getOrcCounter() { + return orcCounter; } - private void setDamage(int newDamage) - { - if (newDamage < 1) - { - System.out.println("Damage must be 1 or greater"); - } - else - { - damage = newDamage; - } + public static void incrementElfCounter(int value) { + elfCounter = elfCounter + value; } - public void setHitPoints(int newHitPoints) - { - hitPoints = newHitPoints; + public static void incrementOrcCounter(int value) { + orcCounter = orcCounter + value; + } + + public static void setElfCounter(int newElfCounter){ + elfCounter = newElfCounter; } + public static void setOrcCounter(int newOrcCounter){ + orcCounter = newOrcCounter; + } +} -} \ No newline at end of file diff --git a/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/FileInitialization.java b/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/FileInitialization.java index bf5b57c..b4dcf48 100644 --- a/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/FileInitialization.java +++ b/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/FileInitialization.java @@ -100,25 +100,38 @@ public class FileInitialization - private static Entity createEntity(char letter) - { - Entity e = null; - switch(letter) - { - case Entity.ORC: - e = new Entity(Entity.ORC,Entity.ORC_HP,Entity.ORC_DAMAGE); - break; +// private static Entity createEntity(char letter) +// { +// Entity e = null; +// switch(letter) { +// case Entity.ORC: +// e = new Entity(Entity.ORC,Entity.ORC_HP,Entity.ORC_DAMAGE); +// break; +// +// case Entity.ELF: +// e = new Entity(Entity.ELF,Entity.ELF_HP,Entity.ELF_DAMAGE); +// break; +// case Entity.EMPTY: +// e = null; +// break; +// default: +// System.out.println("Error: Invalid character [" + letter + +// "] in file"); +// } +// return(e); +// } - case Entity.ELF: - e = new Entity(Entity.ELF,Entity.ELF_HP,Entity.ELF_DAMAGE); - break; + private static Entity createEntity(char letter) { + switch (letter) { + case 'O': + return new Orc(); + case 'E': + return new Elf(); case Entity.EMPTY: - e = null; - break; + return null; default: - System.out.println("Error: Invalid character [" + letter + - "] in file"); + System.out.println("Error: Invalid character [" + letter + "] in file"); + return null; } - return(e); } } \ No newline at end of file diff --git a/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/GamePanel.java b/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/GamePanel.java index 5a21c73..b78437f 100644 --- a/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/GamePanel.java +++ b/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/GamePanel.java @@ -121,7 +121,7 @@ public class GamePanel extends JPanel implements ActionListener{ @Override public void actionPerformed(ActionEvent e) { world.turnSinceAtk++; - for (int i = 0; i<world.elfCounter+world.orcCounter+5; i++) {//the +5 stops the case where when multiple entities die the sortDead() breaks by running this more times than it should it finds all elves/orcs separated by a null + for (int i = 0; i<Entity.getElfCounter()+Entity.getOrcCounter()+5; i++) {//the +5 stops the case where when multiple entities die the sortDead() breaks by running this more times than it should it finds all elves/orcs separated by a null if (GameStatus.debugModeOn == false) { world.move(i); @@ -140,7 +140,7 @@ public class GamePanel extends JPanel implements ActionListener{ } } - if (moveCount >= world.orcCounter+world.elfCounter+3) {//the +3 is there for the same reason the +5 is added to the for loop sortDead() sometimes leaves a null between entities and I cant figure out how to fix that so I use this buffer + if (moveCount >= Entity.getOrcCounter()+Entity.getElfCounter()+3) {//the +3 is there for the same reason the +5 is added to the for loop sortDead() sometimes leaves a null between entities and I cant figure out how to fix that so I use this buffer moveCount = 0; } repaint(); diff --git a/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/Orc.java b/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/Orc.java new file mode 100644 index 0000000..2984c89 --- /dev/null +++ b/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/Orc.java @@ -0,0 +1,21 @@ + + +public class Orc extends Entity { + public static final char ORC = 'O'; + public static final int ORC_DAMAGE = 3; + public static final int ORC_HP = 10; + + public Orc() { + super(ORC, ORC_HP, ORC_DAMAGE); + } + + @Override + public void debugAttack(GameStatus status, int tempRow, int tempColumn, int targetRow, int targetColumn, int HP, int HPAfter) { + status.orcAttackDebug(tempRow, tempColumn, targetRow, targetColumn, HP, HPAfter); + } + + @Override + public void debugLossConditions(GameStatus status, int entityCounter){ + status.orcLoseDebug(entityCounter); + } +} \ No newline at end of file diff --git a/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/World.java b/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/World.java index 2a3afdd..bdf9a52 100644 --- a/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/World.java +++ b/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/World.java @@ -12,8 +12,8 @@ public class World public static final int NOT_OVER = 4; private int i = 0; //creates a local index for the location array in the Display method. Location[] loc = new Location[100];//an array that'll track each entities type,location coordinates and if it can move. - int elfCounter = 0; - int orcCounter = 0; +// int elfCounter = 0; +// int orcCounter = 0; // moved to enitity int tempRow = 0; int tempColumn = 0; int oldRow; @@ -60,16 +60,18 @@ public class World System.out.print("|"+currentCellAppearance); loc[i] = new Location(r,c,currentCellAppearance);//Initializes each Entities location/type if (loc[i].getType() == 'O') {//this checks the type and counts +1 if it's an orc - orcCounter++; +// orcCounter++; + Entity.incrementOrcCounter(1); } if (loc[i].getType() == 'E') { - elfCounter++; +// elfCounter++; + Entity.incrementElfCounter(1); } i++;//Cause each initialization of the loc[i] to go to the next element } public void sortDead() {//supposed to try and sort null elements and bring them to the end doesn't always work as intended - for (int i = 0; i<=elfCounter+orcCounter;i++) { + for (int i = 0; i<=Entity.getElfCounter()+Entity.getOrcCounter();i++) { if (loc[i] == null) { continue; } @@ -85,7 +87,8 @@ public class World } public void sortLocations() {//puts the elfs in the beginning of the array, checks if there is an orc before and elf and if there is it swaps positions in the array - for (int j = 0; j<elfCounter+orcCounter; j++) { + int orcCounter = Entity.getOrcCounter(); + for (int j = 0; j<Entity.getElfCounter()+orcCounter; j++) { if (loc[j+orcCounter] == null){ continue; } @@ -115,61 +118,73 @@ public class World } turnSinceAtk = 0; if((loc[index].getType() == 'E')&&(aWorld[loc[index].getRow()][loc[index].getColumn()] != null)) { - attackLogic("elves", index); + Entity attackingEntity = new Elf(); // Assuming Elf is a subclass of Entity + attackLogic(attackingEntity, index); } else if((loc[index].getType() == 'O')&&(aWorld[loc[index].getRow()][loc[index].getColumn()] != null)) { - attackLogic("orcs", index); + Entity attackingEntity = new Orc(); + attackLogic(attackingEntity, index); } else { loc[index].setCanMove(true); } } - public void attackLogic(String attackingEntity, int index){ - int entityDmg = 0; - if (attackingEntity.equals("elves")) { - entityDmg = Entity.ELF_DAMAGE; // Define the Elf damage constant or value - } else if (attackingEntity.equals("orcs")) { - entityDmg = Entity.ORC_DAMAGE; // Define the Orc damage constant or value - } + public void attackLogic(Entity attackingEntity, int index){ + + int entityDmg = attackingEntity.getDamage(); + +// if (attackingEntity.equals("elves")) { +// entityDmg = Entity.ELF_DAMAGE; //need to fix +// } else if (attackingEntity.equals("orcs")) { +// entityDmg = Entity.ORC_DAMAGE; +// } HP = aWorld[tempRow][tempColumn].getHitPoints(); aWorld[tempRow][tempColumn].setHitPoints(aWorld[tempRow][tempColumn].getHitPoints()-entityDmg); HPAfter = aWorld[tempRow][tempColumn].getHitPoints(); if (GameStatus.debugModeOn) {//attack data for elf attackers - debugAttack(attackingEntity, index); + attackingEntity.debugAttack(status, tempRow, tempColumn, loc[index].getRow(), loc[index].getColumn(),HP,HPAfter); +// } else if (attackingEntity.equals("orcs")) { +// debugAttack(attackingEntity, index); } deathLogic(attackingEntity, index); victoryLogic(attackingEntity); if(GameStatus.debugModeOn) {//lose condition data - debugLossConditions(attackingEntity); + if (attackingEntity instanceof Elf) { + attackingEntity.debugLossConditions(status, Entity.getOrcCounter()); + } else if (attackingEntity instanceof Orc) { + attackingEntity.debugLossConditions(status, Entity.getElfCounter()); + } // maybe move counter to entity? } } - public void debugAttack(String attackingEntity, int index){ - if (attackingEntity.equals("elves")) { - status.elfAttackDebug(tempRow, tempColumn, loc[index].getRow(), loc[index].getColumn(),HP,HPAfter); - } else if (attackingEntity.equals("orcs")) { - status.orcAttackDebug(tempRow, tempColumn, loc[index].getRow(), loc[index].getColumn(),HP,HPAfter); - } - } +// public void debugAttack(Entity attackingEntity, int index){ +// if (attackingEntity.equals("elves")) { +// status.elfAttackDebug(tempRow, tempColumn, loc[index].getRow(), loc[index].getColumn(),HP,HPAfter); +// } else if (attackingEntity.equals("orcs")) { +// status.orcAttackDebug(tempRow, tempColumn, loc[index].getRow(), loc[index].getColumn(),HP,HPAfter); +// } +// } - public void debugLossConditions(String attackingEntity){ - if (attackingEntity.equals("elves")) { - status.orcLoseDebug(orcCounter); - } else if (attackingEntity.equals("orcs")) { - status.elfLoseDebug(elfCounter); - } - } +// public void debugLossConditions(Entity attackingEntity){ +// if (attackingEntity instanceof Elf) { +// Entity.debugLossConditions(status, Entity.getOrcCounter()); +// } else if (attackingEntity instanceof Orc) { +// Entity.debugLossConditions(status, Entity.getElfCounter()); +// } +// } - public void deathLogic(String attackingEntity, int index){ + public void deathLogic(Entity attackingEntity, int index){ if (aWorld[tempRow][tempColumn].getHitPoints() >0){ return; } aWorld[tempRow][tempColumn] = null; - if (attackingEntity.equals("elves")) { - orcCounter--; //here // Define the Elf damage constant or value - } else if (attackingEntity.equals("orcs")) { - elfCounter--; //here // Define the Orc damage constant or value + if (attackingEntity instanceof Elf) { +// orcCounter--; + Entity.incrementOrcCounter(-1); + } else if (attackingEntity instanceof Orc) { +// elfCounter--; + Entity.incrementElfCounter(-1); } sortDead(); if(loc[index] != null) { @@ -177,17 +192,19 @@ public class World } } - public void victoryLogic(String attackingEntity){ - if (attackingEntity.equals("elves")) { - if (orcCounter > 0) { //here + public void victoryLogic(Entity attackingEntity){ + if (attackingEntity instanceof Elf) { + if (Entity.getOrcCounter() > 0) { return; } - } else if (attackingEntity.equals("orcs")) { - if (elfCounter > 0) { //here + } + else if (attackingEntity instanceof Orc) { + if (Entity.getElfCounter() > 0) { return; } } - System.out.println(attackingEntity + "win no more orcs left."); + System.out.println(attackingEntity.getClass().getSimpleName() + " wins, no more opponents left."); +// System.out.println(attackingEntity + "win no more orcs left."); programRunning = false; } diff --git a/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/refactor_1_test.java b/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/refactor_1_test.java index 04413b8..33f5d6b 100644 --- a/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/refactor_1_test.java +++ b/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/refactor_1_test.java @@ -10,8 +10,11 @@ import javax.swing.*; class refactor_1_test { private static World world; -// @BeforeEach -// void setUp() { + @BeforeEach + void setUp() { + Entity.setOrcCounter(0); + Entity.setElfCounter(0); + } // String simulatedInput = "Assignment_1/original_code/assignment3GUI - Classmate's/src/data.txt"; //// String simulatedInput = "Assignment_1/refactored_code/assignment3GUI - Classmate's/src/attackTest.txt\n"; // InputStream originalSystemInStream = System.in; // Save the original System.in @@ -19,7 +22,7 @@ class refactor_1_test { // System.setIn(simulatedInputStream); // Set System.in to the new input stream // world = new World(); // This will call FileInitialization.read() and use the simulated input // System.setIn(originalSystemInStream); // Restore the original System.in -// } + @Test void testBoardInitialization() { @@ -35,8 +38,8 @@ class refactor_1_test { assertNotNull(world.aWorld, "Board should be initialized"); assertEquals(World.SIZE, world.aWorld.length, "Board should have correct rows"); assertEquals(World.SIZE, world.aWorld[0].length, "Board should have correct columns"); - assertEquals(4, world.elfCounter); // check if right amount of elves and orcs - assertEquals(4, world.orcCounter); + assertEquals(4, Entity.getElfCounter()); // check if right amount of elves and orcs + assertEquals(4, Entity.getOrcCounter()); } @Test diff --git a/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/reworks2.java b/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/reworks2.java index e69de29..ca4d021 100644 --- a/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/reworks2.java +++ b/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/reworks2.java @@ -0,0 +1,62 @@ +//public class Entity +//{ +// public static final char DEFAULT_APPEARANCE = 'X'; +// public static final char EMPTY = ' '; +// public static final int DEFAULT_HP = 1; +// +// private char appearance; +// private int hitPoints; +// private int damage; +// +// public Entity(char appearance, int hitPoints, int damage) { +// this.appearance = appearance; +// this.hitPoints = hitPoints; +// this.damage = damage; +// } +// +// public Entity(char newAppearance) { +// appearance = newAppearance; +// hitPoints = DEFAULT_HP; +// damage = ORC_DAMAGE; +// } +// +// public char getAppearance() +// { +// return(appearance); +// } +// +// public int getHitPoints() +// { +// return(hitPoints); +// } +// +// public void setAppearance(char newAppearance) +// { +// appearance = newAppearance; +// } +// +// public void setHitPoints(int newHitPoints) +// { +// hitPoints = newHitPoints; +// } +//} +// +//public class Orc extends Entity { +// public static final char ORC = 'O'; +// public static final int ORC_DAMAGE = 3; +// public static final int ORC_HP = 10; +// +// public Orc() { +// super(ORC_APPEARANCE, ORC_HP, ORC_DAMAGE); +// } +//} +// +//public class Elf extends Entity { +// public static final char ELF = 'E'; +// public static final int ELF_DAMAGE = 7; +// public static final int ELF_HP = 15; +// +// public Elf() { +// super(ELF_APPEARANCE, ELF_HP, ELF_DAMAGE); +// } +//} \ No newline at end of file diff --git a/out/production/501-gitlab/Elf.class b/out/production/501-gitlab/Elf.class new file mode 100644 index 0000000000000000000000000000000000000000..0525cda227418ddd6a15bdece22c951fbeeeb6d0 GIT binary patch literal 860 zcmZ8f+iuf96r9b)&c&%iLV!XG<?c36;1LxeMQ++eN>S9Jydo#r6oX?UXAR<+FXE+0 zJn#X06k^s+L#Zu!XU^`KGv|1J|M~d~fQuI<asv5oFsq<|q6x!-iIRZP4VACH61?(5 zU%e)9+<t$1R6zw*6PAS<)&wet-dvt2PbCY1H5tr0N_mry`*NI|3Y49G`ebQ!3s=w( zu%dV}h!%2rsNhgmn;0Aj2v?xyM&Uwvp&EHXBJ(ubWg%|A+wUB84oO5`M@?;$(cVxq zn-Y!|D!9>93fKcbly8#xSjKO?allAp5KX*b<i)<`%V0sh_i4R2;0*Qzs#EPeYeJyq z4F2`Ecis!j(q7uJb#Y(7RC505IQl}n8o5!B%tMYrdGV=K>4ufz^Q~NO$h6+DGgC4a zXr|>koCRkv^_9;_2-N?#p_{D9^#8a~5~hijlPHNN^1#=Pme|Yg2k*0oyWl)HoIKXi z#8t8uSq|68uj9swuan=rz;7{wzOcdXCNo}AMR2X|)Vp=NZvH_2dn$CB-wFkR64x^B z5Lww#Y_U9u@8SMZ=9|7;jM?pt%~qjRY#A-{4CTvGyjgs;)NyuvDaAxQz{6DD#v}UG zg>5`0O0NJMBHgczZK7g|c8H7=wTVn-Kf%+bp&k`<rqSLwgMHaYg9^>m$5wV~<-=I{ QFtAJ29QB@2Cx_>M0XpxCuK)l5 literal 0 HcmV?d00001 diff --git a/out/production/501-gitlab/Entity.class b/out/production/501-gitlab/Entity.class index 1a7225408c2d8713f9069a3d35ecc3c6127ad800..aa7db3365dade88deee1070225c68799f3e59c41 100644 GIT binary patch literal 1715 zcmZ`(Yi|-!5Iq+b3Uuk)R@?fvO7T(OT3f5QQcHp@(c0)I-O{zL(#60<<A3stkH*9g z{s4cJ@yuPs1(A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6@ zn-7+kV1bf*FoooKTaw`vV)Ee(xqb|}^2^$<nEMkS=GM+|`!~!8w?FZ?zfw8B#RueW yF^@wm;(0_Pf3A`D+pKUveGRd!MjiegOv`-fa^^pf{V2j3&0NMP!)lT@hSnPki2kww diff --git a/out/production/501-gitlab/FileInitialization.class b/out/production/501-gitlab/FileInitialization.class index 55f7e6375b1e5bf7b59a8bef35d2a4ca2d887255..8b36fc1a1fd30df72327c802163fef496a7e9846 100644 GIT binary patch delta 497 zcmX|;%}X0m6vcnfnPielB34B(E5$%5iZ1%GE20<>T!<n_HWIXiYSl#hZH@7}sb7dg zs~b0N3uQ2%P<O?Ze@PelAKEj6xH$LS_ujeZo_F7`biLibwL7iR<r$X(mcyLE%FY*D zX0e(vEF>9bvG&)#FtzW|J7bDoKGycQ1VnWW9V{s(!#u(=Z?%i_j`un#dgrk}rsU=0 zl}f-WkzkxheBdKCS^D_IXDs@8$%?WDc1ZDsRVl2|N?9?+sZge(80U<2Tqz~^!G?H- zMm#pzA|l;mwxtkN<srL##i1&0mDoSLDfdv`>uy<o<`N^hz|XiehwnQ&45;p#I!1N# zD%4b>EYLLaHXUj<h(E~~d-C1H1p9Jf)1s3Db&XK<8k60XqAHJ66HI6*{WB2axnKz$ z!c!qDbPJ<G*A0c-HLv{}X0^WYjekjJ`Zx1%#S`O;V`+Yn4*iwMXd*qD!85)6g&Ypb X-NR3`G87Iuczp0tcE)kcNviihj(Aim delta 579 zcmXYv&1(};6vclpnNB8?(M)R)npF!CYzvlxJJDigXsUr~kZ8e`NN8$1ts1qht?{Fu zYET?d*KS-0QY~0ea8X?PH@I`>pCIU&iHkGu-aF@=ciz44ckhSd&UdS12Vt|(Tym+? z@aSU3U>`j*F)>i<!7%GlW^VVF_10vaN{4!4cisMBPKCg*C`N17;2!3qf)w-m+DWmG z1;t*6zzuFH%W{jRDq-~8**Ei1HQQ>%tOasZ>E<?fum~i4mqpTya*`!QDb_i_GWVo# zp8_ka;_zBnQSPYvh8C`ra=hY!c!q;SJmit?)XfVXvnF2!+EUse!=|`fIDd)GyKNIj zKiyUNxsp3K75k}5v;6<W45zhkODEd;b1l(SpeWWf@^&@ROo@Mq3vA1`&qbcdg~cIN zp7KmCHeY%}t+;FZN>W-cn@aJ$)^Q;%^a*1^AdCo;LjPClQ~spy+Ivh_-f<+!13&L) zI)#E!HUEkJ;uo&NX9k9Lv@e|uVlZh*L#NG9VvdnAA;&d~F-;@TB*xY8v+8wCy^ZgE gxMM7tLp;rz`rFnW<8JA7{GpVgp7*U>^vyf=4;yG=o&W#< diff --git a/out/production/501-gitlab/GamePanel.class b/out/production/501-gitlab/GamePanel.class index 91fe0cc0bbae24617fed89744a345f5612f04abd..39a516068da289acbda3700081911d0e30e70d75 100644 GIT binary patch delta 268 zcmdn3woz@vK2~imhJ1#FJPeB%CNeVcrl*#;=A=32m*$nE7J+1z@GvZe$@p)6%(|Z2 zGLC^62pJf5Xl-E-j@-g9mnC5<!(3)tnH>xZb}%eX;7C}+AijxV*(?TbkP4Y?3~O4L z7?=NlH2JciKMPRBj>&pLUiC5zbqq=j^$c1JH4Fv}O$=rX%?yqVEex&<tqeX4?F>N- z9SkuHoeU`qT@1wx-3-+X{XlX85Kdy4!Z4X(HjrG-FqL6F!!(BN3^N#R0G*@&bQnK_ xBEt&?9tI|m6B%wY+yc@d)=P$042%r-fowho_CE}q{ESk+7+9tCL?#Ja0{{x{My&t< delta 279 zcmXYrze_@46o#LxUDEu>vZ0|nM3|66LsJk5(o_&GEj8UCn?xaOG7`!tb1=FVQ3$41 zLqWf8H3T)*+LkV@*&pB#L4BXa8J_n%=M3*v;307Ns1Lg7;z&?NXmmtl3loW@crv=E zbX9QN(utdfe&Gqnams<0piR%LO|i|qrRW?t)NWJyL&bENWqPkUIl!ZoamRVap`HHJ zt=H~|`2T9b^82RJepU#QW`t!%StZ08lVq4?of$TmW0QHZ#MmN5PG0jIvQ3E{s#u&+ z;GSKc*yEXf-ekpoS=7rA9|#<(GBxUwDmC~-<6Y)X+P`sowSh16zG1^^`o?|%3K&Rp diff --git a/out/production/501-gitlab/Orc.class b/out/production/501-gitlab/Orc.class new file mode 100644 index 0000000000000000000000000000000000000000..3ded1a310dffbbd838082e1f5c38e04f123b0a2e GIT binary patch literal 859 zcmZ8f+iufP5S){X-MCI1ni?pyQ0{I61>TT~kRrD<kphWQlvm^=rWg_%ImaNL`66D5 z!~-9|M<M1Mr=irAt=T=hvomY|{`2z}03T0H6a<RBbZnu7vI)b6i4_6kFqV=0O7J|2 zBl&{B^E;iLp#=-8CTts3)C8=fU=|+BKxT7+T9S@iQU>FX2jM6?5vX__edTR+8<(&q zV6&{7%)>=d$s?^2G4KThpQ@k4a~Z^P7)-OUNTEFr;_=&q)~nXhA*(tnTcjwJZTD4V zk-}3%B|n*j0!}xI!`Int6sB*2(Uh6BZZZz0!yt`RyhxVh`-sxZUG89CV0EID=OzSP zulvv6{+Sn!r9AD}K7TG?%5e5+kbI$Bh5Tfi&0?-W2I)yC^?{w^v!g=0&$f2I^-hMV zKtqq`a^~E@B$5#~AyEHchB8?V_4o0UEY^+IagwFu@MWZouF%Wghv0L7Ti`y_s<43u z))~2s3b@Sp3a&2W4aV2b#n;(EUD)J%iyhC%BGi(1>%F>V{6O)$=DDGA<O3?aE!-rs z^Ga-UI*4!M&VuEe`nQ;Knwwj0$t}BvYo4NVk*bCo98ERI%NJB^#9iFe^bYP*t{Uv% z0g?Ix9C$>^u7e$-vPQc^hDJ>ylid&TXd$Rg2GwaaH&5YQ)X^Zry4JCsS1olIOC1LG N$XX!ZWAYU6<S(6Gi~#@u literal 0 HcmV?d00001 diff --git a/out/production/501-gitlab/World.class b/out/production/501-gitlab/World.class index ec16af92db7fb84aac15086e52800370a82dcba9..c6a8de9779748e7c94c66e3f1d77e7ac167908f7 100644 GIT binary patch literal 6271 zcmaJ_3wT^b75-;;lih44k0x!9W`hA!NVhMH<x$e6lr(K4X%m_@wXM=@vbX8Bo4s-O zrdX`_prELLmMSlSN|B0Ih1zUuTM$GFB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g9<WtK`{U>A4BVR(WoeY8NKk?8^Eo+T)PS3T<+sF+pz<rrqrsFB4*@ zQtDxqlt3oS2Yq**>18)~sqPRhn@tSry^~VgE#W-k0cuo$N0}=gXK%Wl#pwww#*?(- z)65OeFq1sXZ1Eg3#PhhAY4Zvu%d5z@iTt<VW!m}`jh-|}^-R9fE_&(U7w85_!ew(7 z(ao;pIst*gT_|MdIK`M+Glg}_E?u8zN*6wt5ajyxqRu0}Ts3kRuSc(P6)EEG*{G|O zt~<n<!@^KWbA>03Co&lJ`npPj8zCKm!=}gNYpWnYPcW_WFo|tWKaPML|4h!M>}vBm zL3@K8^_%P>-(pC-&3Jx?ZuKtv$M<kFuS6^H0qf9*1n?tPj~y--Tb~7Fy$g^4@`D9x zpQ#h*VEj9W?Pi2GUxUz{k(RyCCQRi>GU9XmNoCi1=rpQ5E{&ImA%$Mkb;n%8(YLO6 zEvKQKJ3rxd=2M#VGaN-JBP;;9dfA=TpxdPZ%~d~>a`TTkw)BRChy=+cB8#MYvtkp@ z;XpE!o%^forc5T|{NB!HI6F5&1v3M-c3RU)(d)UYE~g9A!xv>JeVA;^Ibk6!L(s!| z>5%oj9vZHj(O&G<fiHLm_&09^Ut%71vP|w`68jG=_Z2QSkacmXDfVSezP?}*;UvGL wYY=C>gnMMlA{*hIj2SPtl>6dNZV7_wG2~Ai|IyE{4L@l?82r0O&`_BCUk>ZilmGw# diff --git a/out/production/501-gitlab/refactor_1_test.class b/out/production/501-gitlab/refactor_1_test.class index a65f06e71ad125eed976952294dca3078788afe0..4bba1bf5463ecf4ceb3177ba4521b7de6e647438 100644 GIT binary patch literal 5048 zcmbtYX?WDu6+QBdEqNlg0Rk=%1PQ@r8|)+m?1aP~3``g>!C(RoA!0_hg*DPd(ilja zv`wH*_l>qRX`7ZVbZ<fu<3LOIv`zOl-O_#EmtXx;dY&{Zp5){E^23ted-vUU@44sR z`^HcI@9cR1N&F{<21H~;RWzbW!t{gsn4Yk7dpOZ|;GmK5B{bb&+NQr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Tf3fU( -- GitLab From f6a208e3d10d4cf270a140a540e693b0e01ebd57 Mon Sep 17 00:00:00 2001 From: Devon Harstrom <devonharstrom@gmail.com> Date: Mon, 17 Feb 2025 14:02:40 -0700 Subject: [PATCH 09/17] Done refactor 4 did a bunch of smaller things mainly changed names of variables for example instead of r,c i made it row and column since i think this is much easier to read, also changed g to grapghics in the draw methods in GamePanel and many more. I also deleted unused variables like ELf victory = 1 and many more i also delted unused commented out code and fixed all warning from the original code. Changed if statements from if(a==true) ot just if(a) and same for !a. Also some other smaller refactors here and there --- .../src/World.java | 2 +- .../assignment3GUI - Classmate's/src/Elf.java | 2 +- .../src/Entity.java | 5 +- .../src/FileContainer.java | 12 +- .../src/FileInitialization.java | 103 ++++------- .../src/GamePanel.java | 126 +++++++------ .../src/GameStatus.java | 18 +- .../src/Location.java | 3 - .../src/World.java | 172 +++++++----------- .../src/refactor_1_test.java | 19 +- .../src/reworks.java | 2 +- out/production/501-gitlab/Elf.class | Bin 860 -> 860 bytes out/production/501-gitlab/Entity.class | Bin 1715 -> 1639 bytes .../501-gitlab/FileInitialization.class | Bin 3308 -> 3157 bytes out/production/501-gitlab/GamePanel.class | Bin 4913 -> 4918 bytes out/production/501-gitlab/GameStatus.class | Bin 2785 -> 2706 bytes out/production/501-gitlab/World.class | Bin 6271 -> 6086 bytes .../501-gitlab/refactor_1_test.class | Bin 5048 -> 5050 bytes 18 files changed, 192 insertions(+), 272 deletions(-) diff --git a/Assignment_1/original_code/assignment3GUI - Classmate's/src/World.java b/Assignment_1/original_code/assignment3GUI - Classmate's/src/World.java index 73af68f..d2e0b97 100644 --- a/Assignment_1/original_code/assignment3GUI - Classmate's/src/World.java +++ b/Assignment_1/original_code/assignment3GUI - Classmate's/src/World.java @@ -182,7 +182,7 @@ public class World return false; } public void move(int index) {//changes the value of aWorld[][] must set old position to null then update it to the new position. - if (checkPerim(index) == false) {//checks the perim for things not null if it finds something it returns true and the move code below doesn't run + if (checkPerimiter(index) == false) {//checks the perim for things not null if it finds something it returns true and the move code below doesn't run if (loc[index] != null) { if (loc[index].getCanMove()) { if((loc[index].getRow()-1 != -1)&&(loc[index].getColumn()-1 != -1)) { diff --git a/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/Elf.java b/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/Elf.java index 5cb8403..8647719 100644 --- a/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/Elf.java +++ b/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/Elf.java @@ -15,6 +15,6 @@ public class Elf extends Entity { @Override public void debugLossConditions(GameStatus status, int entityCounter){ - status.orcLoseDebug(entityCounter); + status.elfLoseDebug(entityCounter); } } \ No newline at end of file diff --git a/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/Entity.java b/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/Entity.java index 936b9ef..aa1e351 100644 --- a/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/Entity.java +++ b/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/Entity.java @@ -1,12 +1,11 @@ public abstract class Entity { -// public static final char DEFAULT_APPEARANCE = 'X'; + //removed unused public static final char EMPTY = ' '; -// public static final int DEFAULT_HP = 1; private char appearance; private int hitPoints; - private int damage; + private final int damage; // added final as damage never changes private static int orcCounter = 0; private static int elfCounter = 0; diff --git a/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/FileContainer.java b/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/FileContainer.java index 1b80fc0..df04622 100644 --- a/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/FileContainer.java +++ b/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/FileContainer.java @@ -3,23 +3,23 @@ import java.io.BufferedReader; public class FileContainer { - private BufferedReader br; - private FileReader fr; + private final BufferedReader bufferReader; //these don't change so made them final + private final FileReader fileReader; public FileContainer(BufferedReader aBufferedReader, FileReader aFileReader) { - br = aBufferedReader; - fr = aFileReader; + bufferReader = aBufferedReader; + fileReader = aFileReader; } public BufferedReader getBufferedReader() { - return(br); + return(bufferReader); } public FileReader getFileReader() { - return(fr); + return(fileReader); } } \ No newline at end of file diff --git a/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/FileInitialization.java b/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/FileInitialization.java index b4dcf48..45d672f 100644 --- a/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/FileInitialization.java +++ b/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/FileInitialization.java @@ -33,32 +33,32 @@ public class FileInitialization { public static Entity[][] read() { Entity [][] temp = new Entity[World.SIZE][World.SIZE]; - String line = null; - int r, c; + String line; // changed to this as it's going to be null regardless + int row, column; // changed from r and c so its more readable char letter; - BufferedReader br = null; - FileReader fr = null; - FileContainer aContainer = null; +// BufferedReader bufferReader = null; +// FileReader fileReader = null; + FileContainer aContainer; // changed to this as it's going to be null regardless try { - aContainer = checkingFile(br,fr); - br = aContainer.getBufferedReader(); - fr = aContainer.getFileReader(); - line = br.readLine(); + aContainer = checkingFile(); + BufferedReader bufferReader = aContainer.getBufferedReader(); //changed name from br + FileReader fileReader = aContainer.getFileReader(); // changed name from br so its more readable + line = bufferReader.readLine(); if (line == null) System.out.println("Empty file, nothing to read"); - r = 0; + row = 0; while (line != null) { - c = 0; - while(c < World.SIZE) { - letter = line.charAt(c); - temp[r][c] = createEntity(letter); - c = c + 1; + column = 0; + while(column < World.SIZE) { + letter = line.charAt(column); + temp[row][column] = createEntity(letter); + column = column + 1; } - line = br.readLine(); + line = bufferReader.readLine(); if (line != null) - r = r + 1; + row = row + 1; } - fr.close(); + fileReader.close(); } catch (FileNotFoundException e) { String location = System.getProperty("user.dir"); @@ -71,21 +71,23 @@ public class FileInitialization return(temp); } - private static FileContainer checkingFile(BufferedReader br, FileReader fr) + private static FileContainer checkingFile() { - FileContainer aContainer = null; + FileContainer aContainer; // changed to this as it's going to be null regardless Scanner in = new Scanner(System.in); - String filename = null; - boolean fileFound = false; - while (fileFound == false) + String filename; // changed to this as it's going to be null regardless +// boolean fileFound = false; + while (true) // changed to this as it's still if false { try { System.out.print("Name of file containing starting positions: "); - filename = in.nextLine(); - fr = new FileReader(filename); - br = new BufferedReader(fr); - fileFound = true; + filename = in.nextLine(); + FileReader fileReader = new FileReader(filename); + BufferedReader bufferReader = new BufferedReader(fileReader); +// fileFound = true; + aContainer = new FileContainer(bufferReader, fileReader); + return aContainer; } catch (FileNotFoundException ex) { @@ -93,45 +95,20 @@ public class FileInitialization System.out.println("Input file not in " + location); } - } - aContainer = new FileContainer(br,fr); - return(aContainer); + } +// aContainer = new FileContainer(); +// return(aContainer); } - - - -// private static Entity createEntity(char letter) -// { -// Entity e = null; -// switch(letter) { -// case Entity.ORC: -// e = new Entity(Entity.ORC,Entity.ORC_HP,Entity.ORC_DAMAGE); -// break; -// -// case Entity.ELF: -// e = new Entity(Entity.ELF,Entity.ELF_HP,Entity.ELF_DAMAGE); -// break; -// case Entity.EMPTY: -// e = null; -// break; -// default: -// System.out.println("Error: Invalid character [" + letter + -// "] in file"); -// } -// return(e); -// } private static Entity createEntity(char letter) { - switch (letter) { - case 'O': - return new Orc(); - case 'E': - return new Elf(); - case Entity.EMPTY: - return null; - default: + return switch (letter) { + case 'O' -> new Orc(); + case 'E' -> new Elf(); + case Entity.EMPTY -> null; + default -> { System.out.println("Error: Invalid character [" + letter + "] in file"); - return null; - } + yield null; // 'yield' is used to return a value from the block + } + }; } } \ No newline at end of file diff --git a/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/GamePanel.java b/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/GamePanel.java index b78437f..73314a0 100644 --- a/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/GamePanel.java +++ b/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/GamePanel.java @@ -7,22 +7,21 @@ import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; import javax.swing.JPanel; import javax.swing.Timer; +// removed unused import - - -import java.util.Scanner; //Author Ethan McCorquodale /* Version 3/4/2021: I got the graphical portion setup and functional still need to attach it logically to the World class and have sprites to represent elves/dwarves - Version 3/5/2021: I got the sprites setuap correctly, I'm having issues with having them behave correctly though the attack() method + Version 3/5/2021: I got the sprites setup correctly, I'm having issues with having them behave correctly though the attack() method in the World class needs some tweaking I'm pretty sure as it's a logical error that's occurring (orc isn't attacking elf after it's told to stop moving when the space it's moving to is occupied) Version 3/9/2021: Finally fixed that weird bug that would cause issues when one entity dies, I did so by adding a sortDead method at this point the program runs without any bugs and meets the design specifications I just need to add Debug mode now */ public class GamePanel extends JPanel implements ActionListener{ + // removed unused variables like system.in static final int Height = 300; static final int Width = 300; static final int gridSize = 30; @@ -30,7 +29,6 @@ public class GamePanel extends JPanel implements ActionListener{ final int Delay = 1; int moveCount = 0; World world = new World(); - Scanner in = new Scanner(System.in); Timer timer; GamePanel() { @@ -45,85 +43,85 @@ public class GamePanel extends JPanel implements ActionListener{ timer = new Timer(Delay,this); } - public void paintComponent(Graphics g) { - super.paintComponent(g); - drawWorld(g); + public void paintComponent(Graphics graphics) { // changed g to graphics since I don't like single letter variables + super.paintComponent(graphics); + drawWorld(graphics); } - public void drawWorld(Graphics g) { - for (int r = 0; r<world.SIZE;r++) { - for (int c = 0; c<world.SIZE; c++) { - if(world.aWorld[r][c] == null) { - g.setColor(Color.white); - g.fillRect(0+c*gridSize, 0+r*gridSize, gridSize, gridSize); - g.setColor(Color.black); - g.drawRect(0+c*gridSize, 0+r*gridSize, gridSize, gridSize); + public void drawWorld(Graphics graphics) { + for (int row = 0; row<World.SIZE;row++) { //fixed static warning + for (int column = 0; column<World.SIZE; column++) { + if(world.aWorld[row][column] == null) { + graphics.setColor(Color.white); + graphics.fillRect(column*gridSize, row*gridSize, gridSize, gridSize); // removed unnecessary 0+ + graphics.setColor(Color.black); + graphics.drawRect(column*gridSize, row*gridSize, gridSize, gridSize); // removed unnecessary 0+ } - else if(world.aWorld[r][c].getAppearance() == 'E') { - drawElf(g, c*gridSize, r*gridSize); - } else if (world.aWorld[r][c].getAppearance() == 'O') { - drawOrc(g,c*gridSize,r*gridSize); + else if(world.aWorld[row][column].getAppearance() == 'E') { + drawElf(graphics, column*gridSize, row*gridSize); + } else if (world.aWorld[row][column].getAppearance() == 'O') { + drawOrc(graphics,column*gridSize,row*gridSize); } } } } - public void drawOrc(Graphics g, int x, int y) { + public void drawOrc(Graphics graphics, int x, int y) { int[] xCoord = {x+6,x+19,x+elfSize/2+5}; int[] yCoord = {y+10,y+10,y}; Color orcGreen = new Color(21,158,26); - g.setColor(Color.white); - g.fillRect(x,y, gridSize, gridSize);//sets the background of that grid square white - g.setColor(orcGreen); - g.fillOval(x+5, y+7, elfSize, elfSize+3); + graphics.setColor(Color.white); + graphics.fillRect(x,y, gridSize, gridSize);//sets the background of that grid square white + graphics.setColor(orcGreen); + graphics.fillOval(x+5, y+7, elfSize, elfSize+3); - g.setColor(Color.black); - g.drawOval(x+5, y+7, elfSize, elfSize+3); - g.setColor(orcGreen); - g.fillOval(x+13,y+9,5,7);//draws right eye - g.fillPolygon(xCoord, yCoord, 3);//fills in hat - g.setColor(Color.black); - g.drawPolygon(xCoord, yCoord, 3);//draws outline for hat - g.fillOval(x+7,y+9,5,7);//draws left eye - g.fillOval(x+13,y+9,5,7);//draws right eye + graphics.setColor(Color.black); + graphics.drawOval(x+5, y+7, elfSize, elfSize+3); + graphics.setColor(orcGreen); + graphics.fillOval(x+13,y+9,5,7);//draws right eye + graphics.fillPolygon(xCoord, yCoord, 3);//fills in hat + graphics.setColor(Color.black); + graphics.drawPolygon(xCoord, yCoord, 3);//draws outline for hat + graphics.fillOval(x+7,y+9,5,7);//draws left eye + graphics.fillOval(x+13,y+9,5,7);//draws right eye - g.drawLine((x+5)+(elfSize/3), y+elfSize+10, (x+5)+(elfSize/3), y+elfSize+13);//left foot line 1 - g.drawLine((x+5)+(elfSize/3), y+elfSize+13, x+6, y+elfSize+13);//left foot line 2 - g.drawLine((x+5)+elfSize-(elfSize/3), y+elfSize+10, (x+5)+elfSize-(elfSize/3), y+elfSize+13); - g.drawLine((x+5)+elfSize-(elfSize/3), y+elfSize+13, (x+5)+elfSize-(elfSize/3)+5, y+elfSize+13); - g.drawRect(x,y, gridSize, gridSize); - g.drawString("HP: "+world.aWorld[y/gridSize][x/gridSize].getHitPoints(), x, y); + graphics.drawLine((x+5)+(elfSize/3), y+elfSize+10, (x+5)+(elfSize/3), y+elfSize+13);//left foot line 1 + graphics.drawLine((x+5)+(elfSize/3), y+elfSize+13, x+6, y+elfSize+13);//left foot line 2 + graphics.drawLine((x+5)+elfSize-(elfSize/3), y+elfSize+10, (x+5)+elfSize-(elfSize/3), y+elfSize+13); + graphics.drawLine((x+5)+elfSize-(elfSize/3), y+elfSize+13, (x+5)+elfSize-(elfSize/3)+5, y+elfSize+13); + graphics.drawRect(x,y, gridSize, gridSize); + graphics.drawString("HP: "+world.aWorld[y/gridSize][x/gridSize].getHitPoints(), x, y); } - public void drawElf(Graphics g, int x, int y) { + public void drawElf(Graphics graphics, int x, int y) { int[] xCoord = {x+5,x+20,x+elfSize/2+5}; int[] yCoord = {y+7,y+7,y}; - g.setColor(Color.white); - g.fillRect(x,y, gridSize, gridSize); - g.setColor(Color.green); - g.fillRect(x+5, y+7, elfSize, elfSize); + graphics.setColor(Color.white); + graphics.fillRect(x,y, gridSize, gridSize); + graphics.setColor(Color.green); + graphics.fillRect(x+5, y+7, elfSize, elfSize); - g.fillPolygon(xCoord, yCoord, 3); - g.setColor(Color.black); - g.drawPolygon(xCoord, yCoord, 3); - g.drawRect(x+5, y+7, elfSize, elfSize); - g.fillOval(x+7,y+9,5,7); - g.fillOval(x+13,y+9,5,7); + graphics.fillPolygon(xCoord, yCoord, 3); + graphics.setColor(Color.black); + graphics.drawPolygon(xCoord, yCoord, 3); + graphics.drawRect(x+5, y+7, elfSize, elfSize); + graphics.fillOval(x+7,y+9,5,7); + graphics.fillOval(x+13,y+9,5,7); - g.drawLine((x+5)+(elfSize/3), y+elfSize+7, (x+5)+(elfSize/3), y+elfSize+13); - g.drawLine((x+5)+(elfSize/3), y+elfSize+13, x+6, y+elfSize+13); - g.drawLine((x+5)+elfSize-(elfSize/3), y+elfSize+7, (x+5)+elfSize-(elfSize/3), y+elfSize+13); - g.drawLine((x+5)+elfSize-(elfSize/3), y+elfSize+13, (x+5)+elfSize-(elfSize/3)+5, y+elfSize+13); - g.drawRect(x,y, gridSize, gridSize); - g.drawString("HP: "+world.aWorld[y/gridSize][x/gridSize].getHitPoints(), x, y); + graphics.drawLine((x+5)+(elfSize/3), y+elfSize+7, (x+5)+(elfSize/3), y+elfSize+13); + graphics.drawLine((x+5)+(elfSize/3), y+elfSize+13, x+6, y+elfSize+13); + graphics.drawLine((x+5)+elfSize-(elfSize/3), y+elfSize+7, (x+5)+elfSize-(elfSize/3), y+elfSize+13); + graphics.drawLine((x+5)+elfSize-(elfSize/3), y+elfSize+13, (x+5)+elfSize-(elfSize/3)+5, y+elfSize+13); + graphics.drawRect(x,y, gridSize, gridSize); + graphics.drawString("HP: "+world.aWorld[y/gridSize][x/gridSize].getHitPoints(), x, y); } @Override public void actionPerformed(ActionEvent e) { world.turnSinceAtk++; for (int i = 0; i<Entity.getElfCounter()+Entity.getOrcCounter()+5; i++) {//the +5 stops the case where when multiple entities die the sortDead() breaks by running this more times than it should it finds all elves/orcs separated by a null - if (GameStatus.debugModeOn == false) { + if (!GameStatus.debugModeOn) { //switched, still checking if false world.move(i); } } @@ -134,13 +132,13 @@ public class GamePanel extends JPanel implements ActionListener{ } if(GameStatus.debugModeOn) { moveCount++; - world.turnSinceAtk = 0;//if this doesnt happen cease fire will be met with each entity only moving one at a time - if(world.loc[moveCount]== null) { + world.turnSinceAtk = 0;//if this doesn't happen cease fire will be met with each entity only moving one at a time + if(world.location[moveCount]== null) { System.out.println("Cannot move null");//gives output for when the "buffer" +3 is being called in the debug } } - if (moveCount >= Entity.getOrcCounter()+Entity.getElfCounter()+3) {//the +3 is there for the same reason the +5 is added to the for loop sortDead() sometimes leaves a null between entities and I cant figure out how to fix that so I use this buffer + if (moveCount >= Entity.getOrcCounter()+Entity.getElfCounter()+3) {//the +3 is there for the same reason the +5 is added to the for loop sortDead() sometimes leaves a null between entities and I cant figure out how to fix that so, I use this buffer moveCount = 0; } repaint(); @@ -155,12 +153,10 @@ public class GamePanel extends JPanel implements ActionListener{ public void keyPressed(KeyEvent e) { switch(e.getKeyCode()) { case KeyEvent.VK_SPACE: - if(world.programRunning != false) { + if(!world.programRunning) { // switched it, but it's still false timer.start(); - break; - }else { - break; } + break; // else was unnecessary case KeyEvent.VK_D: if(GameStatus.debugModeOn) { diff --git a/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/GameStatus.java b/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/GameStatus.java index 08e55fe..47159a1 100644 --- a/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/GameStatus.java +++ b/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/GameStatus.java @@ -4,30 +4,24 @@ public class GameStatus { public static boolean debugModeOn = false; - public static void exampleStatic() - { - System.out.println("Hiss! Pop!"); - } - public void orcAttackDebug(int tempRow, int tempCol, int attRow, int attCol, int hitpoints,int hitpointsAfter) { + public void orcAttackDebug(int tempRow, int tempCol, int attRow, int attCol, int hitPoints,int hitPointsAfter) { System.out.println("<<attack method called orc>>"); System.out.println("Elf Defender r/c: " +tempRow+"/"+tempCol); System.out.println("Orc attackers r/c: "+attRow+"/"+attCol); - System.out.println("Elf defenders hitpoints: "+hitpoints); - System.out.println("Elf defenders hitpoints after attack"+ hitpointsAfter); + System.out.println("Elf defenders hit points: "+hitPoints); + System.out.println("Elf defenders hit points after attack"+ hitPointsAfter); } - public void elfAttackDebug(int tempRow, int tempCol, int attRow, int attCol, int hitpoints, int hitpointsAfter) { + public void elfAttackDebug(int tempRow, int tempCol, int attRow, int attCol, int hitPoints, int hitPointsAfter) { System.out.println("<<attack method called for elf>>"); System.out.println("Orc defender r/c: " +tempRow+"/"+tempCol); System.out.println("Elf attackers r/c: "+attRow+"/"+attCol); - System.out.println("Orc defenders hitpoints: "+hitpoints); - System.out.println("Orc defenders hitpoints after attack"+ hitpointsAfter); + System.out.println("Orc defenders hit points: "+hitPoints); + System.out.println("Orc defenders hit points after attack"+ hitPointsAfter); } public void orcMoveDebug(int oldRow, int oldCol, int currentRow, int currentCol) { System.out.println("<<Orc move called>>"); System.out.println("Orc old r/c: "+oldRow+"/"+oldCol); System.out.println("Moved to r/c: "+currentRow+"/"+ currentCol); - - } public void elfMoveDebug(int oldRow, int oldCol, int currentRow, int currentCol) { System.out.println("<<Elf move called>>"); diff --git a/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/Location.java b/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/Location.java index 7ab6303..c79f863 100644 --- a/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/Location.java +++ b/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/Location.java @@ -12,12 +12,10 @@ public class Location entityType = type; } - // what are these? public int getColumn() { return(column); } - public int getRow() { return(row); @@ -38,7 +36,6 @@ public class Location { column = newColumn; } - public void setRow(int newRow) { row = newRow; diff --git a/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/World.java b/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/World.java index bdf9a52..3f85540 100644 --- a/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/World.java +++ b/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/World.java @@ -1,27 +1,16 @@ -import java.util.Scanner; //Author Ethan McCorquodale public class World { - // lots of variables can this be changed?? + // //removed unused variables such as all final states and tempChat = ' ' which can just be local public static final int SIZE = 10; - public static final int ORCS_WIN = 0; - public static final int ELVES_WIN = 1; - public static final int DRAW = 2; - public static final int CEASE_FIRE = 3; - public static final int NOT_OVER = 4; - private int i = 0; //creates a local index for the location array in the Display method. - Location[] loc = new Location[100];//an array that'll track each entities type,location coordinates and if it can move. -// int elfCounter = 0; -// int orcCounter = 0; // moved to enitity + private int locationIndex = 0; //creates a local index for the location array in the Display method. // changed from i since that's not a great name + Location[] location = new Location[100];//an array that'll track each entities type,location coordinates and if it can move. int tempRow = 0; int tempColumn = 0; int oldRow; int oldCol; - int HP; int turnSinceAtk; - int HPAfter; - char tempType = ' '; public Entity [][] aWorld; public boolean programRunning = true; @@ -40,10 +29,10 @@ public class World } public void initializeGrid(){ - for (int r = 0; r < SIZE; r++){ + for (int row = 0; row < SIZE; row++){ // changed all instances of r and c so its more readable System.out.println("\n - "+"- "+"- "+"- "+"- "+"- "+"- "+"- "+"- "+ "- "); // removed unnecessary print - for (int c = 0; c < SIZE; c++){ - initalizeLocations(r, c); + for (int column = 0; column < SIZE; column++){ + initializeLocations(row, column); } System.out.print("|"); } @@ -51,36 +40,34 @@ public class World sortLocations(); } - public void initalizeLocations(int r, int c){ - if (aWorld[r][c] == null) { + public void initializeLocations(int row, int column){ + if (aWorld[row][column] == null) { System.out.print("| "); return; } - char currentCellAppearance = aWorld[r][c].getAppearance(); + char currentCellAppearance = aWorld[row][column].getAppearance(); System.out.print("|"+currentCellAppearance); - loc[i] = new Location(r,c,currentCellAppearance);//Initializes each Entities location/type - if (loc[i].getType() == 'O') {//this checks the type and counts +1 if it's an orc -// orcCounter++; + location[locationIndex] = new Location(row,column,currentCellAppearance);//Initializes each Entities location/type + if (location[locationIndex].getType() == 'O') {//this checks the type and counts +1 if it's an orc Entity.incrementOrcCounter(1); } - if (loc[i].getType() == 'E') { -// elfCounter++; + if (location[locationIndex].getType() == 'E') { Entity.incrementElfCounter(1); } - i++;//Cause each initialization of the loc[i] to go to the next element + locationIndex++;//Cause each initialization of the location[locationIndex] to go to the next element } public void sortDead() {//supposed to try and sort null elements and bring them to the end doesn't always work as intended - for (int i = 0; i<=Entity.getElfCounter()+Entity.getOrcCounter();i++) { - if (loc[i] == null) { + for (int locationIndex = 0; locationIndex<=Entity.getElfCounter()+Entity.getOrcCounter();locationIndex++) { + if (location[locationIndex] == null) { continue; } - if((aWorld[loc[i].getRow()][loc[i].getColumn()] != null)||(loc[i+1] == null)) { + if((aWorld[location[locationIndex].getRow()][location[locationIndex].getColumn()] != null)||(location[locationIndex+1] == null)) { continue; } - loc[i] = loc[i+1]; - loc[i+1] = null; - if(i-2 >= 0 && loc[i-2]== null) { + location[locationIndex] = location[locationIndex+1]; + location[locationIndex+1] = null; + if(locationIndex-2 >= 0 && location[locationIndex-2]== null) { sortDead(); } } @@ -89,62 +76,53 @@ public class World public void sortLocations() {//puts the elfs in the beginning of the array, checks if there is an orc before and elf and if there is it swaps positions in the array int orcCounter = Entity.getOrcCounter(); for (int j = 0; j<Entity.getElfCounter()+orcCounter; j++) { - if (loc[j+orcCounter] == null){ + if (location[j+orcCounter] == null){ continue; } - if(((loc[j].getType() != 'O')||(loc[j+orcCounter].getType() != 'E'))) { + if(((location[j].getType() != 'O')||(location[j+orcCounter].getType() != 'E'))) { continue; } - tempRow = loc[j+orcCounter].getRow(); - tempColumn = loc[j+orcCounter].getColumn(); - tempType = loc[j+orcCounter].getType(); - loc[j+orcCounter].setType(loc[j].getType()); - loc[j+orcCounter].setColumn(loc[j].getColumn()); - loc[j+orcCounter].setRow(loc[j].getRow()); - loc[j].setRow(tempRow); - loc[j].setColumn(tempColumn); - loc[j].setType(tempType); + tempRow = location[j+orcCounter].getRow(); + tempColumn = location[j+orcCounter].getColumn(); + char tempType = location[j+orcCounter].getType(); + location[j+orcCounter].setType(location[j].getType()); + location[j+orcCounter].setColumn(location[j].getColumn()); + location[j+orcCounter].setRow(location[j].getRow()); + location[j].setRow(tempRow); + location[j].setColumn(tempColumn); + location[j].setType(tempType); } } public void attack(int index) {// new if(aWorld[tempRow][tempColumn] == null){ return; } - if((loc[index].getType() == 'O') && (aWorld[tempRow][tempColumn].getAppearance() == 'O')) { + if((location[index].getType() == 'O') && (aWorld[tempRow][tempColumn].getAppearance() == 'O')) { return; } - if((loc[index].getType() == 'E') && (aWorld[tempRow][tempColumn].getAppearance() == 'E')) { + if((location[index].getType() == 'E') && (aWorld[tempRow][tempColumn].getAppearance() == 'E')) { return; } turnSinceAtk = 0; - if((loc[index].getType() == 'E')&&(aWorld[loc[index].getRow()][loc[index].getColumn()] != null)) { + if((location[index].getType() == 'E')&&(aWorld[location[index].getRow()][location[index].getColumn()] != null)) { Entity attackingEntity = new Elf(); // Assuming Elf is a subclass of Entity attackLogic(attackingEntity, index); - } else if((loc[index].getType() == 'O')&&(aWorld[loc[index].getRow()][loc[index].getColumn()] != null)) { + } else if((location[index].getType() == 'O')&&(aWorld[location[index].getRow()][location[index].getColumn()] != null)) { Entity attackingEntity = new Orc(); attackLogic(attackingEntity, index); } else { - loc[index].setCanMove(true); + location[index].setCanMove(true); } } public void attackLogic(Entity attackingEntity, int index){ - int entityDmg = attackingEntity.getDamage(); - -// if (attackingEntity.equals("elves")) { -// entityDmg = Entity.ELF_DAMAGE; //need to fix -// } else if (attackingEntity.equals("orcs")) { -// entityDmg = Entity.ORC_DAMAGE; -// } - HP = aWorld[tempRow][tempColumn].getHitPoints(); + int HP = aWorld[tempRow][tempColumn].getHitPoints(); aWorld[tempRow][tempColumn].setHitPoints(aWorld[tempRow][tempColumn].getHitPoints()-entityDmg); - HPAfter = aWorld[tempRow][tempColumn].getHitPoints(); + int HPAfter = aWorld[tempRow][tempColumn].getHitPoints(); if (GameStatus.debugModeOn) {//attack data for elf attackers - attackingEntity.debugAttack(status, tempRow, tempColumn, loc[index].getRow(), loc[index].getColumn(),HP,HPAfter); -// } else if (attackingEntity.equals("orcs")) { -// debugAttack(attackingEntity, index); + attackingEntity.debugAttack(status, tempRow, tempColumn, location[index].getRow(), location[index].getColumn(),HP,HPAfter); } deathLogic(attackingEntity, index); victoryLogic(attackingEntity); @@ -153,26 +131,10 @@ public class World attackingEntity.debugLossConditions(status, Entity.getOrcCounter()); } else if (attackingEntity instanceof Orc) { attackingEntity.debugLossConditions(status, Entity.getElfCounter()); - } // maybe move counter to entity? + } } } -// public void debugAttack(Entity attackingEntity, int index){ -// if (attackingEntity.equals("elves")) { -// status.elfAttackDebug(tempRow, tempColumn, loc[index].getRow(), loc[index].getColumn(),HP,HPAfter); -// } else if (attackingEntity.equals("orcs")) { -// status.orcAttackDebug(tempRow, tempColumn, loc[index].getRow(), loc[index].getColumn(),HP,HPAfter); -// } -// } - -// public void debugLossConditions(Entity attackingEntity){ -// if (attackingEntity instanceof Elf) { -// Entity.debugLossConditions(status, Entity.getOrcCounter()); -// } else if (attackingEntity instanceof Orc) { -// Entity.debugLossConditions(status, Entity.getElfCounter()); -// } -// } - public void deathLogic(Entity attackingEntity, int index){ if (aWorld[tempRow][tempColumn].getHitPoints() >0){ return; @@ -180,15 +142,13 @@ public class World aWorld[tempRow][tempColumn] = null; if (attackingEntity instanceof Elf) { -// orcCounter--; Entity.incrementOrcCounter(-1); } else if (attackingEntity instanceof Orc) { -// elfCounter--; Entity.incrementElfCounter(-1); } sortDead(); - if(loc[index] != null) { - loc[index].setCanMove(true); + if(location[index] != null) { + location[index].setCanMove(true); } } @@ -208,65 +168,65 @@ public class World programRunning = false; } - public boolean checkPerim(int index) {//looks at all the spaces around the current index of loc[index] looking for things not null - if (loc[index] == null){ + public boolean checkPerimeter(int index) {//looks at all the spaces around the current index of location[index] looking for things not null + if (location[index] == null){ return false; } - for(int r = loc[index].getRow()-1; r<loc[index].getRow()+2;r++) { - for(int c = loc[index].getColumn()-1; c<loc[index].getColumn()+2;c++ ) { - if((r > 9)||(c > 9)||(r <= - 1)||(c <= -1)){ //ensuring r/c is in aWorld + for(int row = location[index].getRow()-1; row<location[index].getRow()+2;row++) { + for(int column = location[index].getColumn()-1; column<location[index].getColumn()+2;column++ ) { + if((row > 9)||(column > 9)||(row <= - 1)||(column <= -1)){ //ensuring row/column is in aWorld continue; } - if((aWorld[r][c] == null) || (loc[index].getType() == aWorld[r][c].getAppearance())) { + if((aWorld[row][column] == null) || (location[index].getType() == aWorld[row][column].getAppearance())) { continue; } - loc[index].setCanMove(false); - tempRow = r; - tempColumn = c; + location[index].setCanMove(false); + tempRow = row; + tempColumn = column; attack(index); return true; } } - loc[index].setCanMove(true); + location[index].setCanMove(true); return false; } // these methods could be broken up into smaller ones public void move(int index) {//changes the value of aWorld[][] must set old position to null then update it to the new position. - if (checkPerim(index) == true){ //checks the perim for things not null if it finds something it returns true and the move code below doesn't run + if (checkPerimeter(index)){ // changed syntax of if statement still needs to be true return; } - if (loc[index] == null) { + if (location[index] == null) { return; } - if (loc[index].getCanMove()==false){ + if (!location[index].getCanMove()){ // changed syntax of if statement still needs to be false return; } - if((loc[index].getRow()-1 != -1)&&(loc[index].getColumn()-1 != -1)) { + if((location[index].getRow()-1 != -1)&&(location[index].getColumn()-1 != -1)) { moveLogic('E', index, -1); } - if((loc[index].getRow()+1 != 10)&&(loc[index].getColumn()+1 != 10)) { + if((location[index].getRow()+1 != 10)&&(location[index].getColumn()+1 != 10)) { moveLogic('O', index, 1); } - if ((GameStatus.debugModeOn == true)&&(loc[index] != null)) { + if ((GameStatus.debugModeOn)&&(location[index] != null)) { // changed syntax of if statement still needs to be true debugMovement(index); } } public void debugMovement(int index){ - if (loc[index].getType() == 'E') {//elf move data - status.elfMoveDebug(oldRow,oldCol,loc[index].getRow(),loc[index].getRow()); - } else if (loc[index].getType() == 'O') {//orc move data - status.orcMoveDebug(oldRow,oldCol,loc[index].getRow(),loc[index].getRow()); + if (location[index].getType() == 'E') {//elf move data + status.elfMoveDebug(oldRow,oldCol,location[index].getRow(),location[index].getRow()); + } else if (location[index].getType() == 'O') {//orc move data + status.orcMoveDebug(oldRow,oldCol,location[index].getRow(),location[index].getRow()); } } public void moveLogic(char entityType, int index, int increment){ - if ((loc[index].getType() == entityType)&&(aWorld[loc[index].getRow()+ increment][loc[index].getColumn()+increment]== null)) { - oldRow = loc[index].getRow(); - oldCol = loc[index].getColumn(); - loc[index].setRow(oldRow+increment); - loc[index].setColumn(oldCol+increment); + if ((location[index].getType() == entityType)&&(aWorld[location[index].getRow()+ increment][location[index].getColumn()+increment]== null)) { + oldRow = location[index].getRow(); + oldCol = location[index].getColumn(); + location[index].setRow(oldRow+increment); + location[index].setColumn(oldCol+increment); aWorld[oldRow+increment][oldCol+increment] = aWorld[oldRow][oldCol]; aWorld[oldRow][oldCol] = null; } diff --git a/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/refactor_1_test.java b/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/refactor_1_test.java index 33f5d6b..5583574 100644 --- a/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/refactor_1_test.java +++ b/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/refactor_1_test.java @@ -4,9 +4,6 @@ import java.io.InputStream; import static org.junit.jupiter.api.Assertions.*; import org.junit.jupiter.api.*; -import java.awt.*; -import javax.swing.*; - class refactor_1_test { private static World world; @@ -59,7 +56,7 @@ class refactor_1_test { System.setIn(originalSystemInStream); // Restore the original System.in //in data.txt the sorted array should be OOEEOOEE StringBuilder afterSort = new StringBuilder(); - for (Location location : world.loc) { + for (Location location : world.location) { afterSort.append(location != null ? location.getType() : ""); } assertEquals("OOEEOOEE", afterSort.toString(), "Locations should be sorted like this"); @@ -78,13 +75,13 @@ class refactor_1_test { world.tempRow = 0; world.tempColumn = 0; world.attack(0); //elf will attack - int Hp = world.aWorld[world.loc[1].getRow()][world.loc[1].getColumn()].getHitPoints(); + int Hp = world.aWorld[world.location[1].getRow()][world.location[1].getColumn()].getHitPoints(); System.out.println("health after attack: " + Hp); - assertTrue(world.aWorld[world.loc[1].getRow()][world.loc[1].getColumn()].getHitPoints() < 10, "Orc should lose HP after attack"); + assertTrue(world.aWorld[world.location[1].getRow()][world.location[1].getColumn()].getHitPoints() < 10, "Orc should lose HP after attack"); } @Test - void checkPerimTest(){ + void checkPerimeterTest(){ String simulatedInput = "Assignment_1/refactored_code/assignment3GUI - Classmate's/src/perimTest.txt\n"; InputStream originalSystemInStream = System.in; // Save the original System.in ByteArrayInputStream simulatedInputStream = new ByteArrayInputStream(simulatedInput.getBytes()); @@ -92,10 +89,10 @@ class refactor_1_test { world = new World(); // This will call FileInitialization.read() and use the simulated input System.setIn(originalSystemInStream); // Restore the original System.in - assertTrue(world.checkPerim(0), "should be true, something next to the elf"); - assertTrue(world.checkPerim(1), "should be true, something next to the orc"); - assertFalse(world.checkPerim(2), "should be false, nothing next to the elf"); - assertFalse(world.checkPerim(3), "should be false, spot is null"); + assertTrue(world.checkPerimeter(0), "should be true, something next to the elf"); + assertTrue(world.checkPerimeter(1), "should be true, something next to the orc"); + assertFalse(world.checkPerimeter(2), "should be false, nothing next to the elf"); + assertFalse(world.checkPerimeter(3), "should be false, spot is null"); } @Test diff --git a/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/reworks.java b/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/reworks.java index 14d3272..3d5218a 100644 --- a/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/reworks.java +++ b/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/reworks.java @@ -1,5 +1,5 @@ //public void move(int index) {//changes the value of aWorld[][] must set old position to null then update it to the new position. -// if (checkPerim(index) == true){ //checks the perim for things not null if it finds something it returns true and the move code below doesn't run +// if (checkPerimeter(index) == true){ //checks the perim for things not null if it finds something it returns true and the move code below doesn't run // return; // } // if (loc[index] == null) { diff --git a/out/production/501-gitlab/Elf.class b/out/production/501-gitlab/Elf.class index 0525cda227418ddd6a15bdece22c951fbeeeb6d0..a86f871f5e71e57a6a183189c5f70b06aa23017a 100644 GIT binary patch delta 14 Vcmcb^c86_3J#%VK+Qz0^OaLx!1|0wZ delta 14 Vcmcb^c86_3J#&6h^2VlHOaLy)1}Xpm diff --git a/out/production/501-gitlab/Entity.class b/out/production/501-gitlab/Entity.class index aa7db3365dade88deee1070225c68799f3e59c41..42856365d5f59a4b42527ffacc08c880effed152 100644 GIT binary patch literal 1639 zcmZ`(YflqF6g|^!3)^mam6tpeRHRe{6ci97l2Wxv6%t4jzqzz)S!}nYonrh?e(^y} z{NNApM;Xt|Hf39DlkM!>IrrRi&)oL+pP#<~WUv=Q2;n{$79xlW44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Y2fkiWi09_F(nujafQ*en*t{zS+SeZxGVa^Ap4)JPs;8hFfeqOh#)v}tm9Hyx zKhRCyl;md2#<<)hcicU9*Av$P8<XP7c(s>Ky%lJ$A?|}V4jFg7QEj^w#_kta3s1_M z&kL1GvGAy{?i3ZWPCaO9H_%&dt>wij?x{ke_^`71OpIfs{u8!V5sza2oKq^zZz)(# zeTQ`qm;Jz7Z|!Y+jZJsEM$cHeUUh3*Zo?P5?X>hOpITDoQ2dg@;EuQ5+AV19R^KQb z$dw<sd){O1>Q-~9WImE*+@Q+!W|Ot<_}XX1?07d?fZ1J77b5*+;~fQ?-nGB2q_ae5 zvm0vV9K#TJ@1qPhVUbuXXJp$%MZ9SyxNjyBmQd`BBD6OmGZ^=SYQx*}0v$yq-bwSR zv~wGcky@kZEYo+{yzj#EK5D0ytF`tjW**mDjjFfm%a8`cIb4v{wT^RZVjORZi!%)y z3Ny4~n5BI<VjrP>6eFGcW5jT!4VG(bPA)0WjI5wJxuHCV8I!<qK2Ol9G0x&Sk^csj zpV`Mies&+({Na6!exg5ylYCAx0vIB47-_N$VU$0CF`S||AI4)2r)iPN)S=9qR3d67 z<OhSerEms0fag5pxWqV%bL~nNcuG_v{}lrt`4Xm18s{OCO4>m{JC(wDT%bo}M1!-v z!AJTAFW_Q3c!jB?%B0c%SGD}Nfcg`R7p0RSs-rZCOJ*VpmvN;ZSGJccN3Qw*a9w4G zqyyLbiW=<|b-s_NG_H4oXGtX=>oX=KR+&MD-Mqvh-sp#%>P227@@7Ze4K_en)8w3f z@dXpT`WCsjw<3k5u}D=6p!ZLQA|z8nGSy3Rn<OiJNtQY!LS}Yhx=$4aZsffPK?2L| xDsJ~B_@{y*30AuZRt!N3cOV^<jhi$1DJ@P3{F+{bO%C^FkR-COcL|Q6@Eax}`85Cl diff --git a/out/production/501-gitlab/FileInitialization.class b/out/production/501-gitlab/FileInitialization.class index 8b36fc1a1fd30df72327c802163fef496a7e9846..aaa74418769d8759d4821f12de9e6278641c6083 100644 G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b/out/production/501-gitlab/GamePanel.class index 39a516068da289acbda3700081911d0e30e70d75..637f3524b16db275aeabfab526b1e6ab8d0fb2a5 100644 GIT binary patch delta 22 dcmdm}woPqAIvXcPPJVJ?NoIcD=4`fOJOEyc2r&Qv delta 17 Ycmdm{woz?EIvWdfPJZ&{0=8p3066Cc5dZ)H diff --git a/out/production/501-gitlab/GameStatus.class b/out/production/501-gitlab/GameStatus.class index 81e4ad5b6588f9e5771169ebc0c5d7378d199585..d0ed66137910af5a8c21712eb155d800781f2f7f 100644 GIT binary patch literal 2706 zcmb_eZC4vb6n+K*S<<CITIfrl-P)8wtxeVX*2HL=(iRN`OQqWSwj@JY*zCmJ4VAC{ z3jc<BPWAA?AK;Jj_{?lV0tAoeXg=J%clOS6pL_4j-Te92-X8!e_#uM<45pE?F@#}( z@hx}9E%<KmqOiQaC2O(3aLEh2xGXR@H@`Ll3nOV{Y@C37z<qT$ie-ads>Mx{RRiRy z!b<1`@oF4Ow^6ikQee7Na^u*oZ95GaZ>qXebA4ad9TnEf<qXC#kw(_WDV!EK)dxi& z-PD+Vz%X-397C8vyx>J~el5$?rfi(SS%EVRcUx9eP;=v_Uc5;yirpZN1g7Q|7w3;| z&w{VAtV&KJOzRl^-3F1fa8bZHCZ7!zI?~@Lm$OJ|#33z)k;@{jcV1z3rP6X(a~f(# zwu_*hE$uggDGT$)Wx?M#?2^$gCp46e+z4)<kj70LZ{jV1%mcR}S7SGBF~<{ix!!uQ zr0Q~+)e_GHQWY8kV^uGZk6Mj&89s5>eXeAyij7!vLr>f7#Z<iM5yq}|L5l(>*{VCH zh4(bPzz9pJfAec>4o^Yzv3kjHi*2i-d>$h<-7IUxtc+}W@rq(68R6u<erF?=As1M> z12Jp{U1Fu$A=4(L4mhm*dIC(v0B35gFqA<Ou49-tHc@*(G-g#r9n2IvO+bsQ71auO zjJ1D{gGICb#wykP_Pxlgs#aK&_dQ+4v2LYq=)=o9a#yK1ibJ=#WX^kJVU?$9fo;7f zH)K$kp%WH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$J)RqFb@OyFU0Ox^tFkMI;;9`4J7&^dIXE1z#%X-iyI!Q8$qJa?<Fp61>vEtKs z7iTp2<v3eHo_V=a(FIlT9zDgfg7^79sJ%P%Qrf#qZ%BJpdP<Oc{i`s$Ra|LP)m6;4 zN2-cqXTU1v`c`q4Rh(lL1y(W6D$bMZ#Q$E!67DBw@dImC6&BT5ywt5?zD-qEv2cW| z`V|Ex$@L<cPLb<n&GA-@)ls^L2h>fqQ4!1Zl+s14&{Ikm@d3RQ*FWsf=USJ~jeo&s zhJ3DQ<z}g_YTN(Hr-s!;pCxiutVdLj9^mC8Lc}e8mCZM=6OPBh9RWu0PzxZib`s>x zzL3`ldHn>)bq#6Yqs}Fq)*AB$5B`Eu_X5T@c!**@VhID-z+-;bc};w7_*mN~+J36- kQ*FP{_A6~IZEbC(wmaH7+U{xFK#QpAitpn&zQcvT0nQsd{{R30 diff --git a/out/production/501-gitlab/World.class b/out/production/501-gitlab/World.class index c6a8de9779748e7c94c66e3f1d77e7ac167908f7..49b7ee563398e1b95c95256c42ee8e3f7b6fc0e5 100644 GIT binary patch literal 6086 zcmaJ_33yc175?AMBr_RaNJt<GNif;~Vc2X+Q3wPv1c(Nb5(omeW|Da%Lnia$%nOKO zT|g`D0xq~f1S{I&0)+vgYTZC_uS@sV*6zD)wJlQZf9`v4W+HsbmwE4=d+xpG{O6qi zp6Ag|4n75-PV)xgf!7b8jvVA_C|ns{6`m9e$2%uAwXZZfEDgESqw%O!tHE0}wlxm{ z<oOZQF$lVboF!%=7SWI&Gdsdo)QmU8BgQ2fv<5#0YX~$tVp&$GV+e{UbagchTHfet z)QHMZ9m8Z>zh(6FE;Lt*>=YfRiYzFyIy2VS6BqFa9i=GKFt|5ib|%6-3;W{nXuOk0 zFY{w0)#rwLj20_w^(BKShga5|uHy`RfgUB5T!Y@2(W>!d6qhYu-dG>EqShK^&=?(6 zBF+sfM}r7qoFC(LOu$49MRTGtqk-T=!?Eb4%6|>Mgb^kpdezv>RzV(qrj9Q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Fv<Ow0AX%T78i3oW) zh9O&|5j69LRJ{dzPvV^fRgUROV~(o8B2|f%stR#cP0vl>4{^2m5T`A9+jr2j5n3ud ux%b3RJMdP%TC?AKojKzd3HE?Wi9jWvf>6qDzDsx<e+VI6sj5{Cj{hI_T(2Df diff --git a/out/production/501-gitlab/refactor_1_test.class b/out/production/501-gitlab/refactor_1_test.class index 4bba1bf5463ecf4ceb3177ba4521b7de6e647438..729327417910f95ce79c3d0e9f9ab5e8066d5785 100644 GIT binary patch delta 671 zcmZvY$xo9}6vfYLE3f@J7ZVEAS_P?7k*XCe(vm2p1_xMxN>qkYr2=grC~kD4iGRSA z4S#@fYuK1Z-MBDuV<OJ;JkN<PttW(-7+rktz3<)gJNKS<AzTa_*M1c*1K5J^=Z&9c zn{}j+>7U3I@-r4ogW2uM3}rLJ9og~RXm%nyK9kb5W|=fv)g8HHMBKi=%kslWt7nq1 z2RttnY%0`05f9bJ>#cYtIeWG1je)m#r}5r_DSVJ=`>gsbdB-ZtSB0RAIf7Djv?(nn zXN%1N3!JdRCGF00(JGj+2pWq~jvy+q1WOUZax6mx)o4TwQvB;iE%qafL9CD(*MO>% z)2?FkI<gzc#>j3Y+d#IF>Nx7qgzeZ&eG?8Nful&`3LhhZGT!^qiyLyny|!-_H#yBM zR*u0^V%e&(S|gxwTf?u>qj6U$pv1Xs|0`(>Kv7o$pXFbHI6YOB^Hywfm0uZ^*SQ1t zq{VYFx|JbX86w3HZ48lSh;0nfjx`*0J$5k8PKMvbARU-Sr$oH5z<r#YAKVX931_h2 zPjfl$txykS$~(ETi{9Pz-c9d4^xjMF9(wOXl#b0fz)rpBLZ8HZN%c^U_|8TK$z;hK zBy)(&5SbjAVQj((Ix$M8JWmCj!kDDXlhH@aV!~rQ;l7acYbJa;w?3a+U*aPx25&#% I3%;T9H{4%|{{R30 delta 654 zcmZXQOH30{6o&uHj7&RI`T&y_8?{Po1+35*QmmmxOe`V_K7%OHQi+rzMQp^KCc1Hb zG$zKiackI^O5Ct8abqHaZ}I&WUy1Ile+ZF<nasVJd(QXIcWxncJ!IbgQ@9CW6MkMZ ze`&flm`jh@^{8f<>HfZSwzF>}b9Ai32x@j4OR0P&Hzdc+q<SDX%&_HLXp-M%t9mKT zmf!ta!L9<Sd@N8OtGD5;WUVUadlMh<(ZDAMF5t6VwkFkA8Ftj@-xZdLa(HFNGGyG5 zRHo=<&2|@bxM71wwv}CtEQN;UFc3fmR=|suT&u8(PZ&WoB81IYjlHNw4{C52wGwpp zs)(F(7MdE!M#(mkT~9Vfb_2;KtVJB{NU%SS0c^wxv|xg_5l1P{eYlHBIqj-T+`|-Y zrdc@&y~wi7K&=74f%^u02D%MAR0=54(f)r)W?f!$p;KJ$C6)7^jJ(CS6bg5^1COM| zJswF?xs}RWsN6>7tyFHO@^-922iBpJL+s$FJE^@3m#|yvJPrQGI5V&5LrD?mvFM+R zobq_p6S?Rat?pv>K4y0_dq1-eFuRA@2NA&`UP_98?ZqCXC0d?PPi3_HO85wweli&{ z17xyf2FVQZLUS}3Mi-9pWCUlCm$r&T<QZov!3>^rUrhQPCwwutzM5O#;0r4zPiOHB HKT!D>#N>(7 -- GitLab From 1dc732eab1b8aa6b3c35d2950b89096ac7024f42 Mon Sep 17 00:00:00 2001 From: Devon Harstrom <devonharstrom@gmail.com> Date: Mon, 17 Feb 2025 15:18:15 -0700 Subject: [PATCH 10/17] fixed a small error i didn't realize where if(world.programRunning) in game panel use to be if(!world.programRunning) so it wouldnt actually do rounds, the tests passed but that actual gui part didn't so fixed that --- .../src/FileInitialization.java | 18 +- .../src/GamePanel.java | 40 ++-- .../src/World.java | 2 +- .../src/scrap2.txt | 114 ++++++++++++ .../src/scrap3.txt | 173 ++++++++++++++++++ out/production/501-gitlab/FileContainer.class | Bin 696 -> 714 bytes .../501-gitlab/FileInitialization.class | Bin 3157 -> 3182 bytes .../501-gitlab/GamePanel$MyKeyAdapter.class | Bin 1197 -> 1193 bytes out/production/501-gitlab/GamePanel.class | Bin 4918 -> 4757 bytes out/production/501-gitlab/GameStatus.class | Bin 2706 -> 2706 bytes out/production/501-gitlab/Location.class | Bin 1160 -> 1160 bytes out/production/501-gitlab/World.class | Bin 6086 -> 5864 bytes 12 files changed, 317 insertions(+), 30 deletions(-) create mode 100644 Assignment_1/refactored_code/assignment3GUI - Classmate's/src/scrap2.txt create mode 100644 Assignment_1/refactored_code/assignment3GUI - Classmate's/src/scrap3.txt diff --git a/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/FileInitialization.java b/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/FileInitialization.java index 45d672f..538d46d 100644 --- a/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/FileInitialization.java +++ b/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/FileInitialization.java @@ -6,7 +6,7 @@ import java.util.Scanner; /* Usage: - * Call the static read method to prompt the user for the file containing the + * Call the static read method to prompt the user for the file containing the positions. * The method will prompt for a filename and try to open that the file in the location where the Driver for your Java program is located. @@ -14,9 +14,9 @@ import java.util.Scanner; the file is not at the specified location, it is corrupted etc.). * The method returns a reference to a 2D array of references to objects of type Entity. - * The appearance attribute of the entity will correspond to the appearance of + * The appearance attribute of the entity will correspond to the appearance of characters in the file. - * Starting files must be exactly 10x10 characters in size and consist only of the + * Starting files must be exactly 10x10 characters in size and consist only of the 'O' character, an 'E' character or a space. Version Feb 16B, 2021 @@ -37,17 +37,17 @@ public class FileInitialization int row, column; // changed from r and c so its more readable char letter; // BufferedReader bufferReader = null; -// FileReader fileReader = null; +// FileReader fileReader = null; FileContainer aContainer; // changed to this as it's going to be null regardless try { aContainer = checkingFile(); BufferedReader bufferReader = aContainer.getBufferedReader(); //changed name from br - FileReader fileReader = aContainer.getFileReader(); // changed name from br so its more readable + FileReader fileReader = aContainer.getFileReader(); // changed name from br so its more readable line = bufferReader.readLine(); if (line == null) System.out.println("Empty file, nothing to read"); row = 0; - while (line != null) { + while (line != null) { column = 0; while(column < World.SIZE) { letter = line.charAt(column); @@ -65,12 +65,12 @@ public class FileInitialization System.out.println("Input file not in " + location); } catch (IOException e) { - System.out.println("General file input problem " + - "reading starting positions"); + System.out.println("General file input problem " + + "reading starting positions"); } return(temp); } - + private static FileContainer checkingFile() { FileContainer aContainer; // changed to this as it's going to be null regardless diff --git a/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/GamePanel.java b/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/GamePanel.java index 73314a0..9bf3831 100644 --- a/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/GamePanel.java +++ b/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/GamePanel.java @@ -15,7 +15,7 @@ import javax.swing.Timer; Version 3/4/2021: I got the graphical portion setup and functional still need to attach it logically to the World class and have sprites to represent elves/dwarves Version 3/5/2021: I got the sprites setup correctly, I'm having issues with having them behave correctly though the attack() method - in the World class needs some tweaking I'm pretty sure as it's a logical error that's occurring (orc isn't attacking + in the World class needs some tweaking I'm pretty sure as it's a logical error that's occurring (orc isn't attacking elf after it's told to stop moving when the space it's moving to is occupied) Version 3/9/2021: Finally fixed that weird bug that would cause issues when one entity dies, I did so by adding a sortDead method at this point the program runs without any bugs and meets the design specifications I just need to add Debug mode now @@ -30,7 +30,7 @@ public class GamePanel extends JPanel implements ActionListener{ int moveCount = 0; World world = new World(); Timer timer; - GamePanel() + GamePanel() { this.setPreferredSize(new Dimension(Width,Height)); this.setBackground(Color.blue); @@ -38,25 +38,25 @@ public class GamePanel extends JPanel implements ActionListener{ this.addKeyListener(new MyKeyAdapter()); startGame(); } - + public void startGame() { timer = new Timer(Delay,this); } - + public void paintComponent(Graphics graphics) { // changed g to graphics since I don't like single letter variables super.paintComponent(graphics); drawWorld(graphics); } - + public void drawWorld(Graphics graphics) { for (int row = 0; row<World.SIZE;row++) { //fixed static warning for (int column = 0; column<World.SIZE; column++) { if(world.aWorld[row][column] == null) { - graphics.setColor(Color.white); - graphics.fillRect(column*gridSize, row*gridSize, gridSize, gridSize); // removed unnecessary 0+ - graphics.setColor(Color.black); - graphics.drawRect(column*gridSize, row*gridSize, gridSize, gridSize); // removed unnecessary 0+ - } + graphics.setColor(Color.white); + graphics.fillRect(column*gridSize, row*gridSize, gridSize, gridSize); // removed unnecessary 0+ + graphics.setColor(Color.black); + graphics.drawRect(column*gridSize, row*gridSize, gridSize, gridSize); // removed unnecessary 0+ + } else if(world.aWorld[row][column].getAppearance() == 'E') { drawElf(graphics, column*gridSize, row*gridSize); } else if (world.aWorld[row][column].getAppearance() == 'O') { @@ -64,9 +64,9 @@ public class GamePanel extends JPanel implements ActionListener{ } } } - } + } public void drawOrc(Graphics graphics, int x, int y) { - + int[] xCoord = {x+6,x+19,x+elfSize/2+5}; int[] yCoord = {y+10,y+10,y}; Color orcGreen = new Color(21,158,26); @@ -84,31 +84,31 @@ public class GamePanel extends JPanel implements ActionListener{ graphics.drawPolygon(xCoord, yCoord, 3);//draws outline for hat graphics.fillOval(x+7,y+9,5,7);//draws left eye graphics.fillOval(x+13,y+9,5,7);//draws right eye - + graphics.drawLine((x+5)+(elfSize/3), y+elfSize+10, (x+5)+(elfSize/3), y+elfSize+13);//left foot line 1 graphics.drawLine((x+5)+(elfSize/3), y+elfSize+13, x+6, y+elfSize+13);//left foot line 2 graphics.drawLine((x+5)+elfSize-(elfSize/3), y+elfSize+10, (x+5)+elfSize-(elfSize/3), y+elfSize+13); graphics.drawLine((x+5)+elfSize-(elfSize/3), y+elfSize+13, (x+5)+elfSize-(elfSize/3)+5, y+elfSize+13); graphics.drawRect(x,y, gridSize, gridSize); graphics.drawString("HP: "+world.aWorld[y/gridSize][x/gridSize].getHitPoints(), x, y); - + } public void drawElf(Graphics graphics, int x, int y) { - + int[] xCoord = {x+5,x+20,x+elfSize/2+5}; int[] yCoord = {y+7,y+7,y}; graphics.setColor(Color.white); graphics.fillRect(x,y, gridSize, gridSize); graphics.setColor(Color.green); graphics.fillRect(x+5, y+7, elfSize, elfSize); - + graphics.fillPolygon(xCoord, yCoord, 3); graphics.setColor(Color.black); graphics.drawPolygon(xCoord, yCoord, 3); graphics.drawRect(x+5, y+7, elfSize, elfSize); graphics.fillOval(x+7,y+9,5,7); graphics.fillOval(x+13,y+9,5,7); - + graphics.drawLine((x+5)+(elfSize/3), y+elfSize+7, (x+5)+(elfSize/3), y+elfSize+13); graphics.drawLine((x+5)+(elfSize/3), y+elfSize+13, x+6, y+elfSize+13); graphics.drawLine((x+5)+elfSize-(elfSize/3), y+elfSize+7, (x+5)+elfSize-(elfSize/3), y+elfSize+13); @@ -120,7 +120,7 @@ public class GamePanel extends JPanel implements ActionListener{ public void actionPerformed(ActionEvent e) { world.turnSinceAtk++; for (int i = 0; i<Entity.getElfCounter()+Entity.getOrcCounter()+5; i++) {//the +5 stops the case where when multiple entities die the sortDead() breaks by running this more times than it should it finds all elves/orcs separated by a null - + if (!GameStatus.debugModeOn) { //switched, still checking if false world.move(i); } @@ -137,7 +137,7 @@ public class GamePanel extends JPanel implements ActionListener{ System.out.println("Cannot move null");//gives output for when the "buffer" +3 is being called in the debug } } - + if (moveCount >= Entity.getOrcCounter()+Entity.getElfCounter()+3) {//the +3 is there for the same reason the +5 is added to the for loop sortDead() sometimes leaves a null between entities and I cant figure out how to fix that so, I use this buffer moveCount = 0; } @@ -153,7 +153,7 @@ public class GamePanel extends JPanel implements ActionListener{ public void keyPressed(KeyEvent e) { switch(e.getKeyCode()) { case KeyEvent.VK_SPACE: - if(!world.programRunning) { // switched it, but it's still false + if(world.programRunning) { // switched it, but it's still true // fixed accidentally set to false timer.start(); } break; // else was unnecessary diff --git a/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/World.java b/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/World.java index 3f85540..962649c 100644 --- a/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/World.java +++ b/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/World.java @@ -163,7 +163,7 @@ public class World return; } } - System.out.println(attackingEntity.getClass().getSimpleName() + " wins, no more opponents left."); +// System.out.println(attackingEntity.getClass().getSimpleName() + " wins, no more opponents left."); // System.out.println(attackingEntity + "win no more orcs left."); programRunning = false; } diff --git a/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/scrap2.txt b/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/scrap2.txt new file mode 100644 index 0000000..8c98b2b --- /dev/null +++ b/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/scrap2.txt @@ -0,0 +1,114 @@ +import java.io.FileReader; +import java.io.BufferedReader; +import java.io.IOException; +import java.io.FileNotFoundException; +import java.util.Scanner; + +/* + Usage: + * Call the static read method to prompt the user for the file containing the + positions. + * The method will prompt for a filename and try to open that the file in the + location where the Driver for your Java program is located. + * The prompt will be repeated if there are problems accessing the file (e.g. + the file is not at the specified location, it is corrupted etc.). + * The method returns a reference to a 2D array of references to objects of type + Entity. + * The appearance attribute of the entity will correspond to the appearance of + characters in the file. + * Starting files must be exactly 10x10 characters in size and consist only of the + 'O' character, an 'E' character or a space. + + Version Feb 16B, 2021 + * Program repeats prompt for filename if file not found at location. + + Version Feb 16A, 2021 + * Program allows the user to specify the input file at runtime. + + Version: Feb 11A: + * Changed references of dwarves to elves. Constants related to the + * Entity attributes deleted. +*/ +public class FileInitialization +{ + public static Entity[][] read() { + Entity [][] temp = new Entity[World.SIZE][World.SIZE]; + String line; // changed to this as it's going to be null regardless + int row, column; // changed from r and c so its more readable + char letter; +// BufferedReader bufferReader = null; +// FileReader fileReader = null; + FileContainer aContainer; // changed to this as it's going to be null regardless + try { + aContainer = checkingFile(); + BufferedReader bufferReader = aContainer.getBufferedReader(); //changed name from br + FileReader fileReader = aContainer.getFileReader(); // changed name from br so its more readable + line = bufferReader.readLine(); + if (line == null) + System.out.println("Empty file, nothing to read"); + row = 0; + while (line != null) { + column = 0; + while(column < World.SIZE) { + letter = line.charAt(column); + temp[row][column] = createEntity(letter); + column = column + 1; + } + line = bufferReader.readLine(); + if (line != null) + row = row + 1; + } + fileReader.close(); + } + catch (FileNotFoundException e) { + String location = System.getProperty("user.dir"); + System.out.println("Input file not in " + location); + } + catch (IOException e) { + System.out.println("General file input problem " + + "reading starting positions"); + } + return(temp); + } + + private static FileContainer checkingFile() + { + FileContainer aContainer; // changed to this as it's going to be null regardless + Scanner in = new Scanner(System.in); + String filename; // changed to this as it's going to be null regardless +// boolean fileFound = false; + while (true) // changed to this as it's still if false + { + try + { + System.out.print("Name of file containing starting positions: "); + filename = in.nextLine(); + FileReader fileReader = new FileReader(filename); + BufferedReader bufferReader = new BufferedReader(fileReader); +// fileFound = true; + aContainer = new FileContainer(bufferReader, fileReader); + return aContainer; + } + catch (FileNotFoundException ex) + { + String location = System.getProperty("user.dir"); + System.out.println("Input file not in " + location); + } + + } +// aContainer = new FileContainer(); +// return(aContainer); + } + + private static Entity createEntity(char letter) { + return switch (letter) { + case 'O' -> new Orc(); + case 'E' -> new Elf(); + case Entity.EMPTY -> null; + default -> { + System.out.println("Error: Invalid character [" + letter + "] in file"); + yield null; // 'yield' is used to return a value from the block + } + }; + } +} \ No newline at end of file diff --git a/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/scrap3.txt b/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/scrap3.txt new file mode 100644 index 0000000..a3a6f91 --- /dev/null +++ b/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/scrap3.txt @@ -0,0 +1,173 @@ +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Graphics; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.KeyAdapter; +import java.awt.event.KeyEvent; +import javax.swing.JPanel; +import javax.swing.Timer; +// removed unused import + +//Author Ethan McCorquodale + +/* + Version 3/4/2021: I got the graphical portion setup and functional still need to attach it logically + to the World class and have sprites to represent elves/dwarves + Version 3/5/2021: I got the sprites setup correctly, I'm having issues with having them behave correctly though the attack() method + in the World class needs some tweaking I'm pretty sure as it's a logical error that's occurring (orc isn't attacking + elf after it's told to stop moving when the space it's moving to is occupied) + Version 3/9/2021: Finally fixed that weird bug that would cause issues when one entity dies, I did so by adding a sortDead method + at this point the program runs without any bugs and meets the design specifications I just need to add Debug mode now + */ +public class GamePanel extends JPanel implements ActionListener{ + // removed unused variables like system.in + static final int Height = 300; + static final int Width = 300; + static final int gridSize = 30; + static final int elfSize = 15; + final int Delay = 1; + int moveCount = 0; + World world = new World(); + Timer timer; + GamePanel() + { + this.setPreferredSize(new Dimension(Width,Height)); + this.setBackground(Color.blue); + this.setFocusable(true); + this.addKeyListener(new MyKeyAdapter()); + startGame(); + } + + public void startGame() { + timer = new Timer(Delay,this); + } + + public void paintComponent(Graphics graphics) { // changed g to graphics since I don't like single letter variables + super.paintComponent(graphics); + drawWorld(graphics); + } + + public void drawWorld(Graphics graphics) { + for (int row = 0; row<World.SIZE;row++) { //fixed static warning + for (int column = 0; column<World.SIZE; column++) { + if(world.aWorld[row][column] == null) { + graphics.setColor(Color.white); + graphics.fillRect(column*gridSize, row*gridSize, gridSize, gridSize); // removed unnecessary 0+ + graphics.setColor(Color.black); + graphics.drawRect(column*gridSize, row*gridSize, gridSize, gridSize); // removed unnecessary 0+ + } + else if(world.aWorld[row][column].getAppearance() == 'E') { + drawElf(graphics, column*gridSize, row*gridSize); + } else if (world.aWorld[row][column].getAppearance() == 'O') { + drawOrc(graphics,column*gridSize,row*gridSize); + } + } + } + } + public void drawOrc(Graphics graphics, int x, int y) { + + int[] xCoord = {x+6,x+19,x+elfSize/2+5}; + int[] yCoord = {y+10,y+10,y}; + Color orcGreen = new Color(21,158,26); + graphics.setColor(Color.white); + graphics.fillRect(x,y, gridSize, gridSize);//sets the background of that grid square white + graphics.setColor(orcGreen); + graphics.fillOval(x+5, y+7, elfSize, elfSize+3); + + graphics.setColor(Color.black); + graphics.drawOval(x+5, y+7, elfSize, elfSize+3); + graphics.setColor(orcGreen); + graphics.fillOval(x+13,y+9,5,7);//draws right eye + graphics.fillPolygon(xCoord, yCoord, 3);//fills in hat + graphics.setColor(Color.black); + graphics.drawPolygon(xCoord, yCoord, 3);//draws outline for hat + graphics.fillOval(x+7,y+9,5,7);//draws left eye + graphics.fillOval(x+13,y+9,5,7);//draws right eye + + graphics.drawLine((x+5)+(elfSize/3), y+elfSize+10, (x+5)+(elfSize/3), y+elfSize+13);//left foot line 1 + graphics.drawLine((x+5)+(elfSize/3), y+elfSize+13, x+6, y+elfSize+13);//left foot line 2 + graphics.drawLine((x+5)+elfSize-(elfSize/3), y+elfSize+10, (x+5)+elfSize-(elfSize/3), y+elfSize+13); + graphics.drawLine((x+5)+elfSize-(elfSize/3), y+elfSize+13, (x+5)+elfSize-(elfSize/3)+5, y+elfSize+13); + graphics.drawRect(x,y, gridSize, gridSize); + graphics.drawString("HP: "+world.aWorld[y/gridSize][x/gridSize].getHitPoints(), x, y); + + } + public void drawElf(Graphics graphics, int x, int y) { + + int[] xCoord = {x+5,x+20,x+elfSize/2+5}; + int[] yCoord = {y+7,y+7,y}; + graphics.setColor(Color.white); + graphics.fillRect(x,y, gridSize, gridSize); + graphics.setColor(Color.green); + graphics.fillRect(x+5, y+7, elfSize, elfSize); + + graphics.fillPolygon(xCoord, yCoord, 3); + graphics.setColor(Color.black); + graphics.drawPolygon(xCoord, yCoord, 3); + graphics.drawRect(x+5, y+7, elfSize, elfSize); + graphics.fillOval(x+7,y+9,5,7); + graphics.fillOval(x+13,y+9,5,7); + + graphics.drawLine((x+5)+(elfSize/3), y+elfSize+7, (x+5)+(elfSize/3), y+elfSize+13); + graphics.drawLine((x+5)+(elfSize/3), y+elfSize+13, x+6, y+elfSize+13); + graphics.drawLine((x+5)+elfSize-(elfSize/3), y+elfSize+7, (x+5)+elfSize-(elfSize/3), y+elfSize+13); + graphics.drawLine((x+5)+elfSize-(elfSize/3), y+elfSize+13, (x+5)+elfSize-(elfSize/3)+5, y+elfSize+13); + graphics.drawRect(x,y, gridSize, gridSize); + graphics.drawString("HP: "+world.aWorld[y/gridSize][x/gridSize].getHitPoints(), x, y); + } + @Override + public void actionPerformed(ActionEvent e) { + world.turnSinceAtk++; + for (int i = 0; i<Entity.getElfCounter()+Entity.getOrcCounter()+5; i++) {//the +5 stops the case where when multiple entities die the sortDead() breaks by running this more times than it should it finds all elves/orcs separated by a null + + if (!GameStatus.debugModeOn) { //switched, still checking if false + world.move(i); + } + } + if (GameStatus.debugModeOn) { + world.move(moveCount); + repaint(); + timer.stop(); + } + if(GameStatus.debugModeOn) { + moveCount++; + world.turnSinceAtk = 0;//if this doesn't happen cease fire will be met with each entity only moving one at a time + if(world.location[moveCount]== null) { + System.out.println("Cannot move null");//gives output for when the "buffer" +3 is being called in the debug + } + } + + if (moveCount >= Entity.getOrcCounter()+Entity.getElfCounter()+3) {//the +3 is there for the same reason the +5 is added to the for loop sortDead() sometimes leaves a null between entities and I cant figure out how to fix that so, I use this buffer + moveCount = 0; + } + repaint(); + timer.stop(); + if (world.turnSinceAtk >= 10 ) { + world.programRunning = false; + System.out.println("Cease Fire, Game over."); + } + } + // de-nest + public class MyKeyAdapter extends KeyAdapter{ + public void keyPressed(KeyEvent e) { + switch(e.getKeyCode()) { + case KeyEvent.VK_SPACE: + if(!world.programRunning) { // switched it, but it's still false + timer.start(); + } + break; // else was unnecessary + + case KeyEvent.VK_D: + if(GameStatus.debugModeOn) { + System.out.println("Debug mode left"); + GameStatus.debugModeOn = false; + break; + } + System.out.println("Debug mode entered"); + GameStatus.debugModeOn = true; + break; + } + } + } +} \ No newline at end of file diff --git a/out/production/501-gitlab/FileContainer.class b/out/production/501-gitlab/FileContainer.class index 2ecbbcf4ff40baf66ca4ce50e0e643693e3c1f2d..f096f1d884e892b9940c712a078c0cb2ea8bbb60 100644 GIT binary patch delta 67 zcmdnNdWv;IgaA)cX<AxpQBZ1PN@@`!gT%xI5@MVT91MIs4EziNj0{|9nK`Lo*^Mn0 UjGRIY+zdPn3=Be(k1~D+0Ap4VssI20 delta 41 xcmX@bx`TB>1RGOQ5hH`d<OD{Ei48nVOlcdZSuk=kF>o{RFfcGMO}@_f835h>3I6~9 diff --git a/out/production/501-gitlab/FileInitialization.class b/out/production/501-gitlab/FileInitialization.class index aaa74418769d8759d4821f12de9e6278641c6083..c6fd566047463a563e880b13bbfa3db622aecb24 100644 GIT binary patch delta 62 zcmcaA@lIlc6RRX!a(+%}ZXP28qbDN+Pf}@GT53^HYGO+2WFJ;JF0Qo9oKy%mht-UQ NxhTJU^AgsLYye<p6OI4? delta 37 tcmaDSaaCf26Dt>EG9v?{CnEz>(&T7XIVPsG$<3^0OpHaF_p)we0|2uP33dPg diff --git a/out/production/501-gitlab/GamePanel$MyKeyAdapter.class b/out/production/501-gitlab/GamePanel$MyKeyAdapter.class index 1385e25362c535dd0485d8e609a6625088f3a994..bb20d92574b91717d122dcad35daa9f1c30c10a3 100644 GIT binary patch delta 67 zcmV-J0KEUL38@LNkplsklad280l<^T18plR015yA0Ga?G0Gt3V0G$9j0HOdu0HXj% Z0Hgp+0Hpv=0H**~0H^?40IQQ@1WI)X5r+T( delta 71 zcmV-N0J#6D39SjRkplsmlad280mPHX18pxZ01E&B0Gt3I0G<FX0G|Li0H6Rm0Hy#y d0H***0H^>=0I2{^0IL930IUF80I!o@1WLWi5{m!; diff --git a/out/production/501-gitlab/GamePanel.class b/out/production/501-gitlab/GamePanel.class index 637f3524b16db275aeabfab526b1e6ab8d0fb2a5..65bf4166eb8b0acaca67ba68cc5af466dc60156c 100644 GIT binary patch literal 4757 zcmcgvd0ZUj8Gb%km}N7-h9pMJlAwu^EGZ~zREUX@gn*KO5Qzk18I}Pi%+9Q{vk;=z zEAgncv0n9#+9SQKX|klo+Pk*)zVFN4_U>Q(wf@>Z-^}cRq5bvOKN_+-^L^j@zTbO1 z@AG~8(m$Si0YE$c5<v+{6@*ljp<JM5k2a<4ZB9=c)_C(}y_%()0_E!s%WyXcls2px zs6ZGM3L+{NKozLiswMS6u57bzYBK_&OA1w~sP-h1_LSakXDnC2LV>cKwquS)5Jjn! zTC8FTPT};loEA{Jz4bN)rv~0MYtwG?W+SOvX~VW6Sc=o6v&*Q{(ABkOAVMp3Dwbn~ zKs2qpy^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Vco# z_YtsM)cXi%6pMWX2>gr)bI&)ii}WK|{E&qBz(MQ_#HO*2#C!-39Kt(UVGm*H6dt*U zM*t-vS-j8X!sj`5H>%|rpK=cKKzowS?kwK#&aI77UAa_OE~R*C?vvkx$jSwz^#xOS zs_L06J}mp(i#x_jV-F(eov^d&yk+~sp$FZ~q^eKKwV&o%S$iHO?{rV|OG(L>vHmW{ zv8=Kv+b7{F67SU{;k_i^Ygmofvih#W`M92Wxq)%M5trg7zHjFLTUe8~l9+Gf$$vYZ zz#W+3?<!e$wcMwYNAfRxqCS+1KYxDw5-%{GlBg>rQCEs(Was7U7O!UI{feVS_%(jR iZ-7!Q_$^yOw*J89claB7Rg`Gq*oz$bJ6^^=Q2j4$l8@~G diff --git a/out/production/501-gitlab/GameStatus.class b/out/production/501-gitlab/GameStatus.class index d0ed66137910af5a8c21712eb155d800781f2f7f..6c8bb193a70f1fe646252dce86ab10c622fdceaf 100644 GIT binary patch delta 51 zcmbOvI!Sax8waE0<aUl`UTFpn1{nrX23ZDW2KmY2oH?wD3_J`<lRG&5SXF>5)ycOx Gw*vqZg9>>7 delta 51 zcmbOvI!Sax8waEG<aUl`UReeX1~~>%26+Z$2F1zZoH?w@3_J`flRG&5Sk-_m^~tw6 Gw*vqbF$#+S diff --git a/out/production/501-gitlab/Location.class b/out/production/501-gitlab/Location.class index 802582b623ee6e0f7bbbf0e97423d36954b100e3..dcd0b492f37745e08e7c54f768482e9b63f87229 100644 GIT binary patch delta 95 zcmeC+?BLwc!o(;z`9G8B<XKGWjG|!Hbs$Ru$g*XXW?*HIne52y&MF6F$pcy9lb0~- fGb)1By=2y4RRxNxfyH%M3|KXRJS{M<l7$}twX_zt delta 95 zcmeC+?BLwc!o(;v`9G8B<XKGWjN)L{bs$R$$g*XXWng8Ho9xK!&Z+=pDFRvIlb0~- fGb)4Cy=2y4RR@Y|fW>uL3|Mu5JY6ual7$}txyu&M diff --git a/out/production/501-gitlab/World.class b/out/production/501-gitlab/World.class index 49b7ee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}KrU(L|20l6BDpmK&S!6}~3? zIm(n^b}pcXIY~n_q2xm9!-ROhQkgFhvvvLmQWN~$2LB-?hxlidS<2p@wsw7zzYSaQ zjm}`j1isZfplKxPEI5X9I+oyfAmu8ojAgs$@yHdVkPNz!`aqh}FA?w>$C{N%;GHD! zJDev$#|;bAV0@Iq`aTZK4?0{V?WE%fAw0RH=5~Q_8`S_KM)rt~B@SamuQL(*UR)pq zGnQcxKagd?2B`RvtQ5@gf{dkvT9wgCsJk;N^?{3n0-6leCIhu8fhyXx!s5!4v#GCV z@to+6VmtN00;~A4%)H)V_->5hr5N^(VHAjAb-8&IIYX3a#tf|`u+usS8+Or4xEtws z8ZJD8T<k#}fmYxJRN_S>&y0W#QL7T7gcJ)*>1iZ^-txE*wuu<{uFOI9CSRRZK)r3r zTHBkPxesCe;+U}%kLj1mL?FWk^l)<K6m>#MT|g>Zz;aevw49DJexg6cPn0q)3wnC? zmFLFr)&ML+<s)$9`i>e_3<sYehZi}E*<pT%vo!DUFa`#Y5l<Y4BubAa=E5I!R##r{ zxX+N)w@8)*tKF^?mu6AF^z{*4^Lb}s$|ONf@j{n##fQ(s7srp`t|c3uLJ@gx`ZrRf zPm+w9E7yCSvDsj3Uc^XE`YMQrK7~5lK384yWVv9-^TnWzVk&M6hWxED>@eIZ;XXia zNqkSpqF6GZyS~Q%xU4ZL?cVItw&b}1{f4xD{7kQ-xas|gJ1MMR^qVfO1if|h;B*Tv fl4HUp{7TPsvi_u^-}Ln|u2M`U{~CQ#P00Bd(|D=- -- GitLab From ca51d899d5ff4c0032a4fa606da18c802a154c81 Mon Sep 17 00:00:00 2001 From: Devon Harstrom <devonharstrom@gmail.com> Date: Mon, 17 Feb 2025 15:46:59 -0700 Subject: [PATCH 11/17] added comments explain world code as many things happen in it and needed some explanation --- .../src/World.java | 136 ++++++++++-------- 1 file changed, 75 insertions(+), 61 deletions(-) diff --git a/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/World.java b/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/World.java index 962649c..4763cc7 100644 --- a/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/World.java +++ b/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/World.java @@ -2,17 +2,16 @@ public class World { - // //removed unused variables such as all final states and tempChat = ' ' which can just be local - public static final int SIZE = 10; + public static final int SIZE = 10; //size of world private int locationIndex = 0; //creates a local index for the location array in the Display method. // changed from i since that's not a great name Location[] location = new Location[100];//an array that'll track each entities type,location coordinates and if it can move. - int tempRow = 0; + int tempRow = 0; // temp row and colum for switching and swapping things in the world int tempColumn = 0; - int oldRow; + int oldRow; // old row and colum for switching and swapping things in the world int oldCol; - int turnSinceAtk; - public Entity [][] aWorld; - public boolean programRunning = true; + int turnSinceAtk; // to help with deciding if a cease fire occurred resets every attack + public Entity [][] aWorld; // world of entities Elf, Orcs or null + public boolean programRunning = true; //programming running GameStatus status = new GameStatus(); // Post-condition: the position of the characters in the @@ -21,13 +20,15 @@ public class World // determines the appearance of the Entity(O or D) or if the // element is empty (spaces become null elements) + // constructor initialize the grid and the entities location public World() { - aWorld = new Entity[SIZE][SIZE]; // this is null anyway - aWorld = FileInitialization.read(); + aWorld = new Entity[SIZE][SIZE]; // world of the size 10 + aWorld = FileInitialization.read(); // get info from the provided txt file initializeGrid(); } + // print borders and initialize locations public void initializeGrid(){ for (int row = 0; row < SIZE; row++){ // changed all instances of r and c so its more readable System.out.println("\n - "+"- "+"- "+"- "+"- "+"- "+"- "+"- "+"- "+ "- "); // removed unnecessary print @@ -40,31 +41,34 @@ public class World sortLocations(); } + // place the Orcs, Elves or nulls entities in the world public void initializeLocations(int row, int column){ if (aWorld[row][column] == null) { System.out.print("| "); - return; + return; // no entity so move on } char currentCellAppearance = aWorld[row][column].getAppearance(); System.out.print("|"+currentCellAppearance); location[locationIndex] = new Location(row,column,currentCellAppearance);//Initializes each Entities location/type if (location[locationIndex].getType() == 'O') {//this checks the type and counts +1 if it's an orc - Entity.incrementOrcCounter(1); + Entity.incrementOrcCounter(1); // increase the count of orcs } if (location[locationIndex].getType() == 'E') { - Entity.incrementElfCounter(1); + Entity.incrementElfCounter(1); // same with elves } locationIndex++;//Cause each initialization of the location[locationIndex] to go to the next element } - public void sortDead() {//supposed to try and sort null elements and bring them to the end doesn't always work as intended + //supposed to try and sort null elements and bring them to the end doesn't always work as intended + public void sortDead() { for (int locationIndex = 0; locationIndex<=Entity.getElfCounter()+Entity.getOrcCounter();locationIndex++) { if (location[locationIndex] == null) { - continue; + continue; // its null then move on } if((aWorld[location[locationIndex].getRow()][location[locationIndex].getColumn()] != null)||(location[locationIndex+1] == null)) { - continue; + continue; // if the element in the world isn't null then move on or next index in location is null } + // swap the values in the array location[locationIndex] = location[locationIndex+1]; location[locationIndex+1] = null; if(locationIndex-2 >= 0 && location[locationIndex-2]== null) { @@ -73,15 +77,20 @@ public class World } } - public void sortLocations() {//puts the elfs in the beginning of the array, checks if there is an orc before and elf and if there is it swaps positions in the array + //puts the elfs in the beginning of the array, + // checks if there is an orc before and elf and if there is it swaps positions in the array + // basically moves all the entities (orc or elves) to the front of the array since we don't care about null entities + public void sortLocations() { int orcCounter = Entity.getOrcCounter(); for (int j = 0; j<Entity.getElfCounter()+orcCounter; j++) { if (location[j+orcCounter] == null){ - continue; + continue; // if its null then move on } if(((location[j].getType() != 'O')||(location[j+orcCounter].getType() != 'E'))) { - continue; + continue; // if it's not an elf or orc move on } + // get row, columns and entity type (char of O or E) + // and set the new values tempRow = location[j+orcCounter].getRow(); tempColumn = location[j+orcCounter].getColumn(); char tempType = location[j+orcCounter].getType(); @@ -93,40 +102,42 @@ public class World location[j].setType(tempType); } } + // handles attacking public void attack(int index) {// new if(aWorld[tempRow][tempColumn] == null){ - return; + return; // if null move on } if((location[index].getType() == 'O') && (aWorld[tempRow][tempColumn].getAppearance() == 'O')) { - return; + return; // if attacking their own kind move on (won't attack) } if((location[index].getType() == 'E') && (aWorld[tempRow][tempColumn].getAppearance() == 'E')) { - return; + return; // if attacking their own kind move on (won't attack) } - turnSinceAtk = 0; + turnSinceAtk = 0; // reset since we are now attacking if((location[index].getType() == 'E')&&(aWorld[location[index].getRow()][location[index].getColumn()] != null)) { - Entity attackingEntity = new Elf(); // Assuming Elf is a subclass of Entity - attackLogic(attackingEntity, index); + Entity attackingEntity = new Elf(); //initialize elf which is a subclass of entity and call attack logic + attackLogic(attackingEntity, index); // with elf as the attacking entity } else if((location[index].getType() == 'O')&&(aWorld[location[index].getRow()][location[index].getColumn()] != null)) { - Entity attackingEntity = new Orc(); + Entity attackingEntity = new Orc(); // exact same idea just with orc attackLogic(attackingEntity, index); } else { - location[index].setCanMove(true); + location[index].setCanMove(true); // they can move if they aren't attacking } } + // logic for attacking gets health and subtracts the attacking entities damage and sets the new health public void attackLogic(Entity attackingEntity, int index){ int entityDmg = attackingEntity.getDamage(); int HP = aWorld[tempRow][tempColumn].getHitPoints(); aWorld[tempRow][tempColumn].setHitPoints(aWorld[tempRow][tempColumn].getHitPoints()-entityDmg); int HPAfter = aWorld[tempRow][tempColumn].getHitPoints(); - if (GameStatus.debugModeOn) {//attack data for elf attackers + if (GameStatus.debugModeOn) {//debug attack data for elf attackers, apart of elf subclass attackingEntity.debugAttack(status, tempRow, tempColumn, location[index].getRow(), location[index].getColumn(),HP,HPAfter); } - deathLogic(attackingEntity, index); - victoryLogic(attackingEntity); - if(GameStatus.debugModeOn) {//lose condition data + deathLogic(attackingEntity, index); // check if attacker killed enemy + victoryLogic(attackingEntity); // check if no enemy remains + if(GameStatus.debugModeOn) {//debug lose condition data, part of subclasses if (attackingEntity instanceof Elf) { attackingEntity.debugLossConditions(status, Entity.getOrcCounter()); } else if (attackingEntity instanceof Orc) { @@ -135,14 +146,15 @@ public class World } } + // if the enemy lost all its health it is killed and the count of that entity goes down public void deathLogic(Entity attackingEntity, int index){ if (aWorld[tempRow][tempColumn].getHitPoints() >0){ - return; + return; // if they are still alive then move on this doesn't apply } aWorld[tempRow][tempColumn] = null; if (attackingEntity instanceof Elf) { - Entity.incrementOrcCounter(-1); + Entity.incrementOrcCounter(-1); // increment by a negative value } else if (attackingEntity instanceof Orc) { Entity.incrementElfCounter(-1); } @@ -152,64 +164,64 @@ public class World } } + // if there is no more enemies than the attackers have won so print out who won and end the game public void victoryLogic(Entity attackingEntity){ - if (attackingEntity instanceof Elf) { - if (Entity.getOrcCounter() > 0) { - return; - } + if (attackingEntity instanceof Elf && Entity.getOrcCounter() > 0) { + return; // if there still exists orcs and elves are attacking then no victory } - else if (attackingEntity instanceof Orc) { - if (Entity.getElfCounter() > 0) { - return; - } + else if (attackingEntity instanceof Orc && Entity.getElfCounter() > 0) { + return; // same exact thing but opposite } -// System.out.println(attackingEntity.getClass().getSimpleName() + " wins, no more opponents left."); -// System.out.println(attackingEntity + "win no more orcs left."); - programRunning = false; + // get the name of the attacking entity since they won + System.out.println(attackingEntity.getClass().getSimpleName() + " wins, no more opponents left."); + programRunning = false; //end game } + // check perimeter of the index public boolean checkPerimeter(int index) {//looks at all the spaces around the current index of location[index] looking for things not null if (location[index] == null){ - return false; + return false; // if null move on } for(int row = location[index].getRow()-1; row<location[index].getRow()+2;row++) { for(int column = location[index].getColumn()-1; column<location[index].getColumn()+2;column++ ) { if((row > 9)||(column > 9)||(row <= - 1)||(column <= -1)){ //ensuring row/column is in aWorld - continue; + continue; // if outside world then move on } if((aWorld[row][column] == null) || (location[index].getType() == aWorld[row][column].getAppearance())) { - continue; + continue; // if null move on or if they are next to their kind then move on } + // if we are here then their is an enemy so stop and prepare to attack location[index].setCanMove(false); - tempRow = row; + tempRow = row; // set temp row and column tempColumn = column; - attack(index); - return true; + attack(index); // attack with the current index as the attacking entity + return true; // return true there is an enemy } } - location[index].setCanMove(true); - return false; + location[index].setCanMove(true); // no enemy so can move + return false; // no enemy } - // these methods could be broken up into smaller ones - public void move(int index) {//changes the value of aWorld[][] must set old position to null then update it to the new position. - if (checkPerimeter(index)){ // changed syntax of if statement still needs to be true - return; + // move the current entity + //changes the value of aWorld[][] must set old position to null then update it to the new position. + public void move(int index) { + if (checkPerimeter(index)){ + return; // check the around current index if there is an enemy dont move } if (location[index] == null) { - return; + return; // move on if it's not an entity at index } - if (!location[index].getCanMove()){ // changed syntax of if statement still needs to be false - return; + if (!location[index].getCanMove()){ + return; // if it already can't move, move on } if((location[index].getRow()-1 != -1)&&(location[index].getColumn()-1 != -1)) { - moveLogic('E', index, -1); + moveLogic('E', index, -1); // logic behind moving } if((location[index].getRow()+1 != 10)&&(location[index].getColumn()+1 != 10)) { moveLogic('O', index, 1); } - if ((GameStatus.debugModeOn)&&(location[index] != null)) { // changed syntax of if statement still needs to be true - debugMovement(index); + if ((GameStatus.debugModeOn)&&(location[index] != null)) { + debugMovement(index); // debug the move } } @@ -221,6 +233,8 @@ public class World } } + // increment the rows and columns setting the entity at the new location and removing the old one + // orcs move down and elves move up, so -1 for elves and +1 for orcs (for increment) public void moveLogic(char entityType, int index, int increment){ if ((location[index].getType() == entityType)&&(aWorld[location[index].getRow()+ increment][location[index].getColumn()+increment]== null)) { oldRow = location[index].getRow(); -- GitLab From 2f79f59ff4852b4dec916b7a30842e506495b49e Mon Sep 17 00:00:00 2001 From: Devon Harstrom <devonharstrom@gmail.com> Date: Mon, 17 Feb 2025 15:59:29 -0700 Subject: [PATCH 12/17] added comments to other classes specifically Entity, Orc and Elf to explain the subclass structure --- .../assignment3GUI - Classmate's/src/Elf.java | 9 ++++--- .../src/Entity.java | 24 ++++++------------ .../src/FileInitialization.java | 9 +++---- .../src/GamePanel.java | 5 ++-- .../src/Location.java | 3 +++ .../assignment3GUI - Classmate's/src/Orc.java | 10 ++++---- out/production/501-gitlab/Elf.class | Bin 860 -> 860 bytes out/production/501-gitlab/Entity.class | Bin 1639 -> 1639 bytes out/production/501-gitlab/Orc.class | Bin 859 -> 859 bytes out/production/501-gitlab/World.class | Bin 5864 -> 6085 bytes 10 files changed, 27 insertions(+), 33 deletions(-) diff --git a/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/Elf.java b/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/Elf.java index 8647719..8474b4c 100644 --- a/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/Elf.java +++ b/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/Elf.java @@ -1,13 +1,14 @@ - public class Elf extends Entity { - public static final char ELF = 'E'; - public static final int ELF_DAMAGE = 7; - public static final int ELF_HP = 15; + public static final char ELF = 'E'; // Elves are represented as an E on the grid + public static final int ELF_DAMAGE = 7; // damage + public static final int ELF_HP = 15; // health of each elf + // elf is a subclass of entity passing in appearance, health and damage public Elf() { super(ELF, ELF_HP, ELF_DAMAGE); } + // both are the debug statements for attack and loss conditions @Override public void debugAttack(GameStatus status, int tempRow, int tempColumn, int targetRow, int targetColumn, int HP, int HPAfter) { status.elfAttackDebug(tempRow, tempColumn, targetRow, targetColumn, HP, HPAfter); diff --git a/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/Entity.java b/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/Entity.java index aa1e351..56df1ae 100644 --- a/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/Entity.java +++ b/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/Entity.java @@ -1,69 +1,61 @@ public abstract class Entity { //removed unused - public static final char EMPTY = ' '; + public static final char EMPTY = ' '; // this is for null + private char appearance; // appearance is O or E + private int hitPoints; //health + private final int damage; // damage - private char appearance; - private int hitPoints; - private final int damage; // added final as damage never changes - - private static int orcCounter = 0; + private static int orcCounter = 0; // start at 0 private static int elfCounter = 0; + // subclasses are appearance, health, damage public Entity(char appearance, int hitPoints, int damage) { this.appearance = appearance; this.hitPoints = hitPoints; this.damage = damage; } + //debug for each subclass public abstract void debugAttack(GameStatus status, int tempRow, int tempColumn, int targetRow, int targetColumn, int HP, int HPAfter); public abstract void debugLossConditions(GameStatus status, int entityCounter); + // getter, setter methods, add some more public char getAppearance() { return(appearance); } - public int getHitPoints() { return(hitPoints); } - public void setAppearance(char newAppearance) { appearance = newAppearance; } - public void setHitPoints(int newHitPoints) { hitPoints = newHitPoints; } - public int getDamage() { return(damage); } - public static int getElfCounter() { return elfCounter; } - public static int getOrcCounter() { return orcCounter; } - public static void incrementElfCounter(int value) { elfCounter = elfCounter + value; } - public static void incrementOrcCounter(int value) { orcCounter = orcCounter + value; } - public static void setElfCounter(int newElfCounter){ elfCounter = newElfCounter; } - public static void setOrcCounter(int newOrcCounter){ orcCounter = newOrcCounter; } diff --git a/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/FileInitialization.java b/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/FileInitialization.java index 538d46d..b43ef71 100644 --- a/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/FileInitialization.java +++ b/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/FileInitialization.java @@ -29,6 +29,9 @@ import java.util.Scanner; * Changed references of dwarves to elves. Constants related to the * Entity attributes deleted. */ + +// this file takes in the txt file and initializes the world which is called in the world class +// this is where we get the values public class FileInitialization { public static Entity[][] read() { @@ -36,8 +39,6 @@ public class FileInitialization String line; // changed to this as it's going to be null regardless int row, column; // changed from r and c so its more readable char letter; -// BufferedReader bufferReader = null; -// FileReader fileReader = null; FileContainer aContainer; // changed to this as it's going to be null regardless try { aContainer = checkingFile(); @@ -76,7 +77,6 @@ public class FileInitialization FileContainer aContainer; // changed to this as it's going to be null regardless Scanner in = new Scanner(System.in); String filename; // changed to this as it's going to be null regardless -// boolean fileFound = false; while (true) // changed to this as it's still if false { try @@ -85,7 +85,6 @@ public class FileInitialization filename = in.nextLine(); FileReader fileReader = new FileReader(filename); BufferedReader bufferReader = new BufferedReader(fileReader); -// fileFound = true; aContainer = new FileContainer(bufferReader, fileReader); return aContainer; } @@ -96,8 +95,6 @@ public class FileInitialization } } -// aContainer = new FileContainer(); -// return(aContainer); } private static Entity createEntity(char letter) { diff --git a/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/GamePanel.java b/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/GamePanel.java index 9bf3831..c1b141c 100644 --- a/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/GamePanel.java +++ b/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/GamePanel.java @@ -20,8 +20,9 @@ import javax.swing.Timer; Version 3/9/2021: Finally fixed that weird bug that would cause issues when one entity dies, I did so by adding a sortDead method at this point the program runs without any bugs and meets the design specifications I just need to add Debug mode now */ + +// this file draws the game in the GUI and handles the "space key interaction" public class GamePanel extends JPanel implements ActionListener{ - // removed unused variables like system.in static final int Height = 300; static final int Width = 300; static final int gridSize = 30; @@ -148,7 +149,7 @@ public class GamePanel extends JPanel implements ActionListener{ System.out.println("Cease Fire, Game over."); } } - // de-nest + public class MyKeyAdapter extends KeyAdapter{ public void keyPressed(KeyEvent e) { switch(e.getKeyCode()) { diff --git a/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/Location.java b/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/Location.java index c79f863..44371f3 100644 --- a/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/Location.java +++ b/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/Location.java @@ -1,4 +1,6 @@ //Author Ethan McCorquodale + +// all information for location such as row column and entity type public class Location { private int row; @@ -12,6 +14,7 @@ public class Location entityType = type; } + // getter setter methods for all the variables public int getColumn() { return(column); diff --git a/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/Orc.java b/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/Orc.java index 2984c89..c2d9120 100644 --- a/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/Orc.java +++ b/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/Orc.java @@ -1,14 +1,14 @@ - - public class Orc extends Entity { - public static final char ORC = 'O'; - public static final int ORC_DAMAGE = 3; - public static final int ORC_HP = 10; + public static final char ORC = 'O'; // orc are represented as an O on the grid + public static final int ORC_DAMAGE = 3; // damage + public static final int ORC_HP = 10; // health for each + // is a subclass of entity passing in appearance, health, and damage public Orc() { super(ORC, ORC_HP, ORC_DAMAGE); } + // both are the debug statements for attack and loss conditions @Override public void debugAttack(GameStatus status, int tempRow, int tempColumn, int targetRow, int targetColumn, int HP, int HPAfter) { status.orcAttackDebug(tempRow, tempColumn, targetRow, targetColumn, HP, HPAfter); diff --git a/out/production/501-gitlab/Elf.class b/out/production/501-gitlab/Elf.class index a86f871f5e71e57a6a183189c5f70b06aa23017a..9378f07d5e92dff96ac8ec456cb992b0f7b5f83d 100644 GIT binary patch delta 27 jcmcb^c86`ld?r>t20jM<$xE1;S%n!`8AK-QFdF~>X;}s( delta 27 jcmcb^c86`ld?r?220jM9$xE1;S%nx_8H6Y6FdF~>X(<LF diff --git a/out/production/501-gitlab/Entity.class b/out/production/501-gitlab/Entity.class index 42856365d5f59a4b42527ffacc08c880effed152..c6fa73c25e6473c62d60c4c222b61ee509c4e68f 100644 GIT binary patch delta 143 zcmaFP^PFdc7PBA^0}BH$11AF?5b`q!GYCw!X3k<1pS+COhEZnnV`f`cMFv&|rOAaX z;*)Jy3|Q5GJar(?jZu5@4i;-h{mEZgG#QO2%dzUQnlo@PSWFINbzrpyvTT4X(aEb> m)miO<b~sGF&T7Nz3}m@XmSA(>=LE927#JCB7#J9s7;FKvbQzQY delta 143 zcmaFP^PFdc7PBBP0}BHm11AGNkQ87LW)Pfg&78$3F?kuY4WsPj$IP~@N(`(F%99IO z#3$RZ7_h1Xc^W{T8>7zT9W2(229v+AXfm2imSfdpwP4_2u$&yo>cDCPWZ42)qLWv% ns<S!(?QooYoz;fb1;}!pEWzf$&jn<0GcYpPFfcGMG1vkCx@sA$ diff --git a/out/production/501-gitlab/Orc.class b/out/production/501-gitlab/Orc.class index 3ded1a310dffbbd838082e1f5c38e04f123b0a2e..272d01a1808996a462f5b0c5cdc6f42630786dea 100644 GIT binary patch delta 18 Zcmcc3cAITOFcT{W11AIL<_IQcMgTF$1NZ;{ delta 18 Zcmcc3cAITOFcT{$11AI5<_IQcMgTF`1Nr~} diff --git a/out/production/501-gitlab/World.class b/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j0UPPxL*S`9b*V;HG}#XskjC+ z@Hj(N&G4*66>9Jlp2S9uo3RcmYOw?Bu^SuEMm++|ESd*<f|KrICSZvYXxAX<sJRJW z5saStU&Ys)`OtzDr(-zv)tDqhe-%}dBqfIM>P{!by3i#>-XeUCG~SG{*up~DiZpB^ znd?Yil>~Z$<a&`LdWrOG&`^n@0ex_z%JZPgbD=t=_J)Slj8Ljtqa6^R){AuwkjbM) zgtl<CNn2SP;nR|;??6NgrS+r)Wf@e^8$Y~8iZ?QbJBV#3Tfr{2g550bw=^7r(n8ve zBi@BWl#dT|%9ud<%igM`q#|sW^tKve8h;IY_psyaWkob$BIRaNvH-2*X**$eFg^RQ zi9L4<_A?M&WX%D*Lb>gfe}f!uW?OYL#zIDk9-?OldtR$-0j<>ot<}pIwaF9_KI&vI zW&RLQ`K?Wjbl@Fz)MS=g)jv%sl0%Ifn^fayMMDEZQri&}X&HdOkm~Y=YAOQ+9A?1! z=*s|^Kgh0h6yq_(t~5dd9b+#zfhFvhmBh7{j9AAi6S$q>tMy>4^<osPHX4=0r0g&T zkN*`BLSAVm9|hPFCmsiig6D2W5?8T&yZIh;pOkwh4jfhk&EYHl_ju6jkC~hWD}4-8 zX(82bBc@`~+KacugSX@wyo{k`GC}eWsbzbsIjg2SRX~WcIAH5=;)=3xr#pI)1J%wW zjt9kZ4JQ+wXF`N~?hS2e$^Fk#%Jl+va`g<`|2M3cZyD^ftc>s2fXdIYn9q|r7d<Qi z>OJV|afW#irChK1A;MZuC4xhO!0f~S@Uosd#jo@%b&8*YgbRGn;U}(S&VI&a{Dz2s E0YHkykpKVy -- GitLab From 098aa627933812856176f48d89a675a0828edbff Mon Sep 17 00:00:00 2001 From: Devon Harstrom <devonharstrom@gmail.com> Date: Mon, 17 Feb 2025 16:13:48 -0700 Subject: [PATCH 13/17] this was for refactor 3 that i forgot but added move debug to the subclasses --- .../assignment3GUI - Classmate's/src/Elf.java | 5 +++++ .../assignment3GUI - Classmate's/src/Entity.java | 2 ++ .../assignment3GUI - Classmate's/src/Orc.java | 5 +++++ .../assignment3GUI - Classmate's/src/World.java | 16 +++++++--------- 4 files changed, 19 insertions(+), 9 deletions(-) diff --git a/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/Elf.java b/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/Elf.java index 8474b4c..7c2ea67 100644 --- a/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/Elf.java +++ b/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/Elf.java @@ -18,4 +18,9 @@ public class Elf extends Entity { public void debugLossConditions(GameStatus status, int entityCounter){ status.elfLoseDebug(entityCounter); } + + @Override + public void debugMovement(GameStatus status, int oldRow, int oldCol, int newRow, int newCol){ + status.elfMoveDebug(oldRow,oldCol,newRow,newCol); + } } \ No newline at end of file diff --git a/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/Entity.java b/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/Entity.java index 56df1ae..4859c34 100644 --- a/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/Entity.java +++ b/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/Entity.java @@ -19,6 +19,8 @@ public abstract class Entity //debug for each subclass public abstract void debugAttack(GameStatus status, int tempRow, int tempColumn, int targetRow, int targetColumn, int HP, int HPAfter); public abstract void debugLossConditions(GameStatus status, int entityCounter); + public abstract void debugMovement(GameStatus status, int oldRow, int oldCol, int newRow, int newCol); + // getter, setter methods, add some more public char getAppearance() diff --git a/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/Orc.java b/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/Orc.java index c2d9120..4fd0c33 100644 --- a/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/Orc.java +++ b/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/Orc.java @@ -18,4 +18,9 @@ public class Orc extends Entity { public void debugLossConditions(GameStatus status, int entityCounter){ status.orcLoseDebug(entityCounter); } + + @Override + public void debugMovement(GameStatus status, int oldRow, int oldCol, int newRow, int newCol){ + status.orcMoveDebug(oldRow,oldCol,newRow,newCol); + } } \ No newline at end of file diff --git a/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/World.java b/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/World.java index 4763cc7..1057a1c 100644 --- a/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/World.java +++ b/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/World.java @@ -221,15 +221,13 @@ public class World moveLogic('O', index, 1); } if ((GameStatus.debugModeOn)&&(location[index] != null)) { - debugMovement(index); // debug the move - } - } - - public void debugMovement(int index){ - if (location[index].getType() == 'E') {//elf move data - status.elfMoveDebug(oldRow,oldCol,location[index].getRow(),location[index].getRow()); - } else if (location[index].getType() == 'O') {//orc move data - status.orcMoveDebug(oldRow,oldCol,location[index].getRow(),location[index].getRow()); + if (location[index].getType() == 'E') {//elf move data + Entity movingEntity = new Elf(); + movingEntity.debugMovement(status, oldRow,oldCol,location[index].getRow(),location[index].getRow()); + } else if (location[index].getType() == 'O') {//orc move data + Entity movingEntity = new Orc(); + movingEntity.debugMovement(status, oldRow,oldCol,location[index].getRow(),location[index].getRow()); + } } } -- GitLab From 93f916234a2f80719bb4794c99ea32e6566df119 Mon Sep 17 00:00:00 2001 From: Devon Harstrom <devonharstrom@gmail.com> Date: Mon, 17 Feb 2025 16:16:20 -0700 Subject: [PATCH 14/17] just rearranged things --- Assignment_1/{ => Scrap and Notes}/Notes.txt | 0 .../src => Scrap and Notes}/reworks.java | 0 .../src => Scrap and Notes}/reworks2.java | 0 .../src => Scrap and Notes}/scrap2.txt | 0 .../src => Scrap and Notes}/scrap3.txt | 0 out/production/501-gitlab/Elf.class | Bin 860 -> 1090 bytes out/production/501-gitlab/Entity.class | Bin 1639 -> 1685 bytes .../501-gitlab/FileInitialization.class | Bin 3182 -> 3182 bytes .../501-gitlab/GamePanel$MyKeyAdapter.class | Bin 1193 -> 1193 bytes out/production/501-gitlab/GamePanel.class | Bin 4757 -> 4757 bytes out/production/501-gitlab/Location.class | Bin 1160 -> 1160 bytes out/production/501-gitlab/Orc.class | Bin 859 -> 1089 bytes out/production/501-gitlab/World.class | Bin 6085 -> 6025 bytes 13 files changed, 0 insertions(+), 0 deletions(-) rename Assignment_1/{ => Scrap and Notes}/Notes.txt (100%) rename Assignment_1/{refactored_code/assignment3GUI - Classmate's/src => Scrap and Notes}/reworks.java (100%) rename Assignment_1/{refactored_code/assignment3GUI - Classmate's/src => Scrap and Notes}/reworks2.java (100%) rename Assignment_1/{refactored_code/assignment3GUI - Classmate's/src => Scrap and Notes}/scrap2.txt (100%) rename Assignment_1/{refactored_code/assignment3GUI - Classmate's/src => Scrap and Notes}/scrap3.txt (100%) diff --git a/Assignment_1/Notes.txt b/Assignment_1/Scrap and Notes/Notes.txt similarity index 100% rename from Assignment_1/Notes.txt rename to Assignment_1/Scrap and Notes/Notes.txt diff --git a/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/reworks.java b/Assignment_1/Scrap and Notes/reworks.java similarity index 100% rename from Assignment_1/refactored_code/assignment3GUI - Classmate's/src/reworks.java rename to Assignment_1/Scrap and Notes/reworks.java diff --git a/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/reworks2.java b/Assignment_1/Scrap and Notes/reworks2.java similarity index 100% rename from Assignment_1/refactored_code/assignment3GUI - Classmate's/src/reworks2.java rename to Assignment_1/Scrap and Notes/reworks2.java diff --git a/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/scrap2.txt b/Assignment_1/Scrap and Notes/scrap2.txt similarity index 100% rename from Assignment_1/refactored_code/assignment3GUI - Classmate's/src/scrap2.txt rename to Assignment_1/Scrap and Notes/scrap2.txt diff --git a/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/scrap3.txt b/Assignment_1/Scrap and Notes/scrap3.txt similarity index 100% rename from Assignment_1/refactored_code/assignment3GUI - Classmate's/src/scrap3.txt rename to Assignment_1/Scrap and Notes/scrap3.txt diff --git a/out/production/501-gitlab/Elf.class b/out/production/501-gitlab/Elf.class index 9378f07d5e92dff96ac8ec456cb992b0f7b5f83d..3655c02272a71c5542574dbe175e7519266afd86 100644 GIT binary patch delta 565 zcmZ9IJ5K^Z6ot>Mu;4DT1)!jy_&~u`d_R!HLQIrI8%*pmtQPVp1Sx6ljNzBiP*_-4 zTKNO~EygpmW-&H9-@SA0xo77~e-9cT->+`~N+`Y<PiX@Nq9MdEDG+k%x0kI)=hV6B z+zAA-<#KuOToUIKHQA9@4X4=_h-5F$stxC=U2S(Bid2<z*8+O0UaPdaE|gkzLeuHG z9RfT3Pmw81Ar65ABWRfBIfJBEr&!PaspsJ1T>xo*=lgjrX)kcj;3N>_IgUkAh_`@= zC1iLCEMrCKJ6gIo(uWa-rSuifg6!%gWsy@J7FM}kx?8YGV~W;DK1J&!zoI-zSF}M2 zaC#G4aw~i1bdZy}o$L)^4Tu^>K_aw>svv1s<^|EcAUd{btI===yT7*goRcd}JDH04 vV*Vi_|E=SElZ3K9cBLntx9NGC*i+u}$@WPys)+-V{7DmsBtLf+RPLi6YJ)os delta 365 zcmZ9GJyHTe5QV=TV0Kw8CSV6d7e!G}7XLyctuit8LIftJ7NMsgkifvekTZA|%eS)> zS|-z9PxpKMK9et-uD;(tfP1cA(&xq7T{OQn!<#l45ncmBhaO#aHhoY1?w@{-nr1P% z-v0d6<g<P0QYj%(ZE_&m))clFaHtw_#IW2KKS`UYx+3rUx^H;v<0Z|7z6`%sEn2u> z^;oU1tt8}_lVI-{DcG#M>=+AcflfvBKxd*xpoz!^Dnzm5Q_k0k9(1@=+9F@#{s(Ex aAqznU)z&76t%78wlndD!8D6S0T>Su|)fp}T diff --git a/out/production/501-gitlab/Entity.class b/out/production/501-gitlab/Entity.class index c6fa73c25e6473c62d60c4c222b61ee509c4e68f..8864418cb1a2e33629521eace40214c29ee345ae 100644 GIT binary patch delta 409 zcmZwD&q_i;6bA5boEiUhEiV!gAz5AV8fIl#+AS4Yh)}DZz~~Y#EFx_mZQ91vE3}Fr z+O_BbTJ;QVT1MM~=;IPpAOmM+I6uBK%&T>kh(CQjJObE6<1XG2nLU5EzrTHW;&=Un zo<PdoYPP%nPOshTAA7A<>%J?_gh-nAP}NRAVHh!tuqKg$Z9Lhqlt2zHBL(v2LXDbB zX`2_BG3U~nP28{%!X#^$0LX9wR&dss!ZdFJb10fmnbi(7vgSyQ4b2BeU;&G!sj}K- zCm(c5oGrMPP%x)5Wv-PyUKo%X!!pIQ%E>bK4>c1h@$D<jbF`Z-Bg*sdTVhycE+{G# w9f}G?b)cwH+-fK7@jur82#vL$43FYXI}<gE`aiKAh$uEpF<gq&I5C9!H<Qgd+5i9m delta 336 zcmZvXJx;?w5QX1nckLuNB*sE6kVyc84G0Jc5b{f;Z~|%?N)ABDDMlzt#RX^(9R(6C zEiFB_2t1nxB(&0ucHZ~i?A}#Az4F`q`31lPqsQ{KdYY+QrK%F@uJ6I1f)W;ast8b% zD?N6gkRX*;6D+w8G!{^2&Bj0|zFF4W*vVx1(!RXwhBVEpU4zBC+?#M=4<1>CeH_S* z*|b|!l3Zz`mMe$3KUTX;3v3B3-sdLKZT8e|xNW}ai0%uUMjaG!iUxOQsi1Pql&qhS xn3Cv|82n3gNPO5hI^#dbzX;33pNuYv$ca}bB+ma3y__hbFPBcs9dKg-!*6x3Ed2lg diff --git a/out/production/501-gitlab/FileInitialization.class b/out/production/501-gitlab/FileInitialization.class index c6fd566047463a563e880b13bbfa3db622aecb24..da5d0ff30627fe6a372cb4e1ba2556772f4690f0 100644 GIT binary patch delta 196 zcmWNL%L+jO5QaZHA{(irq+C*Rzh9GUSdfMLaakR7BxT_Rlq}WRc?#u4Y`uhMFiri< zKY#Ph{FI;aQq3m6u{3|RAQmFniQ*)Nn>aoa1WAfZNtY%gl_N_<v`L;m1xA!uP-ZPt zjVd}Fj?_3&=R$+4_!}+mw0Y2dKP_idXn<7~9gI<!;AKjfnLy_PR4K9&z*_JdBWwM* WGy-hpiJhc-Iiu6%Ko8CE*oJ?O+aVGF delta 196 zcmWNL%L+jO6h)UAk%`n*l2=OJ?{|ni2Fk!A+%UOy5z4?1C>g3d^A*aEnEHwP4bEh@ zPv`8lkExi-du6rw4b}S7LfDAmB#xT|UXlb!5g{!uBbp^oj-qIt0v&N9N=&G*q{^Ba z8V&aJIMU=yiz{tzGT-I;L6;}}&&zhPL`T>q=wgb(i~w^fUI=hW8C8I532y|yH465x XM<>iqp4iLwAmv8}oEV}TKF9bEfBPW~ diff --git a/out/production/501-gitlab/GamePanel$MyKeyAdapter.class b/out/production/501-gitlab/GamePanel$MyKeyAdapter.class index bb20d92574b91717d122dcad35daa9f1c30c10a3..5352d307ceb607c8ff71bf7632daa0768037370a 100644 GIT binary patch delta 55 zcmV-70LcHT38@LNkplsllad3dC7S>s0G$9W0G<Fk0HXjv0Hgp&0Hpv-0Hy#>0H^?0 N0I2|50IZW=1WLlH4><q; delta 55 zcmV-70LcHT38@LNkplsklad3dC7J*r0Gt3V0G$9j0HOdu0HXj%0Hgp+0Hpv=0H**~ N0H^?40IQQ<1WLh`4=w-z diff --git a/out/production/501-gitlab/GamePanel.class b/out/production/501-gitlab/GamePanel.class index 65bf4166eb8b0acaca67ba68cc5af466dc60156c..d5ae57f40a5565f407a063935c7b3ee1ed96f7a9 100644 GIT binary patch delta 396 zcmWNN*(=0h6o#Kq6f;bdI}rwBi()kPondU*X~vN3>oC?LWZ%j%KNBU~C`qE`LgLb$ zd)IQ~UvTMkZobZW-}64-@tJ+*=Np|lo<O1rAqE4nM36u#W->`6n<UCfriv8pLuU(0 zBaC#-pf3-}AV?HCESf|AZM70CS|d5KCs(|ASjnf50vaizk78yhVVhFCqPvjkHI;sM z=#O$#6NQ~DYN()As*X15aniu3n5SuCjb^d7a7HUvGQFjpM>=??lTRG{;#2{2sRUfg zPPb~IM|tS=-y2?4O+S$gU|~?0h9qKGB1XhCCRF1RF(G7=tmEc{DQ@uaCY>*4`D0E+ zF|QI?P&O9*4@Q$}Uy=hX3-JnZtjd{|$q;ik8<eq$jV)o{5!PK?>`CyxEIJU?5r-U0 W#Hswk%Ox6j@_NF@3+I|CeC{8GZBF_C delta 396 zcmWNN+bhFi7{@=atk_t~ot!c@LOE?tIb>_IA!o9g)SPn6xtwA&heY@xC3d4EiQ0w4 zr91bo<;K6@($iZ{J<t0*&*%Gm&n@Sc=ZM~7CYChfNykVA$z+j7HpN&d!-|6(+~jH> zdY3MrL<%&c!4Y4Gjw19FYd*ub-9{XCOwylDxy)5aR!KEgv`P$8!yL7QspC|BF0pZg zGdi8{qkL{sX`mDjPP{bA>!Jxi&5Y5)j4aroO-9=}ql0TYxs{Gbx_PIEPkQ;qr(*D{ zZ2FXkfa;)M%`y<ZH@+%wkQ4?fVMz203t~h7qxfWbka39<qHK~7Qyeo*M1XJ1@+H+j z=2a>S%F3d0u@rqUWvcFFF<?a$uVH3gY+4Z$Hs$OP^=#o{TXcs-=MDjO1-i#P`>b-v Z0Y`#3mMc!U5*zN&c#`ae3oSEg;U7M-PMrV% diff --git a/out/production/501-gitlab/Location.class b/out/production/501-gitlab/Location.class index dcd0b492f37745e08e7c54f768482e9b63f87229..4b1b5b63ea49b304e85f6edcd9e3f00f3276f3e9 100644 GIT binary patch delta 117 zcmeC+?BLuW$|TCoz{0=@gggv<47?1&KvIH%f3g-+6r;%G|4gEjXECWy{>LOX`8tz2 zqcl*&c5(-^%;X4W16D-_RtBZXj?ChdmoV!ys(@9$WY%ES0E%mZ#dTQ>SapCrT`;eb Gg&zQTuNeaX delta 117 zcmeC+?BLuW$|TCkz{0@Jz{$YHz{kMNAk4tSAi=;pS&J!(QE>8qCeg{WnA90X!K~{{ z>XQ#LiA@$^)?k%pU}cb*?8xjs*@jtW@)Bl!Mn$limq0mHpqv^|PJFU1ivg=9kf#Oa IRkH8{05Pr@1^@s6 diff --git a/out/production/501-gitlab/Orc.class b/out/production/501-gitlab/Orc.class index 272d01a1808996a462f5b0c5cdc6f42630786dea..5a83a7671771031d497e23f09b37619b30690307 100644 GIT binary patch delta 565 zcmZ9Iy-&hW6va;~6l{?WfP#SH2MVJ2{edJ7VxmoS!NeV<aS&*tAS0`rG5jSg3=Sr) zPVW9M#`9iHF{Vl1@7{Orxu^Zo-h=wb_v;&g3d%3~Q$~l5Xb3S(DhN6EHy6&MePUmC zZWRP_mSqi|E6UkKU3A1%({8mDL~`e+wWfX9uC+T4WvZ<Fl>*Ia)T>U{g^JT4wCt|i zA+Xc`RI;Th#GxR;2r8y|CXw>$H0zl^^(=h63n0VyT)(I$3-g@QISB+Y&S!xX;;rZ| zBFj_35|*XDt!8>7eHdYwQeWjP$gW;c4teQeVujm<yNLp6OwuaJCuxo3msBKalGaH9 zPH$jSY-R6^4q{R(q<TY`1EPvikO(cJGDyaic|kNUh=wiNsx;ij&adqq=fp~*kV?mV vG5-*e|JHH-g@m*|a;3+fx8Zpk*p=RN!X8OPHLy<-A8Fu#<mb+k%zgL+d$c<g delta 337 zcmYk0I}ZUt6ot>uGT4YMJlAu*AM07FNHl7HNUIg4U!kB-NVNWf${!JDu4Kt1GvA$i z&bjv<e`@FPzTN<=Fxxx3(|Ktf7OFW<BLfRrHWYI3kVhe`J=Vp)x&)iO7|OgWhodS5 zRr(w{fjAO8HBypY^XsF|*FpnL(Z7_x{pnLk!4>_6UXZ_fLoKu=!$pVFO}dLN$rkF7 zB0_yqRA@lbLIEj8_Yfm9m49m{7^e=(>kHfyQQ@~pnh_aU#Q(~|MRd4`#+b2+ffI30 EKgPiqz5oCK diff --git a/out/production/501-gitlab/World.class b/out/production/501-gitlab/World.class index 4f657273fe51ab33ecc158b0d9f0d214c1ba8124..5fb1ed8a7e620a133b7497b4b1d38f1ef15457ab 100644 GIT binary patch delta 1410 zcma)5TWC~Q6kTT~nasU&CmCm^V@qNP##Bu$F%u=&fcemvS{21~0wRKuOjApe0li5P z#X!-vBKSJ_lp;m&t4M52p`uVqjE!l0C9OKPzWPjCHCp>HX>gtU68}1vduH!*_F8+d zv-j<<*i)eoPJMm`z!FUL=tl#M8iF`y;42scflO=j+RVFZ>%4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U)o_Pn(HofMttynW1`O|z-f$Nxu8+Z{@ScaRNyMNG)zFT;QZIk%VNu%%r81mB? z!Zkj2YS4$=kyO%kXVBGv@v*&6W1U>}E}J43tdB;VAYZMw@juTjN)H5thB=P_`LS4Y -- GitLab From f857d4a5fdd971ebba127133ca4339ab28cc52ae Mon Sep 17 00:00:00 2001 From: Devon Harstrom <devonharstrom@gmail.com> Date: Tue, 18 Feb 2025 01:14:18 -0700 Subject: [PATCH 15/17] wrote the readme --- Assignment_1/CPSC501A1W25README.md | 392 +++++++++++++++++++++++++++++ Assignment_1/README.md | 19 -- 2 files changed, 392 insertions(+), 19 deletions(-) create mode 100644 Assignment_1/CPSC501A1W25README.md delete mode 100644 Assignment_1/README.md diff --git a/Assignment_1/CPSC501A1W25README.md b/Assignment_1/CPSC501A1W25README.md new file mode 100644 index 0000000..17538ac --- /dev/null +++ b/Assignment_1/CPSC501A1W25README.md @@ -0,0 +1,392 @@ +# CPSC 501, W25, T02 +### Devon Harstrom, 30132397 + +--- + +### Info: +> Used code from Ethan McCorquodale a classmate who gave permission to use this old code +I then refactored it </br> +All refactoring was tested on: </br> +Assignment_1/refactored_code/assignment3GUI - Classmate's/src/refactor_1_test.java +which tests the world functions to see if the game runs properly +> other testing was done in the GUI outside of code as it is a GUI based coed + +--- + +#how to run: +> run the java file Simulator.Java in the refactored folder +> enter a txt world file for a basic one enter: +> Assignment_1/refactored_code/assignment3GUI - Classmate's/src/data.txt </br> +> This is the map that the Gui was tested on during the refactoring + +--- + +### Refactors performed: +> Refactor branch 1: De-nesting code in world (major) </br> +Refactor branch 2: Pulling out methods (major) </br> +Refactor branch 3: Rearrange classes? (major) </br> +Refactor branch 4: Name changes, removing unused code, etc. (small) </br> +Refactor branch 5: Comments (small) </br> + +--- + +### Explanation + +##### Refactor 1: +> Refactor 1 was de-nesting code blocks in the world.java file and class +> The original file had lots of nested code which made the readability and understanding +> of the code harder. So as a solution I de-nested this by taking the opposite if statements and returning +> if it was true so for example: +``` +if(((loc[index].getType() == 'O')&&(aWorld[tempRow][tempColumn].getAppearance() != 'O'))||((loc[index].getType() == 'E')&&(aWorld[tempRow][tempColumn].getAppearance() != 'E'))) {//makes sure it's not attacking it's own kind + turnSinceAtk = 0; + if((loc[index].getType() == 'E')&&(aWorld[loc[index].getRow()][loc[index].getColumn()] != null)) { + //... a bunch more if statements + } +------------------------------------AFTER------------------------------------------ +if(aWorld[tempRow][tempColumn] == null){ + return; +} +if((loc[index].getType() == 'O') && (aWorld[tempRow][tempColumn].getAppearance() == 'O')) { + return; +} +if((loc[index].getType() == 'E') && (aWorld[tempRow][tempColumn].getAppearance() == 'E')) { + return; +} +``` +> This makes it much easier to read and understand +> I did this for every function in World which includes +> Constructor, sortDead, sortLocations, attack, checkPerim, move + + +--- + +##### Refactor 2: +> Refactor 2 built off refactor 1 as now that the functions were properly de-nested +> I could separate functions into smaller functions in the World.java file. Adding again to the readability +> split up functions stops some functions from being too long which happened alot in the original code +> For example the move function originally looked like this: +``` +public void move(int index) {//changes the value of aWorld[][] must set old position to null then update it to the new position. + if (checkPerimiter(index) == false) {//checks the perim for things not null if it finds something it returns true and the move code below doesn't run + if (loc[index] != null) { + if (loc[index].getCanMove()) { + if((loc[index].getRow()-1 != -1)&&(loc[index].getColumn()-1 != -1)) { + if ((loc[index].getType() == 'E')&&(aWorld[loc[index].getRow()-1][loc[index].getColumn()-1]== null)) { + oldRow = loc[index].getRow(); + oldCol = loc[index].getColumn(); + loc[index].setRow(oldRow-1); + loc[index].setColumn(oldCol-1); + aWorld[oldRow-1][oldCol-1] = aWorld[oldRow][oldCol]; + aWorld[oldRow][oldCol] = null; + } + } + if((loc[index].getRow()+1 != 10)&&(loc[index].getColumn()+1 != 10)) { + if ((loc[index].getType() == 'O')&&(aWorld[loc[index].getRow()+1][loc[index].getColumn()+1]== null)) { + oldRow = loc[index].getRow(); + oldCol = loc[index].getColumn(); + loc[index].setRow(oldRow+1); + loc[index].setColumn(oldCol+1); + aWorld[oldRow+1][oldCol+1] = aWorld[oldRow][oldCol]; + aWorld[oldRow][oldCol] = null; + } + } + if ((GameStatus.debugModeOn)&&(loc[index]!= null)) { + if (loc[index].getType() == 'E') {//elf move data + status.elfMoveDebug(oldRow,oldCol,loc[index].getRow(),loc[index].getRow()); + } else if (loc[index].getType() == 'O') {//orc move data + status.orcMoveDebug(oldRow,oldCol,loc[index].getRow(),loc[index].getRow()); + } + } + } + } + } + } +``` +> which is very long and also has some potential repeate code with: +``` +if ((loc[index].getType() == 'E')&&(aWorld[loc[index].getRow()-1][loc[index].getColumn()-1]== null)) { + oldRow = loc[index].getRow(); + oldCol = loc[index].getColumn(); + loc[index].setRow(oldRow-1); + loc[index].setColumn(oldCol-1); + aWorld[oldRow-1][oldCol-1] = aWorld[oldRow][oldCol]; + aWorld[oldRow][oldCol] = null; +} +``` +> so separating functions also allows me to reduce repetitive code, and i can use polymorphism to add to this +> this is what it now look like in refactor 2: +``` +public void moveLogic(char entityType, int index, int increment){ + if ((loc[index].getType() == entityType)&&(aWorld[loc[index].getRow()+ increment][loc[index].getColumn()+increment]== null)) { + oldRow = loc[index].getRow(); + oldCol = loc[index].getColumn(); + loc[index].setRow(oldRow+increment); + loc[index].setColumn(oldCol+increment); + aWorld[oldRow+increment][oldCol+increment] = aWorld[oldRow][oldCol]; + aWorld[oldRow][oldCol] = null; + } +} +``` +> where I can just pass in parameters and have one function. + +--- + +##### Refactor 3: +> Refactor 3 separated the entity class into two subclasses Orcs and Elves +> This allows a better structure in the code and the potential for other entities +> I can also move debug statements to the new subclasses and keep track of entity count +> in the entity class which makes it easier to understand. +> here is an example of the old and new entity class with the elf subclass: +``` +---------------OLD------------------ +//Author Ethan McCorquodale + +/* + Version Feb 17A, 2021 + * Added method so an Entity can damage another Entity. + + Version: Feb 12A, 2021 + * Added attribute to track if Entity has been moved or not. + + Version: Feb 11B, 2021 + * Changed references from dwarves to elves. + * Added a new damage attribute. + +*/ + +public class Entity +{ + public static final char DEFAULT_APPEARANCE = 'X'; + public static final char ELF = 'E'; + public static final char EMPTY = ' '; + public static final char ORC = 'O'; + public static final int DEFAULT_HP = 1; + public static final int ORC_DAMAGE = 3; + public static final int ELF_DAMAGE = 7; + public static final int ORC_HP = 10; + public static final int ELF_HP = 15; + + private char appearance; + private int hitPoints; + private int damage; + + boolean attacking= false; + public Entity() + { + setAppearance(DEFAULT_APPEARANCE); + setHitPoints(DEFAULT_HP); + } + + public Entity(char newAppearance) + { + appearance = newAppearance; + hitPoints = DEFAULT_HP; + damage = ORC_DAMAGE; + } + + public Entity(char newAppearance, int newHitPoints, int newDamage) + { + setAppearance(newAppearance); + setDamage(newDamage); + setHitPoints(newHitPoints); + } + /* public void setAtt(boolean isAttacking) { + attacking = isAttacking; + } + public boolean getAtt() { + return attacking; + }*/ + public char getAppearance() + { + return(appearance); + } + + public int getDamage() + { + return(damage); + } + + public int getHitPoints() + { + return(hitPoints); + } + + public void setAppearance(char newAppearance)//changed this from private to public to change the entity appearance to ' ' + { + appearance = newAppearance; + } + + private void setDamage(int newDamage) + { + if (newDamage < 1) + { + System.out.println("Damage must be 1 or greater"); + } + else + { + damage = newDamage; + } + } + + public void setHitPoints(int newHitPoints) + { + hitPoints = newHitPoints; + } + + +} +---------------NEW------------------ +public abstract class Entity +{ +// public static final char DEFAULT_APPEARANCE = 'X'; + public static final char EMPTY = ' '; +// public static final int DEFAULT_HP = 1; + + private char appearance; + private int hitPoints; + private int damage; + + private static int orcCounter = 0; + private static int elfCounter = 0; + + public Entity(char appearance, int hitPoints, int damage) { + this.appearance = appearance; + this.hitPoints = hitPoints; + this.damage = damage; + } + + public abstract void debugAttack(GameStatus status, int tempRow, int tempColumn, int targetRow, int targetColumn, int HP, int HPAfter); + public abstract void debugLossConditions(GameStatus status, int entityCounter); + + public char getAppearance() + { + return(appearance); + } + + public int getHitPoints() + { + return(hitPoints); + } + + public void setAppearance(char newAppearance) + { + appearance = newAppearance; + } + + public void setHitPoints(int newHitPoints) + { + hitPoints = newHitPoints; + } + + public int getDamage() + { + return(damage); + } + + public static int getElfCounter() { + return elfCounter; + } + + public static int getOrcCounter() { + return orcCounter; + } + + public static void incrementElfCounter(int value) { + elfCounter = elfCounter + value; + } + + public static void incrementOrcCounter(int value) { + orcCounter = orcCounter + value; + } + + public static void setElfCounter(int newElfCounter){ + elfCounter = newElfCounter; + } + + public static void setOrcCounter(int newOrcCounter){ + orcCounter = newOrcCounter; + } +} + +public class Elf extends Entity { + public static final char ELF = 'E'; + public static final int ELF_DAMAGE = 7; + public static final int ELF_HP = 15; + + public Elf() { + super(ELF, ELF_HP, ELF_DAMAGE); + } + + @Override + public void debugAttack(GameStatus status, int tempRow, int tempColumn, int targetRow, int targetColumn, int HP, int HPAfter) { + status.elfAttackDebug(tempRow, tempColumn, targetRow, targetColumn, HP, HPAfter); + } + + @Override + public void debugLossConditions(GameStatus status, int entityCounter){ + status.orcLoseDebug(entityCounter); + } +} +``` +> The same is done what Orc subclass + +--- + +##### Refactor 4: +> refactor 4 was a number of small refactors such as changing names, removing unsless code +> general warning fixing and writing code more consistently +> This was done across all files. Here are some examples: +``` +Name changing: + r,c to rows and columns + i to location index + g to graphics + +Removing unused code: + public static final int ORCS_WIN = 0; + public static final int ELVES_WIN = 1; + public static final int DRAW = 2; + public static final int CEASE_FIRE = 3; + public static final int NOT_OVER = 4; + +Consistent code: + if(GameStatus.debugModeOn == false) to + if(GameStatus.debugModeOn) + + if(world.programRunning != false) { + timer.start(); + break; + }else { + break; + } + to + if(world.programRunning != false) { + timer.start(); + } + break; +``` +> And much more + +--- + +##### Refactor 5 +> Refactor 5 is simply commenting to explain code +> this was mainly done in the world.java file +> This just helps with readability and understanding +> for example: + +``` +// logic for attacking gets health and subtracts the attacking entities damage and sets the new health +and +deathLogic(attackingEntity, index); // check if attacker killed enemy +victoryLogic(attackingEntity); // check if no enemy remains +and much more +``` + +--- + +That is all the Refactoring done on the original code + +--- + diff --git a/Assignment_1/README.md b/Assignment_1/README.md deleted file mode 100644 index 3c54b7d..0000000 --- a/Assignment_1/README.md +++ /dev/null @@ -1,19 +0,0 @@ -# CPSC 501, W25 -### Devon Harstrom, 30132397 - ---- - -Used code from __ and refactored - - -Refactor branch 1: De-nesting code in world - -refactor branch 2: pulling out methods - -refactor branch 3: rearrange classes? - -refactor branch 4: new class? for elves and dwarves? - -refactor branch last: comments - -refactor: _ maybe renaming? or getting rid of temp variables or unused ones -- GitLab From 4811f4b9cb11f9edeccaf5eb64c0c214f194d5a2 Mon Sep 17 00:00:00 2001 From: Devon Harstrom <devonharstrom@gmail.com> Date: Tue, 18 Feb 2025 04:22:23 -0700 Subject: [PATCH 16/17] forgot to re-add these test i made into the git commits and never realized but i went thoguh and ran them and everything works fine. Just wanted to note as well since this is one of the final pushes I did use chatgpt just to figure out how to input something into terminal from code since I couldnt figure out how. Other than that its all my code. --- Assignment_1/CPSC501A1W25README.md | 2 +- ...efactor_1_test.java => refactorTests.java} | 53 +++++++++++++++++-- 2 files changed, 51 insertions(+), 4 deletions(-) rename Assignment_1/refactored_code/assignment3GUI - Classmate's/src/{refactor_1_test.java => refactorTests.java} (73%) diff --git a/Assignment_1/CPSC501A1W25README.md b/Assignment_1/CPSC501A1W25README.md index 17538ac..6919c03 100644 --- a/Assignment_1/CPSC501A1W25README.md +++ b/Assignment_1/CPSC501A1W25README.md @@ -7,7 +7,7 @@ > Used code from Ethan McCorquodale a classmate who gave permission to use this old code I then refactored it </br> All refactoring was tested on: </br> -Assignment_1/refactored_code/assignment3GUI - Classmate's/src/refactor_1_test.java +Assignment_1/refactored_code/assignment3GUI - Classmate's/src/refactorTests.java which tests the world functions to see if the game runs properly > other testing was done in the GUI outside of code as it is a GUI based coed diff --git a/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/refactor_1_test.java b/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/refactorTests.java similarity index 73% rename from Assignment_1/refactored_code/assignment3GUI - Classmate's/src/refactor_1_test.java rename to Assignment_1/refactored_code/assignment3GUI - Classmate's/src/refactorTests.java index 5583574..2df6806 100644 --- a/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/refactor_1_test.java +++ b/Assignment_1/refactored_code/assignment3GUI - Classmate's/src/refactorTests.java @@ -4,7 +4,7 @@ import java.io.InputStream; import static org.junit.jupiter.api.Assertions.*; import org.junit.jupiter.api.*; -class refactor_1_test { +class refactorTests { private static World world; @BeforeEach @@ -25,6 +25,7 @@ class refactor_1_test { void testBoardInitialization() { String simulatedInput = "Assignment_1/original_code/assignment3GUI - Classmate's/src/data.txt"; // String simulatedInput = "Assignment_1/refactored_code/assignment3GUI - Classmate's/src/attackTest.txt\n"; + // note chatgpt helped with the system.in portion as i wasn't sure how to enter into terminal though code InputStream originalSystemInStream = System.in; // Save the original System.in ByteArrayInputStream simulatedInputStream = new ByteArrayInputStream(simulatedInput.getBytes()); System.setIn(simulatedInputStream); // Set System.in to the new input stream @@ -41,8 +42,20 @@ class refactor_1_test { @Test void sortDeadTest(){ - // not sure how to test because the comment just says doesn't work as intended?? - //but works in gui + String simulatedInput = "Assignment_1/original_code/assignment3GUI - Classmate's/src/data.txt"; +// String simulatedInput = "Assignment_1/refactored_code/assignment3GUI - Classmate's/src/attackTest.txt\n"; + // note chatgpt helped with the system.in portion as i wasn't sure how to enter into terminal though code + InputStream originalSystemInStream = System.in; // Save the original System.in + ByteArrayInputStream simulatedInputStream = new ByteArrayInputStream(simulatedInput.getBytes()); + System.setIn(simulatedInputStream); // Set System.in to the new input stream + world = new World(); // This will call FileInitialization.read() and use the simulated input + System.setIn(originalSystemInStream); // Restore the original System.in + + world.sortDead(); + assertNull(world.location[world.location.length - 1]); + assertNull(world.location[world.location.length - 2]); + assertNull(world.location[world.location.length - 20]); + System.out.println(world.location[world.location.length - 20]); } @Test @@ -112,5 +125,39 @@ class refactor_1_test { } + @Test + void testEntities(){ + Entity testElfEntity = new Elf(); + Entity testOrcEntity = new Orc(); + + assertNotNull(testElfEntity, "should not be null"); + assertNotNull(testOrcEntity, "should not be null"); + + assertEquals('E', testElfEntity.getAppearance()); + assertEquals('O', testOrcEntity.getAppearance()); + + assertEquals(7, testElfEntity.getDamage()); + assertEquals(3, testOrcEntity.getDamage()); + + assertEquals(15, testElfEntity.getHitPoints()); + assertEquals(10, testOrcEntity.getHitPoints()); + } + + @Test + void testEntityCounters() { + assertEquals(0, Entity.getElfCounter()); + assertEquals(0, Entity.getOrcCounter()); + + Entity.incrementElfCounter(5); + Entity.incrementOrcCounter(-1); + assertEquals(5, Entity.getElfCounter()); + assertEquals(-1, Entity.getOrcCounter()); + + Entity.setElfCounter(0); + Entity.setOrcCounter(0); + + assertEquals(0, Entity.getElfCounter()); + assertEquals(0, Entity.getOrcCounter()); + } } \ No newline at end of file -- GitLab From beb2a4a2bc8e2fc8ed200ff34ece82cbf41445ac Mon Sep 17 00:00:00 2001 From: Devon Harstrom <devonharstrom@gmail.com> Date: Tue, 18 Feb 2025 04:44:24 -0700 Subject: [PATCH 17/17] added to readme pretty much done assignment --- Assignment_1/{ => refactored_code}/CPSC501A1W25README.md | 2 ++ 1 file changed, 2 insertions(+) rename Assignment_1/{ => refactored_code}/CPSC501A1W25README.md (98%) diff --git a/Assignment_1/CPSC501A1W25README.md b/Assignment_1/refactored_code/CPSC501A1W25README.md similarity index 98% rename from Assignment_1/CPSC501A1W25README.md rename to Assignment_1/refactored_code/CPSC501A1W25README.md index 6919c03..29cbcb1 100644 --- a/Assignment_1/CPSC501A1W25README.md +++ b/Assignment_1/refactored_code/CPSC501A1W25README.md @@ -6,6 +6,8 @@ ### Info: > Used code from Ethan McCorquodale a classmate who gave permission to use this old code I then refactored it </br> +> The original code is by Ethan McCorquodale. I was given permission to use it: +> “... I give you guys (and anyone else who is in the same situation) permission to use this project.†</br> All refactoring was tested on: </br> Assignment_1/refactored_code/assignment3GUI - Classmate's/src/refactorTests.java which tests the world functions to see if the game runs properly -- GitLab