diff --git "a/Gi\303\241p Minh Hi\341\272\277u/Product/README.md" "b/Gi\303\241p Minh Hi\341\272\277u/Product/README.md" deleted file mode 100644 index a5bc01b..0000000 --- "a/Gi\303\241p Minh Hi\341\272\277u/Product/README.md" +++ /dev/null @@ -1,60 +0,0 @@ -# Sea Battle - -Sea Battle is a game for two players. The game is played on four grids, two for each player. The grids are typically square – usually 10×10 – and the individual squares in the grid are identified by letter and number. On one grid the player arranges ships and records the shots by the opponent. On the other grid the player records their own shots. - -The project was done by [Nguyễn Văn A](https://github.com/naa-ntu), in the course of Object Oriented Programming at [ProPTIT](https://proptit.com/). - - -## Tech Stack - -- [Java](https://www.java.com/en/) - - -## Installation - -- Clone the repo -- Open the project in your IDE -- Run the project - - -## Usage - -- Project Structure - -```bash - -├── src -│ ├── main -│ │ ├── java -│ │ │ ├── controller -│ │ │ │ ├── Controller.java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ └── ....java -│ │ │ ├── model -│ │ │ │ ├── Board.java -│ │ │ │ ├── Cell.java -│ │ │ │ ├── Game.java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ └── ....java - - -``` - -## Contributing - -Pull requests are welcome. For major changes, please open an issue first -to discuss what you would like to change. - -Please make sure to update tests as appropriate. - -## License - -[MIT](https://choosealicense.com/licenses/mit/) \ No newline at end of file diff --git "a/Gi\303\241p Minh Hi\341\272\277u/UML/ActivityDiagram.png" "b/Gi\303\241p Minh Hi\341\272\277u/UML/ActivityDiagram.png" deleted file mode 100644 index 7edbe67..0000000 Binary files "a/Gi\303\241p Minh Hi\341\272\277u/UML/ActivityDiagram.png" and /dev/null differ diff --git "a/Gi\303\241p Minh Hi\341\272\277u/UML/ClassDiagram.png" "b/Gi\303\241p Minh Hi\341\272\277u/UML/ClassDiagram.png" deleted file mode 100644 index 291e509..0000000 Binary files "a/Gi\303\241p Minh Hi\341\272\277u/UML/ClassDiagram.png" and /dev/null differ diff --git "a/Ho\303\240ng V\304\203n Ch\303\255nh/Product/README.md" "b/Ho\303\240ng V\304\203n Ch\303\255nh/Product/README.md" deleted file mode 100644 index a5bc01b..0000000 --- "a/Ho\303\240ng V\304\203n Ch\303\255nh/Product/README.md" +++ /dev/null @@ -1,60 +0,0 @@ -# Sea Battle - -Sea Battle is a game for two players. The game is played on four grids, two for each player. The grids are typically square – usually 10×10 – and the individual squares in the grid are identified by letter and number. On one grid the player arranges ships and records the shots by the opponent. On the other grid the player records their own shots. - -The project was done by [Nguyễn Văn A](https://github.com/naa-ntu), in the course of Object Oriented Programming at [ProPTIT](https://proptit.com/). - - -## Tech Stack - -- [Java](https://www.java.com/en/) - - -## Installation - -- Clone the repo -- Open the project in your IDE -- Run the project - - -## Usage - -- Project Structure - -```bash - -├── src -│ ├── main -│ │ ├── java -│ │ │ ├── controller -│ │ │ │ ├── Controller.java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ └── ....java -│ │ │ ├── model -│ │ │ │ ├── Board.java -│ │ │ │ ├── Cell.java -│ │ │ │ ├── Game.java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ └── ....java - - -``` - -## Contributing - -Pull requests are welcome. For major changes, please open an issue first -to discuss what you would like to change. - -Please make sure to update tests as appropriate. - -## License - -[MIT](https://choosealicense.com/licenses/mit/) \ No newline at end of file diff --git "a/Ho\303\240ng V\304\203n Ch\303\255nh/Product/src/test.md" "b/Ho\303\240ng V\304\203n Ch\303\255nh/Product/src/test.md" deleted file mode 100644 index e69de29..0000000 diff --git "a/Ho\303\240ng V\304\203n Ch\303\255nh/UML/README.md" "b/Ho\303\240ng V\304\203n Ch\303\255nh/UML/README.md" deleted file mode 100644 index 9db701f..0000000 --- "a/Ho\303\240ng V\304\203n Ch\303\255nh/UML/README.md" +++ /dev/null @@ -1,7 +0,0 @@ -# UML - -- Đây là folder sẽ chứa các file UML của dự án -- Có thể sử dụng các công cụ sau để vẽ UML: - - [StarUML](https://staruml.io/) - - [Visual Paradigm](https://online.visual-paradigm.com/vpce/) -- Các file UML sẽ được lưu dưới dạng ảnh, và các em sửa file readme này đính kèm ảnh vào, ghi thêm giải thích nếu cần thiết \ No newline at end of file diff --git "a/Ho\303\240ng V\304\203n Ch\303\255nh/UML/sea_battle_ativity_diagram.drawio.png" "b/Ho\303\240ng V\304\203n Ch\303\255nh/UML/sea_battle_ativity_diagram.drawio.png" deleted file mode 100644 index f98436c..0000000 Binary files "a/Ho\303\240ng V\304\203n Ch\303\255nh/UML/sea_battle_ativity_diagram.drawio.png" and /dev/null differ diff --git "a/Ho\303\240ng V\304\203n Ch\303\255nh/UML/sea_battle_class_diagram.drawio.png" "b/Ho\303\240ng V\304\203n Ch\303\255nh/UML/sea_battle_class_diagram.drawio.png" deleted file mode 100644 index 8e50f77..0000000 Binary files "a/Ho\303\240ng V\304\203n Ch\303\255nh/UML/sea_battle_class_diagram.drawio.png" and /dev/null differ diff --git "a/H\303\241n H\341\273\257u \304\220\304\203ng/Product/README.md" "b/H\303\241n H\341\273\257u \304\220\304\203ng/Product/README.md" deleted file mode 100644 index d9c007b..0000000 --- "a/H\303\241n H\341\273\257u \304\220\304\203ng/Product/README.md" +++ /dev/null @@ -1,60 +0,0 @@ -# Sea Battle - -Sea Battle is a game for two players. The game is played on four grids, two for each player. The grids are typically square – usually 10×10 – and the individual squares in the grid are identified by letter and number. On one grid the player arranges ships and records the shots by the opponent. On the other grid the player records their own shots. - -The project was done by [Nguyễn Văn A](https://github.com/naa-ntu), in the course of Object Oriented Programming at [ProPTIT](https://proptit.com/). - - -## Tech Stack - -- [Java](https://www.java.com/en/) - - -## Installation - -- Clone the repo -- Open the project in your IDE -- Run the project - - -## Usage - -- Project Structure - -```bash - -├── src -│ ├── main -│ │ ├── java -│ │ │ ├── controller -│ │ │ │ ├── Controller.java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ └── ....java -│ │ │ ├── model -│ │ │ │ ├── Board.java -│ │ │ │ ├── Cell.java -│ │ │ │ ├── Game.java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ └── ....java - - -``` - -## Contributing - -Pull requests are welcome. For major changes, please open an issue first -to discuss what you would like to change. - -Please make sure to update tests as appropriate. - -## License - -[MIT](https://choosealicense.com/licenses/mit/) \ No newline at end of file diff --git "a/H\303\241n H\341\273\257u \304\220\304\203ng/Product/src/test.md" "b/H\303\241n H\341\273\257u \304\220\304\203ng/Product/src/test.md" deleted file mode 100644 index e69de29..0000000 diff --git "a/H\303\241n H\341\273\257u \304\220\304\203ng/UML/README.md" "b/H\303\241n H\341\273\257u \304\220\304\203ng/UML/README.md" deleted file mode 100644 index dd7163b..0000000 --- "a/H\303\241n H\341\273\257u \304\220\304\203ng/UML/README.md" +++ /dev/null @@ -1,5 +0,0 @@ -## UML Class Diagram -![](UML_Class_Diagram.png) - -## UML Activity Diagram -![](UML_Activity_Diagram.png) \ No newline at end of file diff --git "a/H\303\241n H\341\273\257u \304\220\304\203ng/UML/UML_Activity_Diagram.png" "b/H\303\241n H\341\273\257u \304\220\304\203ng/UML/UML_Activity_Diagram.png" deleted file mode 100644 index ef5f64b..0000000 Binary files "a/H\303\241n H\341\273\257u \304\220\304\203ng/UML/UML_Activity_Diagram.png" and /dev/null differ diff --git "a/H\303\241n H\341\273\257u \304\220\304\203ng/UML/UML_Class_Diagram.png" "b/H\303\241n H\341\273\257u \304\220\304\203ng/UML/UML_Class_Diagram.png" deleted file mode 100644 index b063b07..0000000 Binary files "a/H\303\241n H\341\273\257u \304\220\304\203ng/UML/UML_Class_Diagram.png" and /dev/null differ diff --git "a/L\303\252 \304\220\303\254nh Chuy\303\252n/Product/README.md" "b/L\303\252 \304\220\303\254nh Chuy\303\252n/Product/README.md" deleted file mode 100644 index a5bc01b..0000000 --- "a/L\303\252 \304\220\303\254nh Chuy\303\252n/Product/README.md" +++ /dev/null @@ -1,60 +0,0 @@ -# Sea Battle - -Sea Battle is a game for two players. The game is played on four grids, two for each player. The grids are typically square – usually 10×10 – and the individual squares in the grid are identified by letter and number. On one grid the player arranges ships and records the shots by the opponent. On the other grid the player records their own shots. - -The project was done by [Nguyễn Văn A](https://github.com/naa-ntu), in the course of Object Oriented Programming at [ProPTIT](https://proptit.com/). - - -## Tech Stack - -- [Java](https://www.java.com/en/) - - -## Installation - -- Clone the repo -- Open the project in your IDE -- Run the project - - -## Usage - -- Project Structure - -```bash - -├── src -│ ├── main -│ │ ├── java -│ │ │ ├── controller -│ │ │ │ ├── Controller.java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ └── ....java -│ │ │ ├── model -│ │ │ │ ├── Board.java -│ │ │ │ ├── Cell.java -│ │ │ │ ├── Game.java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ └── ....java - - -``` - -## Contributing - -Pull requests are welcome. For major changes, please open an issue first -to discuss what you would like to change. - -Please make sure to update tests as appropriate. - -## License - -[MIT](https://choosealicense.com/licenses/mit/) \ No newline at end of file diff --git "a/L\303\252 \304\220\303\254nh Chuy\303\252n/Product/src/test.md" "b/L\303\252 \304\220\303\254nh Chuy\303\252n/Product/src/test.md" deleted file mode 100644 index e69de29..0000000 diff --git "a/L\303\252 \304\220\303\254nh Chuy\303\252n/UML/Activity_Class.drawio.png" "b/L\303\252 \304\220\303\254nh Chuy\303\252n/UML/Activity_Class.drawio.png" deleted file mode 100644 index dc96901..0000000 Binary files "a/L\303\252 \304\220\303\254nh Chuy\303\252n/UML/Activity_Class.drawio.png" and /dev/null differ diff --git "a/L\303\252 \304\220\303\254nh Chuy\303\252n/UML/Class_Diagram.drawio.png" "b/L\303\252 \304\220\303\254nh Chuy\303\252n/UML/Class_Diagram.drawio.png" deleted file mode 100644 index e170b3f..0000000 Binary files "a/L\303\252 \304\220\303\254nh Chuy\303\252n/UML/Class_Diagram.drawio.png" and /dev/null differ diff --git "a/L\303\252 \304\220\303\254nh Chuy\303\252n/UML/README.md" "b/L\303\252 \304\220\303\254nh Chuy\303\252n/UML/README.md" deleted file mode 100644 index 9db701f..0000000 --- "a/L\303\252 \304\220\303\254nh Chuy\303\252n/UML/README.md" +++ /dev/null @@ -1,7 +0,0 @@ -# UML - -- Đây là folder sẽ chứa các file UML của dự án -- Có thể sử dụng các công cụ sau để vẽ UML: - - [StarUML](https://staruml.io/) - - [Visual Paradigm](https://online.visual-paradigm.com/vpce/) -- Các file UML sẽ được lưu dưới dạng ảnh, và các em sửa file readme này đính kèm ảnh vào, ghi thêm giải thích nếu cần thiết \ No newline at end of file diff --git "a/M\303\264ng Th\341\272\277 L\341\273\261c/Product/README.md" "b/M\303\264ng Th\341\272\277 L\341\273\261c/Product/README.md" deleted file mode 100644 index a5bc01b..0000000 --- "a/M\303\264ng Th\341\272\277 L\341\273\261c/Product/README.md" +++ /dev/null @@ -1,60 +0,0 @@ -# Sea Battle - -Sea Battle is a game for two players. The game is played on four grids, two for each player. The grids are typically square – usually 10×10 – and the individual squares in the grid are identified by letter and number. On one grid the player arranges ships and records the shots by the opponent. On the other grid the player records their own shots. - -The project was done by [Nguyễn Văn A](https://github.com/naa-ntu), in the course of Object Oriented Programming at [ProPTIT](https://proptit.com/). - - -## Tech Stack - -- [Java](https://www.java.com/en/) - - -## Installation - -- Clone the repo -- Open the project in your IDE -- Run the project - - -## Usage - -- Project Structure - -```bash - -├── src -│ ├── main -│ │ ├── java -│ │ │ ├── controller -│ │ │ │ ├── Controller.java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ └── ....java -│ │ │ ├── model -│ │ │ │ ├── Board.java -│ │ │ │ ├── Cell.java -│ │ │ │ ├── Game.java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ └── ....java - - -``` - -## Contributing - -Pull requests are welcome. For major changes, please open an issue first -to discuss what you would like to change. - -Please make sure to update tests as appropriate. - -## License - -[MIT](https://choosealicense.com/licenses/mit/) \ No newline at end of file diff --git "a/M\303\264ng Th\341\272\277 L\341\273\261c/Product/src/test.md" "b/M\303\264ng Th\341\272\277 L\341\273\261c/Product/src/test.md" deleted file mode 100644 index e69de29..0000000 diff --git "a/M\303\264ng Th\341\272\277 L\341\273\261c/UML/Activity diagram.jpg" "b/M\303\264ng Th\341\272\277 L\341\273\261c/UML/Activity diagram.jpg" deleted file mode 100644 index d15a61b..0000000 Binary files "a/M\303\264ng Th\341\272\277 L\341\273\261c/UML/Activity diagram.jpg" and /dev/null differ diff --git "a/M\303\264ng Th\341\272\277 L\341\273\261c/UML/Class diagram.jpg" "b/M\303\264ng Th\341\272\277 L\341\273\261c/UML/Class diagram.jpg" deleted file mode 100644 index 39b3538..0000000 Binary files "a/M\303\264ng Th\341\272\277 L\341\273\261c/UML/Class diagram.jpg" and /dev/null differ diff --git "a/M\303\264ng Th\341\272\277 L\341\273\261c/UML/README.md" "b/M\303\264ng Th\341\272\277 L\341\273\261c/UML/README.md" deleted file mode 100644 index 9db701f..0000000 --- "a/M\303\264ng Th\341\272\277 L\341\273\261c/UML/README.md" +++ /dev/null @@ -1,7 +0,0 @@ -# UML - -- Đây là folder sẽ chứa các file UML của dự án -- Có thể sử dụng các công cụ sau để vẽ UML: - - [StarUML](https://staruml.io/) - - [Visual Paradigm](https://online.visual-paradigm.com/vpce/) -- Các file UML sẽ được lưu dưới dạng ảnh, và các em sửa file readme này đính kèm ảnh vào, ghi thêm giải thích nếu cần thiết \ No newline at end of file diff --git a/Nguyen_Van_Minh_Luc/Product/README.md b/Nguyen_Van_Minh_Luc/Product/README.md new file mode 100644 index 0000000..601b1d9 --- /dev/null +++ b/Nguyen_Van_Minh_Luc/Product/README.md @@ -0,0 +1,66 @@ +# Sea Battle + +Sea Battle is a game for two players. The game is played on four grids, two for each player. The grids are typically square – usually 10×10 – and the individual squares in the grid are identified by letter and number. On one grid the player arranges ships and records the shots by the opponent. On the other grid the player records their own shots. + + +The project was done by [Nguyễn Văn Minh Lực](https://github.com/naa-ntu), in the course of Object Oriented Programming at [ProPTIT](https://proptit.com/). + + +## Tech Stack + +- [Java](https://www.java.com/en/) + + +## Installation + +- Clone the repo +- Open the project in your IDE + +## Video demo +[Video Demo Gameplay](https://www.youtube.com/watch?v=Uy3wFUvyaqA&ab_channel=LucNguyen) + +## Usage + +- Project Structure + +```bash + +├── src +│ ├── main +│ │ ├── Main.java +│ │ ├── system.java +│ ├── data +│ │ ├── FileRank.java +│ │ ├── PlayerRank.java +│ │ ├── RankComparator.java +│ │ ├── State.java +│ ├── game +│ │ ├── Bot.java +│ │ ├── CheckShoot.java +│ │ ├── GameManager.java +│ │ ├── OnePlayer.java +│ │ ├── PlaceShip.java +│ │ ├── Player.java +│ │ ├── ShowBoard.java +│ │ ├── ToaDo.java +│ │ ├── Turn.java +│ │ ├── TwoPlayer.java +│ ├── ship +│ │ ├── ListOfShips.java +│ │ ├── Ship.java +│ ├── template +│ │ ├── Template.java + + +``` + +## Contributing + +Pull requests are welcome. For major changes, please open an issue first +to discuss what you would like to change. + +Please make sure to update tests as appropriate. + +## License + +[MIT](https://choosealicense.com/licenses/mit/) \ No newline at end of file diff --git a/Nguyen_Van_Minh_Luc/Product/src/data/FileRank.java b/Nguyen_Van_Minh_Luc/Product/src/data/FileRank.java new file mode 100644 index 0000000..4831dbc --- /dev/null +++ b/Nguyen_Van_Minh_Luc/Product/src/data/FileRank.java @@ -0,0 +1,65 @@ +package data; + +import game.Player; + +import java.io.*; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +public class FileRank { + public static List rank; + + public static void loadFromFile() throws IOException + { + rank = new ArrayList(); + File f = new File("rank.txt"); + if (!f.exists()) { + f.createNewFile(); + } + FileReader fr = new FileReader(f); + BufferedReader br = new BufferedReader(fr); + while(true) { + String name = br.readLine(); + if (name == null) break; + int score = Integer.parseInt(br.readLine()); + rank.add(new PlayerRank(name, score)); + } + br.close(); fr.close(); + } + + public static void showRank(){ + System.out.printf("|%-5s|%-20s|%-5s|%n", "Rank", "Tên", "Score"); + System.out.println("|-----|--------------------|-----|"); + for(int i = 0; i < rank.size(); i++) { + System.out.printf("|%-5d|%-20s|%-5d|%n", (i + 1), rank.get(i).getName(), rank.get(i).getScore()); + } + } + public static void sortBxh() { + Collections.sort(rank, new RankComparator()); + } + + public static void updateBxh(Player player){ + for(int i = 0; i < rank.size(); i++) { + if (player.getName().equals(rank.get(i).getName())) { + if (rank.get(i).getScore() < player.getSoODaBan()) { + rank.get(i).setScore(player.getSoODaBan()); + return; + } + } + } + rank.add(new PlayerRank(player.getName(), player.getSoODaBan())); + sortBxh(); + } + + public static void saveToFile() throws IOException + { + File f = new File("rank.txt"); + FileWriter fw = new FileWriter(f); + BufferedWriter bw = new BufferedWriter(fw); + for(PlayerRank p : rank ) { + bw.write(p.getName() + "\n" + p.getScore()); + } + bw.close();fw.close(); + } +} diff --git a/Nguyen_Van_Minh_Luc/Product/src/data/PlayerRank.java b/Nguyen_Van_Minh_Luc/Product/src/data/PlayerRank.java new file mode 100644 index 0000000..96b05e9 --- /dev/null +++ b/Nguyen_Van_Minh_Luc/Product/src/data/PlayerRank.java @@ -0,0 +1,24 @@ +package data; + +public class PlayerRank { + private String name; + private int score; + + PlayerRank(){} + + PlayerRank(String name, int score) { + this.name = name; + this.score = score; + } + + public String getName() { + return name; + } + public int getScore() { + return score; + } + + public void setScore(int score) { + this.score = score; + } +} diff --git a/Nguyen_Van_Minh_Luc/Product/src/data/RankComparator.java b/Nguyen_Van_Minh_Luc/Product/src/data/RankComparator.java new file mode 100644 index 0000000..a53ed7a --- /dev/null +++ b/Nguyen_Van_Minh_Luc/Product/src/data/RankComparator.java @@ -0,0 +1,8 @@ +package data; + +public class RankComparator implements java.util.Comparator{ + @Override + public int compare(PlayerRank p1, PlayerRank p2) { + return p1.getScore() - p2.getScore(); + } +} diff --git a/Nguyen_Van_Minh_Luc/Product/src/data/State.java b/Nguyen_Van_Minh_Luc/Product/src/data/State.java new file mode 100644 index 0000000..e1323c4 --- /dev/null +++ b/Nguyen_Van_Minh_Luc/Product/src/data/State.java @@ -0,0 +1,41 @@ +package data; + +import game.Player; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.io.IOException; + +public class State { + public static Player player1, player2; + static int kichThuoc; + + public static void loadFromFile() throws IOException { + player1 = new Player(); + player2 = new Player(); + File f = new File("state.txt"); + if (!f.exists()) { + f.createNewFile(); + } + FileReader fr = new FileReader(f); + BufferedReader br = new BufferedReader(fr); + + while(true) { + String size = br.readLine(); + if (size == null) { break;} + kichThuoc = Integer.parseInt(size); + String name = br.readLine(); + player1.setName(name); + for(int i = 1; i <= kichThuoc; i++) { + String line = br.readLine(); + for(int j = 1; j <= kichThuoc; j++) { + String s = new String("" + line.charAt(0)); + player1.setBoard(s,i,j); + } + } + break; + } + br.close(); fr.close(); + } +} diff --git a/Nguyen_Van_Minh_Luc/Product/src/game/Bot.java b/Nguyen_Van_Minh_Luc/Product/src/game/Bot.java new file mode 100644 index 0000000..eb9c702 --- /dev/null +++ b/Nguyen_Van_Minh_Luc/Product/src/game/Bot.java @@ -0,0 +1,28 @@ +package game; + +public class Bot extends Player { + private Integer[][] priority; // Bảng xét mức độ ưu tiên + public int soLanBan = 0; + // Constructor + public Bot() { + priority = new Integer[21][21]; + board = new String[21][21]; + enemyBoard = new String[21][21]; + for(int i = 1; i <= 20; i++) { + for(int j = 1; j <= 20; j++) { + priority[i][j] = 0; + board[i][j] = "."; + enemyBoard[i][j] = "?"; + } + } + } + + public void updatePriority(int hoanhdo, int tungdo, int value) { + if (value == 100) priority[hoanhdo][tungdo] = value; + else priority[hoanhdo][tungdo] += 1; + } + + public Integer[][] getPriority() { + return priority; + } +} diff --git a/Nguyen_Van_Minh_Luc/Product/src/game/CheckShoot.java b/Nguyen_Van_Minh_Luc/Product/src/game/CheckShoot.java new file mode 100644 index 0000000..8723dc9 --- /dev/null +++ b/Nguyen_Van_Minh_Luc/Product/src/game/CheckShoot.java @@ -0,0 +1,61 @@ +package game; + +public class CheckShoot { + public static boolean shoot(ToaDo toado, Player player, Player enemy) { + int x = toado.getX(); + int y = toado.getY(); + player.updateSoODaBan(); + if (enemy.getBoard()[x][y].equals(".") || player.getEnemyBoard()[x][y].equals("V")||player.getEnemyBoard()[x][y].equals("X")) + { + if (enemy.getBoard()[x][y].equals(".")) + player.setEnemyBoard("X", x, y); + return false; + } + else{ + String symbol = enemy.getBoard()[x][y]; + if (symbol == "P"){ + enemy.decreasePatrolBoat1Point(); + if(enemy.getPatrolBoat1Point() == 0) { + System.out.println("Bạn đã hạ gục 1 tàu của đối thủ"); + player.updateSoTauDaPha(); + enemy.decreaseSoTauConLai(); + } + } + else if (symbol == "p"){ + enemy.decreasePatrolBoat2Point(); + if(enemy.getPatrolBoat2Point() == 0) { + System.out.println("Bạn đã hạ gục 1 tàu của đối thủ"); + player.updateSoTauDaPha(); + enemy.decreaseSoTauConLai(); + } + } + else if (symbol == "D"){ + enemy.decreaseDestroyerBoatPoint(); + if(enemy.getDestroyerBoatPoint() == 0) { + System.out.println("Bạn đã hạ gục 1 tàu của đối thủ"); + player.updateSoTauDaPha(); + enemy.decreaseSoTauConLai(); + } + } + else if (symbol == "S"){ + enemy.decreaseSubmarinePoint(); + if(enemy.getSubmarinePoint() == 0) { + System.out.println("Bạn đã hạ gục 1 tàu của đối thủ"); + player.updateSoTauDaPha(); + enemy.decreaseSoTauConLai(); + } + } + else if (symbol == "B"){ + enemy.decreaseBattleShipPoint(); + if(enemy.getBattleShipPoint() == 0) { + System.out.println("Bạn đã hạ gục 1 tàu của đối thủ"); + player.updateSoTauDaPha(); + enemy.decreaseSoTauConLai(); + } + } + enemy.setBoard("X", x, y); + player.setEnemyBoard("V", x, y); + return true; + } + } +} diff --git a/Nguyen_Van_Minh_Luc/Product/src/game/GameManager.java b/Nguyen_Van_Minh_Luc/Product/src/game/GameManager.java new file mode 100644 index 0000000..e0fbef7 --- /dev/null +++ b/Nguyen_Van_Minh_Luc/Product/src/game/GameManager.java @@ -0,0 +1,29 @@ +package game; + +import main.system; +import template.Template; +import ship.ListOfShips; + +public class GameManager { + ListOfShips ships = new ListOfShips(); + Player player1, player2; + public static int kichThuoc = 10; + + public void start() + { + Template.showBattleMenu(); + int selection = Integer.parseInt(system.scanner.nextLine()); + + System.out.println("Nhập kích thước bảng (10 -> 20): "); + kichThuoc = Integer.parseInt(system.scanner.nextLine()); + + if (selection == 1) { // Play with computer + OnePlayer onePlayer = new OnePlayer(); + onePlayer.play(); + } + else if (selection == 2) { // two player + TwoPlayer twoPlayer = new TwoPlayer(); + twoPlayer.play(); + } + } +} diff --git a/Nguyen_Van_Minh_Luc/Product/src/game/OnePlayer.java b/Nguyen_Van_Minh_Luc/Product/src/game/OnePlayer.java new file mode 100644 index 0000000..4e7ba05 --- /dev/null +++ b/Nguyen_Van_Minh_Luc/Product/src/game/OnePlayer.java @@ -0,0 +1,59 @@ +package game; + +import data.FileRank; +import main.system; +import template.Template; + +public class OnePlayer { + public void play() { + // Bot constructor + Bot bot = new Bot(); + PlaceShip.randomPlaceShip(bot); + + // Player enter information and placeship + Player player; + System.out.println("Nhập tên người chơi: "); + String name = system.scanner.nextLine(); + player = new Player(name); + + System.out.println("Người chơi " + player.getName() + " đặt tàu: "); + Template.showPlaceShipOption(); + while(true){ + int selection1 = Integer.parseInt(system.scanner.nextLine()); + if (selection1==1) { + PlaceShip.placeShip(player); + break; + } + else if (selection1==2){ + PlaceShip.randomPlaceShip((player)); + break; + } + else { + Template.enterAgain(); + } + } + ShowBoard.showBoard(player); + System.out.println("-------------------------------------------------"); + // InGame + + while(true) { + System.out.println("Lượt người chơi " + player.getName()); + Turn.turn(player, bot); + if (player.getSoTauDaPha() == 5) { + System.out.println(player.getName() + " đã giành chiến thắng"); + System.out.println("-------------------------------------------------"); + FileRank.updateBxh(player); + break; + } + System.out.println("-------------------------------------------------"); + Turn.botTurn(bot, player); + //if (bot.soLanBan == 10) return; + if (bot.getSoTauDaPha() == 5) { + System.out.println("Máy đã giành chiến thắng"); + System.out.println("-------------------------------------------------"); + return; + } + System.out.println("-------------------------------------------------"); + } + } +} diff --git a/Nguyen_Van_Minh_Luc/Product/src/game/PlaceShip.java b/Nguyen_Van_Minh_Luc/Product/src/game/PlaceShip.java new file mode 100644 index 0000000..378acdd --- /dev/null +++ b/Nguyen_Van_Minh_Luc/Product/src/game/PlaceShip.java @@ -0,0 +1,126 @@ +package game; + +import main.system; +import ship.ListOfShips; +import ship.Ship; +import template.Template; + +import java.util.Random; + +public class PlaceShip { + public static void placeShip(Player player) { + for(Ship ship : ListOfShips.list) { + ShowBoard.showBoard(player); + switch(ship.getSymbol()) { + case "P": System.out.println("Đặt Thuyền Tuần Tra thứ nhất (kích thước 1 x " + ship.getSize() + "):");break; + case "p": System.out.println("Đặt Thuyền Tuần Tra thứ hai (kích thước 1 x " + ship.getSize() + "):");break; + case "D": System.out.println("Đặt Tàu Khu Trục (kích thước 1 x " + ship.getSize() + "):");break; + case "S": System.out.println("Đặt Tàu Ngầm (kích thước 1 x " + ship.getSize() + "):");break; + case "B": System.out.println("Đặt Thiết Giáp Hạm (kích thước 1 x " + ship.getSize() + "):");break; + } + + while(true) { + int selection1; + int hoanhdo; + int tungdo; + boolean check = true; + while (true) { + System.out.println("Chọn hướng đặt tàu:"); + System.out.println("1. Ngang."); + System.out.println("2. Dọc"); + selection1 = Integer.parseInt(system.scanner.nextLine()); + if (selection1 == 1 || selection1 == 2) break; + else System.out.println("Dữ liệu không hợp lệ. Vui lòng nhập lại."); + } + + System.out.println("Nhập tọa độ điểm đầu: "); + System.out.printf("Nhập hoành độ: "); + hoanhdo = Integer.parseInt(system.scanner.nextLine()); + System.out.printf("Chọn tung độ: "); + char c = system.scanner.nextLine().charAt(0); + tungdo = c - 'A' + 1; + + if (hoanhdo < 1 || hoanhdo > GameManager.kichThuoc || tungdo < 1 || tungdo > GameManager.kichThuoc) { + Template.enterAgain(); + check = false; + } + else if (selection1 == 1) { + for(int i = 0; i < ship.getSize(); i++){ + if (tungdo + i > GameManager.kichThuoc || (player.getBoard()[hoanhdo][tungdo + i]).equals(".") == false) { + Template.enterAgain(); + check = false; + break; + } + } + } + else if (selection1 == 2) { + for(int i = 0; i < ship.getSize(); i++){ + if (hoanhdo + i > GameManager.kichThuoc || (player.getBoard()[hoanhdo + i][tungdo]).equals(".") == false) { + Template.enterAgain(); + check = false; + break; + } + } + } + if (check == false) continue; + + if (selection1 == 1) { + for(int i = 0; i < ship.getSize(); i++) + player.setBoard(ship.getSymbol(), hoanhdo, tungdo + i); + } + else { + for(int i = 0; i < ship.getSize(); i++) + player.setBoard(ship.getSymbol(), hoanhdo + i, tungdo); + } + break; + } + } + } + + private static boolean checkToaDo(int sx, Ship ship, Player player,int x, int y) { + if (x > GameManager.kichThuoc || y > GameManager.kichThuoc || x < 1 || y < 1) return false; + if (sx == 0){ + for(int i = 0; i < ship.getSize(); i++) { + if (y + i > GameManager.kichThuoc || player.getBoard()[x][y+i].equals(".") == false) { + return false; + } + } + } + else{ + for(int i = 0; i < ship.getSize(); i++) { + if (x + i > GameManager.kichThuoc || player.getBoard()[x + i][y].equals(".") == false) { + return false; + } + } + } + return true; + } + + public static void randomPlaceShip(Player player) { + for(int i = 0; i < ListOfShips.list.size(); i++) + { + while(true){ + Random generator = new Random(); + int sx = generator.nextInt(2) ; + + int x = generator.nextInt(GameManager.kichThuoc) + 1; + int y = generator.nextInt(GameManager.kichThuoc) + 1; + if (checkToaDo(sx, ListOfShips.list.get(i), player, x, y) == false) continue; + else { + if (sx == 0) { + for(int j = 0; j < ListOfShips.list.get(i).getSize(); j++) { + player.setBoard(ListOfShips.list.get(i).getSymbol(), x, y + j); + } + } + else { + for(int j = 0; j < ListOfShips.list.get(i).getSize(); j++) { + player.setBoard(ListOfShips.list.get(i).getSymbol(), x + j, y); + } + } + break; + } + } + } + + } +} diff --git a/Nguyen_Van_Minh_Luc/Product/src/game/Player.java b/Nguyen_Van_Minh_Luc/Product/src/game/Player.java new file mode 100644 index 0000000..2c98872 --- /dev/null +++ b/Nguyen_Van_Minh_Luc/Product/src/game/Player.java @@ -0,0 +1,133 @@ +package game; + +import main.system; + +public class Player { + private String name; + String[][] board; + String[][] enemyBoard; + private int soODaBan; + private int soTauDaPha; + private int soTauConLai; + private int patrolBoat1Point; + private int patrolBoat2Point; + private int destroyerBoatPoint; + private int submarinePoint; + private int battleShipPoint; + public Player(){} + public Player(String name) { + this.name = name; + board = new String[21][21]; + enemyBoard = new String[21][21]; + for(int i = 1; i <= 20; i++) + for(int j = 1; j <= 20; j++) { + board[i][j] = "."; + enemyBoard[i][j] = "?"; + } + soODaBan = 0; + soTauDaPha = 0; + soTauConLai = 5; + patrolBoat1Point = 2; + patrolBoat2Point = 2; + destroyerBoatPoint = 4; + submarinePoint = 3; + battleShipPoint = 5; + } + + public String[][] getBoard() { + return board; + } + + public String[][] getEnemyBoard() { + return enemyBoard; + } + + public String getName() { + return name; + } + + public void setBoard(String symbol, int i, int j) { + this.board[i][j] = symbol; + } + + public void setEnemyBoard(String symbol, int i, int j) { + this.enemyBoard[i][j] = symbol; + } + + public void setName(String name) { + this.name = name; + } + + public int getSoODaBan() { + return soODaBan; + } + + public int getSoTauDaPha() { + return soTauDaPha; + } + + public void updateSoODaBan() { + soODaBan++; + } + + public void updateSoTauDaPha() { + soTauDaPha++; + } + public void decreasePatrolBoat1Point() + { + patrolBoat1Point--; + } + public void decreasePatrolBoat2Point() + { + patrolBoat2Point--; + } + public void decreaseDestroyerBoatPoint() + { + destroyerBoatPoint--; + } + public void decreaseSubmarinePoint() + { + submarinePoint--; + } + public void decreaseBattleShipPoint() + { + battleShipPoint--; + } + public void decreaseSoTauConLai(){ soTauConLai--; } + + public int getSoTauConLai() { + return soTauConLai; + } + + public int getPatrolBoat1Point() { + return patrolBoat1Point; + } + + public int getDestroyerBoatPoint() { + return destroyerBoatPoint; + } + + public int getPatrolBoat2Point() { + return patrolBoat2Point; + } + + public int getSubmarinePoint() { + return submarinePoint; + } + + public int getBattleShipPoint() { + return battleShipPoint; + } + + public ToaDo toaDoShoot(){ + System.out.println("Chọn vị trí muốn khai hỏa:"); + System.out.printf("Chọn hoành độ: "); + int x = Integer.parseInt(system.scanner.nextLine()); + System.out.printf("Chọn tung độ: "); + char c = system.scanner.nextLine().charAt(0); + int y = c - 'A' + 1; + ToaDo toaDo = new ToaDo(x,y); + return toaDo; + } + +} diff --git a/Nguyen_Van_Minh_Luc/Product/src/game/ShowBoard.java b/Nguyen_Van_Minh_Luc/Product/src/game/ShowBoard.java new file mode 100644 index 0000000..4a66f56 --- /dev/null +++ b/Nguyen_Van_Minh_Luc/Product/src/game/ShowBoard.java @@ -0,0 +1,56 @@ +package game; + +public class ShowBoard { + public static void showBoard(Player player) { + System.out.printf(" "); + for(char i = 'A'; i < 'A' + GameManager.kichThuoc; i++) + { + System.out.printf("%-3c",i); + } + System.out.println(); + for(int i = 1; i <= GameManager.kichThuoc; i++) + { + System.out.printf("%-3s ",i); + for(int j = 1; j <= GameManager.kichThuoc; j+=1) + { + System.out.printf("%-3s", player.getBoard()[i][j]); + } + System.out.printf("%n"); + } + } + public static void showEnemyBoard(Player player) { + System.out.printf(" "); + for(char i = 'A'; i < 'A' + GameManager.kichThuoc; i++) + { + System.out.printf("%-3c",i); + } + System.out.println(); + for(int i = 1; i <= GameManager.kichThuoc; i++) + { + System.out.printf("%-3s ",i); + for(int j = 1; j <= GameManager.kichThuoc; j+=1) + { + System.out.printf("%-3s", player.getEnemyBoard()[i][j]); + } + System.out.printf("%n"); + } + } + public static void showBotEnemyBoards(Bot bot) { + System.out.printf(" "); + for(char i = 'A'; i < 'A' + GameManager.kichThuoc; i++) + { + System.out.printf("%-3c",i); + } + System.out.println(); + for(int i = 1; i <= GameManager.kichThuoc; i++) + { + System.out.printf("%-3s ",i); + for(int j = 1; j <= GameManager.kichThuoc; j+=1) { + if (bot.getEnemyBoard()[i][j] != "?") + System.out.printf("%-3s", bot.getEnemyBoard()[i][j]); + else System.out.printf(". "); + } + System.out.printf("%n"); + } + } +} diff --git a/Nguyen_Van_Minh_Luc/Product/src/game/ToaDo.java b/Nguyen_Van_Minh_Luc/Product/src/game/ToaDo.java new file mode 100644 index 0000000..42de0e0 --- /dev/null +++ b/Nguyen_Van_Minh_Luc/Product/src/game/ToaDo.java @@ -0,0 +1,19 @@ +package game; + +public class ToaDo { + private int x; + private int y; + + ToaDo(){} + public ToaDo(int x, int y){ + this.x = x; + this.y = y; + } + public int getY() { + return y; + } + + public int getX() { + return x; + } +} diff --git a/Nguyen_Van_Minh_Luc/Product/src/game/Turn.java b/Nguyen_Van_Minh_Luc/Product/src/game/Turn.java new file mode 100644 index 0000000..fe75f35 --- /dev/null +++ b/Nguyen_Van_Minh_Luc/Product/src/game/Turn.java @@ -0,0 +1,112 @@ +package game; + +import main.system; +import template.Template; + +import java.util.Random; + +public class Turn { + public static void turn(Player player, Player enemy) + { + // In trạng thái của người chơi + System.out.println("Số ô đã bắn ở mặt trận địch: " + player.getSoODaBan()); + System.out.println("Số tàu đã phá: " + player.getSoTauDaPha()); + System.out.println("Số tàu còn lại của người chơi: " + player.getSoTauConLai()); + System.out.println("Trạng thái tàu của " + player.getName()); + int checkKhaiHoa = 0; + while(true) + { + Template.showPlayerMenu(); + int selection = Integer.parseInt(system.scanner.nextLine()); + switch(selection) + { + case 1: ShowBoard.showBoard(player); break; + case 2: + if (checkKhaiHoa == 1) + { + System.out.println("Bạn đã khai hỏa rồi!"); + break; + } + checkKhaiHoa = 1; + while(true) { + if (player.getSoTauDaPha() == 5) { + return; + } + ShowBoard.showEnemyBoard(player); + ToaDo toaDo = player.toaDoShoot(); + boolean continueShoot = CheckShoot.shoot(toaDo, player, enemy); + if (continueShoot == false) { + System.out.println("Bạn đã bắn trượt!"); + break; + } + else { + System.out.println("Bạn đã bắn trúng!"); + } + } + break; + case 3: return; + } + } + } + + public static boolean check(int x, int y) { + if (x < 1 || x > GameManager.kichThuoc) return false; + if (y < 1 || y > GameManager.kichThuoc) return false; + return true; + } + + public static void botTurn(Bot bot, Player player) { + while(true) { + bot.soLanBan++; + //if (bot.soLanBan == 10) return; + if (bot.getSoTauDaPha() == 5) { + return; + } + int x = 0; + int y = 0; + int max = 0; + for (int i = 1; i <= GameManager.kichThuoc; i++) { + for (int j = 1; j <= GameManager.kichThuoc; j++) { + if (bot.getPriority()[i][j] < 100 && max < bot.getPriority()[i][j]) { + max = bot.getPriority()[i][j]; + x = i; + y = j; + } + } + } + boolean continueShoot; + if (x == 0 && y == 0) { + while(true){ // random until select right location to shoot + Random generator = new Random(); + x = generator.nextInt(GameManager.kichThuoc) + 1; + y = generator.nextInt(GameManager.kichThuoc) + 1; + if (bot.getPriority()[x][y] < 100) { + break; + } + } + } + ToaDo toaDo = new ToaDo(x, y); + continueShoot = CheckShoot.shoot(toaDo, bot, player); + bot.updatePriority(x,y,100); // value = 100 -> used + if (continueShoot == false) { + System.out.printf("----Bot đã bắn %d lần----%n", bot.soLanBan); + ShowBoard.showBotEnemyBoards(bot); + return; + } + else { + if (check(x-1,y) && bot.getPriority()[x-1][y] < 100) { + bot.updatePriority(x-1,y,1); + } + if (check(x+1,y) && bot.getPriority()[x+1][y] < 100) { + bot.updatePriority(x+1,y,1); + } + if (check(x,y-1) &&bot.getPriority()[x][y+1] < 100) { + bot.updatePriority(x,y-1,1); + } + if (check(x,y+1) && bot.getPriority()[x][+1] < 100) { + bot.updatePriority(x,y+1,1); + } + } + } + } +} diff --git a/Nguyen_Van_Minh_Luc/Product/src/game/TwoPlayer.java b/Nguyen_Van_Minh_Luc/Product/src/game/TwoPlayer.java new file mode 100644 index 0000000..f0add67 --- /dev/null +++ b/Nguyen_Van_Minh_Luc/Product/src/game/TwoPlayer.java @@ -0,0 +1,83 @@ +package game; +import data.FileRank; +import main.system; +import template.Template; + +public class TwoPlayer { + Player player1; + Player player2; + public void play() + { + System.out.println("Nhập tên người chơi thứ nhất: "); + String name1 = system.scanner.nextLine(); + player1 = new Player(name1); + System.out.println("Nhập tên người chơi thứ hai: "); + String name2 = system.scanner.nextLine(); + player2 = new Player(name2); + + System.out.println("-------------------------------------------------"); + + // Player 1 placeship + System.out.println("Người chơi " + player1.getName() + " đặt tàu: "); + Template.showPlaceShipOption(); + while(true){ + int selection1 = Integer.parseInt(system.scanner.nextLine()); + if (selection1==1) { + PlaceShip.placeShip(player1); + break; + } + else if (selection1==2){ + PlaceShip.randomPlaceShip((player1)); + break; + } + else { + Template.enterAgain(); + } + } + ShowBoard.showBoard(player1); + System.out.println("-------------------------------------------------"); + + // Player 2 placeship + System.out.println("Người chơi " + player2.getName() + " đặt tàu: "); + Template.showPlaceShipOption(); + while(true){ + int selection2 = Integer.parseInt(system.scanner.nextLine()); + if (selection2==1) { + PlaceShip.placeShip(player2); + break; + } + else if (selection2==2){ + PlaceShip.randomPlaceShip((player2)); + break; + } + else { + Template.enterAgain(); + } + } + ShowBoard.showBoard(player2); + System.out.println("-------------------------------------------------"); + + while(true) + { + System.out.println("Lượt người chơi " + player1.getName()); + Turn.turn(player1, player2); + if (player1.getSoTauDaPha() == 5) { + System.out.println(player1.getName() + " đã giành chiến thắng"); + System.out.println("-------------------------------------------------"); + FileRank.updateBxh(player1); + return; + } + System.out.println("-------------------------------------------------"); + System.out.println("Lượt người chơi " + player2.getName()); + Turn.turn(player2, player1); + if (player2.getSoTauDaPha() == 5) { + System.out.println(player2.getName() + " đã giành chiến thắng"); + System.out.println("-------------------------------------------------"); + FileRank.updateBxh(player2); + return; + } + System.out.println("-------------------------------------------------"); + } + } +} + diff --git a/Nguyen_Van_Minh_Luc/Product/src/main/Main.java b/Nguyen_Van_Minh_Luc/Product/src/main/Main.java new file mode 100644 index 0000000..570f454 --- /dev/null +++ b/Nguyen_Van_Minh_Luc/Product/src/main/Main.java @@ -0,0 +1,28 @@ +package main; + +import game.ShowBoard; +import template.Template; +import game.GameManager; +import data.*; + +import java.io.IOException; + +public class Main { + public static void main(String[] args) throws IOException { + Template.printSeaBattle(); + GameManager Game = new GameManager(); + FileRank.loadFromFile(); + //State.loadFromFile(); + //ShowBoard.showBoard(State.player1); + while(true){ + Template.showGameMenu(); + int selection = Integer.parseInt(system.scanner.nextLine()); + switch(selection){ + case 1 : FileRank.showRank(); break; + case 2 : Game.start(); break; + case 3 : FileRank.saveToFile(); return; + default : Template.enterAgain(); + } + } + } +} diff --git a/Nguyen_Van_Minh_Luc/Product/src/main/system.java b/Nguyen_Van_Minh_Luc/Product/src/main/system.java new file mode 100644 index 0000000..545b798 --- /dev/null +++ b/Nguyen_Van_Minh_Luc/Product/src/main/system.java @@ -0,0 +1,13 @@ +package main; + +import java.util.Scanner; + +public class system { + public static Scanner scanner = new Scanner(java.lang.System.in); + + public static void clearScreen() { + java.lang.System.out.print("\033[H\033[2J"); + java.lang.System.out.flush(); + } + +} diff --git a/Nguyen_Van_Minh_Luc/Product/src/ship/ListOfShips.java b/Nguyen_Van_Minh_Luc/Product/src/ship/ListOfShips.java new file mode 100644 index 0000000..544dc56 --- /dev/null +++ b/Nguyen_Van_Minh_Luc/Product/src/ship/ListOfShips.java @@ -0,0 +1,21 @@ +package ship; + +import java.util.ArrayList; + +public class ListOfShips { + public static ArrayList list; + private Ship patrolBoat1 = new Ship(2,"P"); + private Ship patrolBoat2 = new Ship(2,"p"); + private Ship destroyerBoat = new Ship(4,"D"); + private Ship submarineBoat = new Ship(3,"S"); + private Ship battleShip = new Ship(5,"B"); + + public ListOfShips() { + list = new ArrayList<>(); + list.add(patrolBoat1); + list.add(patrolBoat2); + list.add(destroyerBoat); + list.add(submarineBoat); + list.add(battleShip); + } +} diff --git a/Nguyen_Van_Minh_Luc/Product/src/ship/Ship.java b/Nguyen_Van_Minh_Luc/Product/src/ship/Ship.java new file mode 100644 index 0000000..d04177a --- /dev/null +++ b/Nguyen_Van_Minh_Luc/Product/src/ship/Ship.java @@ -0,0 +1,20 @@ +package ship; + +public class Ship { + private int size; + private String symbol; + public Ship(){}; + public Ship(int size, String symbol){ + this.size = size; + this.symbol = symbol; + } + + public String getSymbol() { + return symbol; + } + + public int getSize() { + return size; + } + +} diff --git a/Nguyen_Van_Minh_Luc/Product/src/template/Template.java b/Nguyen_Van_Minh_Luc/Product/src/template/Template.java new file mode 100644 index 0000000..21c87bf --- /dev/null +++ b/Nguyen_Van_Minh_Luc/Product/src/template/Template.java @@ -0,0 +1,49 @@ +package template; + +public class Template { + public static String[] listNumberIcons = {"0\uFE0F⃣","1\uFE0F⃣","2\uFE0F⃣","3\uFE0F⃣","4\uFE0F⃣","5\uFE0F⃣","6\uFE0F⃣","7\uFE0F⃣","8\uFE0F⃣","9\uFE0F⃣","\uD83D\uDD1F"}; + public static String[] listAlphaIcons = {"A","\uD83C\uDD71\uFE0F","\uD835\uDC02","\uD835\uDC03","\uD835\uDC04","\uD835\uDC05","\uD835\uDC06","\uD835\uDC07","\uD835\uDC08","\uD835\uDC09","\uD835\uDC0A","\uD835\uDC0B","\uD835\uDC0C","\uD835\uDC0D","\uD835\uDC0E","\uD835\uDC0F","\uD835\uDC10","\uD835\uDC11","\uD835\uDC12","\uD835\uDC13","\uD835\uDC14"}; + public static void showGameMenu(){ + System.out.println("MENU"); + System.out.println("1. Bảng xếp hạng."); + System.out.println("2. Ván mới."); + System.out.println("3. Thoát trò chơi."); + } + + public static void showBattleMenu(){ + System.out.println("Chế độ:"); + System.out.println("1. Chơi với máy."); + System.out.println("2. 2 người chơi."); + } + + public static void showAllShips() { + System.out.println("Có 4 loại thuyền:"); + System.out.println("2 Thuyền Tuần Tra (Patrol Boat) 1x2"); + System.out.println("1 Tàu Khu Trục (Destroyer Boat) 1x4"); + System.out.println("1 Tàu Ngầm (Submarine) 1x3"); + System.out.println("1 Thiết Giáp Hạm (Battle Ship) 1x5"); + } + + public static void showPlayerMenu() { + System.out.println("Lựa chọn của người chơi."); + System.out.println("1. Xem bảng của bản thân."); + System.out.println("2. Xem bảng của đối thủ và khai hỏa."); + System.out.println("3. Kết thúc lượt."); + } + public static void enterAgain() { + System.out.println("Dữ liệu không hợp lệ! Vui lòng nhập lại."); + } + public static void printSeaBattle() { + System.out.println("███████╗███████╗ █████╗ ██████╗ █████╗ ████████╗████████╗██╗ ███████╗"); + System.out.println("██╔════╝██╔════╝██╔══██╗ ██╔══██╗██╔══██╗╚══██╔══╝╚══██╔══╝██║ ██╔════╝"); + System.out.println("███████╗█████╗ ███████║ ██████╔╝███████║ ██║ ██║ ██║ █████╗"); + System.out.println("╚════██║██╔══╝ ██╔══██║ ██╔══██╗██╔══██║ ██║ ██║ ██║ ██╔══╝"); + System.out.println("███████║███████╗██║ ██║ ██████╔╝██║ ██║ ██║ ██║ ███████╗███████╗"); + System.out.println("╚══════╝╚══════╝╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚══════╝╚══════╝"); + } + public static void showPlaceShipOption() { + System.out.println("Có 2 lựa chọn sắp xếp tàu: "); + System.out.println("1. Tự sắp xếp."); + System.out.println("2. Sắp xếp ngẫu nhiên."); + } +} diff --git "a/Gi\303\241p Minh Hi\341\272\277u/Product/src/test.md" b/Nguyen_Van_Minh_Luc/Product/src/test.md similarity index 100% rename from "Gi\303\241p Minh Hi\341\272\277u/Product/src/test.md" rename to Nguyen_Van_Minh_Luc/Product/src/test.md diff --git "a/Gi\303\241p Minh Hi\341\272\277u/UML/README.md" b/Nguyen_Van_Minh_Luc/UML/README.md similarity index 100% rename from "Gi\303\241p Minh Hi\341\272\277u/UML/README.md" rename to Nguyen_Van_Minh_Luc/UML/README.md diff --git "a/Nguy\341\273\205n V\304\203n Minh L\341\273\261c/UML/SeaBattle_ActivityDiagram.drawio.png" b/Nguyen_Van_Minh_Luc/UML/SeaBattle_ActivityDiagram.drawio.png similarity index 100% rename from "Nguy\341\273\205n V\304\203n Minh L\341\273\261c/UML/SeaBattle_ActivityDiagram.drawio.png" rename to Nguyen_Van_Minh_Luc/UML/SeaBattle_ActivityDiagram.drawio.png diff --git "a/Nguy\341\273\205n V\304\203n Minh L\341\273\261c/UML/SeaBattle_ClassDiagram.drawio.png" b/Nguyen_Van_Minh_Luc/UML/SeaBattle_ClassDiagram.drawio.png similarity index 100% rename from "Nguy\341\273\205n V\304\203n Minh L\341\273\261c/UML/SeaBattle_ClassDiagram.drawio.png" rename to Nguyen_Van_Minh_Luc/UML/SeaBattle_ClassDiagram.drawio.png diff --git "a/Nguy\341\273\205n Danh H\303\262a/Product/README.md" "b/Nguy\341\273\205n Danh H\303\262a/Product/README.md" deleted file mode 100644 index a5bc01b..0000000 --- "a/Nguy\341\273\205n Danh H\303\262a/Product/README.md" +++ /dev/null @@ -1,60 +0,0 @@ -# Sea Battle - -Sea Battle is a game for two players. The game is played on four grids, two for each player. The grids are typically square – usually 10×10 – and the individual squares in the grid are identified by letter and number. On one grid the player arranges ships and records the shots by the opponent. On the other grid the player records their own shots. - -The project was done by [Nguyễn Văn A](https://github.com/naa-ntu), in the course of Object Oriented Programming at [ProPTIT](https://proptit.com/). - - -## Tech Stack - -- [Java](https://www.java.com/en/) - - -## Installation - -- Clone the repo -- Open the project in your IDE -- Run the project - - -## Usage - -- Project Structure - -```bash - -├── src -│ ├── main -│ │ ├── java -│ │ │ ├── controller -│ │ │ │ ├── Controller.java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ └── ....java -│ │ │ ├── model -│ │ │ │ ├── Board.java -│ │ │ │ ├── Cell.java -│ │ │ │ ├── Game.java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ └── ....java - - -``` - -## Contributing - -Pull requests are welcome. For major changes, please open an issue first -to discuss what you would like to change. - -Please make sure to update tests as appropriate. - -## License - -[MIT](https://choosealicense.com/licenses/mit/) \ No newline at end of file diff --git "a/Nguy\341\273\205n Danh H\303\262a/Product/src/test.md" "b/Nguy\341\273\205n Danh H\303\262a/Product/src/test.md" deleted file mode 100644 index e69de29..0000000 diff --git "a/Nguy\341\273\205n Danh H\303\262a/UML/ActivityDiagram.drawio.png" "b/Nguy\341\273\205n Danh H\303\262a/UML/ActivityDiagram.drawio.png" deleted file mode 100644 index f0e73f1..0000000 Binary files "a/Nguy\341\273\205n Danh H\303\262a/UML/ActivityDiagram.drawio.png" and /dev/null differ diff --git "a/Nguy\341\273\205n Danh H\303\262a/UML/ClassDiagram.png" "b/Nguy\341\273\205n Danh H\303\262a/UML/ClassDiagram.png" deleted file mode 100644 index 6ea2bc7..0000000 Binary files "a/Nguy\341\273\205n Danh H\303\262a/UML/ClassDiagram.png" and /dev/null differ diff --git "a/Nguy\341\273\205n Danh H\303\262a/UML/README.md" "b/Nguy\341\273\205n Danh H\303\262a/UML/README.md" deleted file mode 100644 index 9db701f..0000000 --- "a/Nguy\341\273\205n Danh H\303\262a/UML/README.md" +++ /dev/null @@ -1,7 +0,0 @@ -# UML - -- Đây là folder sẽ chứa các file UML của dự án -- Có thể sử dụng các công cụ sau để vẽ UML: - - [StarUML](https://staruml.io/) - - [Visual Paradigm](https://online.visual-paradigm.com/vpce/) -- Các file UML sẽ được lưu dưới dạng ảnh, và các em sửa file readme này đính kèm ảnh vào, ghi thêm giải thích nếu cần thiết \ No newline at end of file diff --git "a/Nguy\341\273\205n Ho\303\240ng Bi\303\252n/Product/README.md" "b/Nguy\341\273\205n Ho\303\240ng Bi\303\252n/Product/README.md" deleted file mode 100644 index a5bc01b..0000000 --- "a/Nguy\341\273\205n Ho\303\240ng Bi\303\252n/Product/README.md" +++ /dev/null @@ -1,60 +0,0 @@ -# Sea Battle - -Sea Battle is a game for two players. The game is played on four grids, two for each player. The grids are typically square – usually 10×10 – and the individual squares in the grid are identified by letter and number. On one grid the player arranges ships and records the shots by the opponent. On the other grid the player records their own shots. - -The project was done by [Nguyễn Văn A](https://github.com/naa-ntu), in the course of Object Oriented Programming at [ProPTIT](https://proptit.com/). - - -## Tech Stack - -- [Java](https://www.java.com/en/) - - -## Installation - -- Clone the repo -- Open the project in your IDE -- Run the project - - -## Usage - -- Project Structure - -```bash - -├── src -│ ├── main -│ │ ├── java -│ │ │ ├── controller -│ │ │ │ ├── Controller.java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ └── ....java -│ │ │ ├── model -│ │ │ │ ├── Board.java -│ │ │ │ ├── Cell.java -│ │ │ │ ├── Game.java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ └── ....java - - -``` - -## Contributing - -Pull requests are welcome. For major changes, please open an issue first -to discuss what you would like to change. - -Please make sure to update tests as appropriate. - -## License - -[MIT](https://choosealicense.com/licenses/mit/) \ No newline at end of file diff --git "a/Nguy\341\273\205n Ho\303\240ng Bi\303\252n/Product/src/test.md" "b/Nguy\341\273\205n Ho\303\240ng Bi\303\252n/Product/src/test.md" deleted file mode 100644 index e69de29..0000000 diff --git "a/Nguy\341\273\205n Ho\303\240ng Bi\303\252n/UML/README.md" "b/Nguy\341\273\205n Ho\303\240ng Bi\303\252n/UML/README.md" deleted file mode 100644 index 9db701f..0000000 --- "a/Nguy\341\273\205n Ho\303\240ng Bi\303\252n/UML/README.md" +++ /dev/null @@ -1,7 +0,0 @@ -# UML - -- Đây là folder sẽ chứa các file UML của dự án -- Có thể sử dụng các công cụ sau để vẽ UML: - - [StarUML](https://staruml.io/) - - [Visual Paradigm](https://online.visual-paradigm.com/vpce/) -- Các file UML sẽ được lưu dưới dạng ảnh, và các em sửa file readme này đính kèm ảnh vào, ghi thêm giải thích nếu cần thiết \ No newline at end of file diff --git "a/Nguy\341\273\205n Ho\303\240ng Bi\303\252n/UML/seaBattle_ActivityDiagram.drawio.png" "b/Nguy\341\273\205n Ho\303\240ng Bi\303\252n/UML/seaBattle_ActivityDiagram.drawio.png" deleted file mode 100644 index ea09869..0000000 Binary files "a/Nguy\341\273\205n Ho\303\240ng Bi\303\252n/UML/seaBattle_ActivityDiagram.drawio.png" and /dev/null differ diff --git "a/Nguy\341\273\205n Ho\303\240ng Bi\303\252n/UML/seaBattle_ClassDiagram.drawio.png" "b/Nguy\341\273\205n Ho\303\240ng Bi\303\252n/UML/seaBattle_ClassDiagram.drawio.png" deleted file mode 100644 index 603bd24..0000000 Binary files "a/Nguy\341\273\205n Ho\303\240ng Bi\303\252n/UML/seaBattle_ClassDiagram.drawio.png" and /dev/null differ diff --git "a/Nguy\341\273\205n M\341\272\241nh D\305\251ng/Product/README.md" "b/Nguy\341\273\205n M\341\272\241nh D\305\251ng/Product/README.md" deleted file mode 100644 index a5bc01b..0000000 --- "a/Nguy\341\273\205n M\341\272\241nh D\305\251ng/Product/README.md" +++ /dev/null @@ -1,60 +0,0 @@ -# Sea Battle - -Sea Battle is a game for two players. The game is played on four grids, two for each player. The grids are typically square – usually 10×10 – and the individual squares in the grid are identified by letter and number. On one grid the player arranges ships and records the shots by the opponent. On the other grid the player records their own shots. - -The project was done by [Nguyễn Văn A](https://github.com/naa-ntu), in the course of Object Oriented Programming at [ProPTIT](https://proptit.com/). - - -## Tech Stack - -- [Java](https://www.java.com/en/) - - -## Installation - -- Clone the repo -- Open the project in your IDE -- Run the project - - -## Usage - -- Project Structure - -```bash - -├── src -│ ├── main -│ │ ├── java -│ │ │ ├── controller -│ │ │ │ ├── Controller.java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ └── ....java -│ │ │ ├── model -│ │ │ │ ├── Board.java -│ │ │ │ ├── Cell.java -│ │ │ │ ├── Game.java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ └── ....java - - -``` - -## Contributing - -Pull requests are welcome. For major changes, please open an issue first -to discuss what you would like to change. - -Please make sure to update tests as appropriate. - -## License - -[MIT](https://choosealicense.com/licenses/mit/) \ No newline at end of file diff --git "a/Nguy\341\273\205n M\341\272\241nh D\305\251ng/Product/src/entities/Board.java" "b/Nguy\341\273\205n M\341\272\241nh D\305\251ng/Product/src/entities/Board.java" deleted file mode 100644 index 7f12788..0000000 --- "a/Nguy\341\273\205n M\341\272\241nh D\305\251ng/Product/src/entities/Board.java" +++ /dev/null @@ -1,141 +0,0 @@ -package entities; - -import main.Game; -import system.ClearScreen; -import system.InputManager; -import ui.TextScreen; - -import java.util.Scanner; - -import static utilz.Constants.gameConstants.*; -import static utilz.Constants.textConstants.GREEN_TEXT; -import static utilz.Constants.textConstants.RESET; - -public class Board { - private Game game; - private boolean continueTurn = true; - - public Board(Game game) { - this.game = game; - } - - public void initializeBoards(String[][] board) { - for (int i = 0; i < BOARD_SIZE; i++) { - for (int j = 0; j < BOARD_SIZE; j++) { - board[i][j] = EMPTY_BOAT; - } - } - } - - public void setupShips(String[][] board, TextScreen screen, Player player) { - int[] shipSizes = {PATROL_BOAT_SIZE, PATROL_BOAT_SIZE, DESTROYER_BOAT_SIZE, SUBMARINE_SIZE, BATTLE_SHIP_SIZE}; - String [] ships = {PATROL_BOAT, PATROL_BOAT, DESTROYER_BOAT, SUBMARINE, BATTLE_SHIP}; - String [] shipNames = {"Patrol Boat", "Patrol Boat", "Destroyer Boat", "Submarine", "Battle Ship"}; - for(int i = 0; i < shipSizes.length; i++) { - char a = 'A' + BOARD_SIZE - 1; - System.out.println(); - System.out.print(GREEN_TEXT + "Enter the beginning cell of " + shipNames[i] + " (A-" + a + ", 1-" + BOARD_SIZE + ") and direction (H/V): " + RESET); - Scanner sc = InputManager.getScanner(); - String input = sc.next().toUpperCase(); - boolean check = placeShip(board, input, shipSizes[i], ships[i]); - if(!check) { - i--; - System.out.println(); - System.out.println("Try again !!!"); - continue; - } - ClearScreen.clearConsole(); - screen.printBoard(board,player.getName()); - } - } - - private boolean placeShip(String[][] board, String input, int size, String name) { - try { - char startRow = input.charAt(0); - int startCol = Integer.parseInt(input.substring(1, input.length() - 1)); - char direction = input.charAt(input.length() - 1); - - int row = startRow - 'A'; - int col = startCol - 1; - - if (direction == 'H') { - if (col + size > BOARD_SIZE) return false; - for (int i = 0; i < size; i++) { - if (!board[row][col + i].equals(EMPTY_BOAT)) return false; - } - for (int i = 0; i < size; i++) { - board[row][col + i] = name; - } - } else if (direction == 'V') { - if (row + size > BOARD_SIZE) return false; - for (int i = 0; i < size; i++) { - if (!board[row + i][col].equals(EMPTY_BOAT)) return false; - } - for (int i = 0; i < size; i++) { - board[row + i][col] = name; - } - } else { - return false; - } - return true; - } catch (Exception e) { - return false; - } - } - - public boolean playTurn(String[][] fog, String[][] opponentBoard, Player currentPlayer) { - TextScreen.printBoard(fog, currentPlayer.getName()); - char a = 'A' + BOARD_SIZE - 1; - System.out.print(GREEN_TEXT + "Enter fire cell (A-" + a + ", 1-" + BOARD_SIZE + "): " + RESET); - Scanner sc = InputManager.getScanner(); - String input = sc.next().toUpperCase(); - try { - char rowChar = input.charAt(0); - int col = Integer.parseInt(input.substring(1)) - 1; - - int row = rowChar - 'A'; - if (fog[row][col].equals(SHOTTED_CELL) || fog[row][col].equals(DESTROYER_CELL)) { - System.out.println("You already shot a fire cell"); - continueTurn = true; - return false; - } - - if (opponentBoard[row][col].equals(PATROL_BOAT) || opponentBoard[row][col].equals(DESTROYER_BOAT) || opponentBoard[row][col].equals(SUBMARINE) || opponentBoard[row][col].equals(BATTLE_SHIP)) { - System.out.println("Bull's eye !!!"); - fog[row][col] = DESTROYER_CELL; - opponentBoard[row][col] = DESTROYER_CELL; - continueTurn = false; - } - else { - System.out.println("Miss !!!"); - fog[row][col] = SHOTTED_CELL; - continueTurn = true; - } - } catch (Exception e) { - System.out.println("Invalid input"); - continueTurn = false; - return false; - } - - return checkWin(opponentBoard); - } - - private boolean checkWin(String[][] board) { - for (int i = 0; i < BOARD_SIZE; i++) { - for (int j = 0; j < BOARD_SIZE; j++) { - if (board[i][j].equals(PATROL_BOAT) || board[i][j].equals(DESTROYER_BOAT) || board[i][j].equals(SUBMARINE) || board[i][j].equals(BATTLE_SHIP)) { - return false; - } - } - } - return true; - } - - public boolean getContinueTurn() { - return continueTurn; - } - - public void setContinueTurn(boolean continueTurn) { - this.continueTurn = continueTurn; - } -} diff --git "a/Nguy\341\273\205n M\341\272\241nh D\305\251ng/Product/src/entities/Player.java" "b/Nguy\341\273\205n M\341\272\241nh D\305\251ng/Product/src/entities/Player.java" deleted file mode 100644 index 141e0df..0000000 --- "a/Nguy\341\273\205n M\341\272\241nh D\305\251ng/Product/src/entities/Player.java" +++ /dev/null @@ -1,18 +0,0 @@ -package entities; - -public class Player { - private String name; - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - @Override - public String toString() { - return name; - } -} diff --git "a/Nguy\341\273\205n M\341\272\241nh D\305\251ng/Product/src/main/Game.java" "b/Nguy\341\273\205n M\341\272\241nh D\305\251ng/Product/src/main/Game.java" deleted file mode 100644 index db6a062..0000000 --- "a/Nguy\341\273\205n M\341\272\241nh D\305\251ng/Product/src/main/Game.java" +++ /dev/null @@ -1,124 +0,0 @@ -package main; - -import entities.Player; -import entities.Board; -import system.ClearScreen; -import ui.TextScreen; - -import static utilz.Constants.gameConstants.BOARD_SIZE; -import static utilz.Constants.textConstants.*; - -public class Game { - private Player player1; - private Player player2; - private Player currentPlayer; - private boolean isGameOver = false; - private TextScreen textScreen; - private Board board; - - private static String[][] player1Board = new String[BOARD_SIZE][BOARD_SIZE]; - private static String[][] player2Board = new String[BOARD_SIZE][BOARD_SIZE]; - private static String[][] player1Fog = new String[BOARD_SIZE][BOARD_SIZE]; - private static String[][] player2Fog = new String[BOARD_SIZE][BOARD_SIZE]; - - public Game() { - player1 = new Player(); - player2 = new Player(); - currentPlayer = player1; - textScreen = new TextScreen(this); - board = new Board(this); - - textScreen.gameTitle(); - textScreen.beginningMenu(); - - board.initializeBoards(player1Board); - board.initializeBoards(player2Board); - board.initializeBoards(player1Fog); - board.initializeBoards(player2Fog); - - ClearScreen.clearConsole(); - System.out.println("Player " + currentPlayer + " prepare turn"); - System.out.println(); - TextScreen.printBoard(player1Board,currentPlayer.getName()); - board.setupShips(player1Board, textScreen, currentPlayer); - - currentPlayer = player2; - ClearScreen.clearConsole(); - System.out.println("Player " + currentPlayer + " prepare turn"); - System.out.println(); - TextScreen.printBoard(player2Board,currentPlayer.getName()); - board.setupShips(player2Board, textScreen, currentPlayer); - - currentPlayer = player1; - switchPlayer(); - - } - - private void switchPlayer() { - while(true) { - if(currentPlayer == player1) { - ClearScreen.clearConsole(); - System.out.println(player1.getName() + " turn"); - if(board.playTurn(player1Fog, player2Board, currentPlayer)) { - System.out.println(); - System.out.println(GREEN_BACKGROUND + player1.getName() + " win !!!" + RESET); - break; - } - - if(board.getContinueTurn()) - currentPlayer = player2; - else - currentPlayer = player1; - - try { - Thread.sleep(2000); - } catch (InterruptedException e) { - e.printStackTrace(); - } - } - else { - ClearScreen.clearConsole(); - System.out.println(player2.getName() + " turn"); - if(board.playTurn(player2Fog, player1Board, currentPlayer)) { - System.out.println(GREEN_BACKGROUND + player2.getName() + " win !!!" + RESET); - break; - } - - if(board.getContinueTurn()) - currentPlayer = player1; - else - currentPlayer = player2; - - try { - Thread.sleep(2000); - } catch (InterruptedException e) { - e.printStackTrace(); - } - } - } - } - - public boolean isGameOver() { - return isGameOver; - } - - public void setGameOver(boolean gameOver) { - isGameOver = gameOver; - } - - public Player getPlayer1() { - return player1; - } - - public void setPlayer1(Player player1) { - this.player1 = player1; - } - - public Player getPlayer2() { - return player2; - } - - public void setPlayer2(Player player2) { - this.player2 = player2; - } -} diff --git "a/Nguy\341\273\205n M\341\272\241nh D\305\251ng/Product/src/main/MainClass.java" "b/Nguy\341\273\205n M\341\272\241nh D\305\251ng/Product/src/main/MainClass.java" deleted file mode 100644 index 4689699..0000000 --- "a/Nguy\341\273\205n M\341\272\241nh D\305\251ng/Product/src/main/MainClass.java" +++ /dev/null @@ -1,7 +0,0 @@ -package main; - -public class MainClass { - public static void main(String[] args) { - new Game(); - } -} diff --git "a/Nguy\341\273\205n M\341\272\241nh D\305\251ng/Product/src/system/ClearScreen.java" "b/Nguy\341\273\205n M\341\272\241nh D\305\251ng/Product/src/system/ClearScreen.java" deleted file mode 100644 index 932e628..0000000 --- "a/Nguy\341\273\205n M\341\272\241nh D\305\251ng/Product/src/system/ClearScreen.java" +++ /dev/null @@ -1,8 +0,0 @@ -package system; - -public class ClearScreen { - public static void clearConsole() { - System.out.print("\033[H\033[2J"); - System.out.flush(); - } -} diff --git "a/Nguy\341\273\205n M\341\272\241nh D\305\251ng/Product/src/system/InputManager.java" "b/Nguy\341\273\205n M\341\272\241nh D\305\251ng/Product/src/system/InputManager.java" deleted file mode 100644 index 05bf218..0000000 --- "a/Nguy\341\273\205n M\341\272\241nh D\305\251ng/Product/src/system/InputManager.java" +++ /dev/null @@ -1,17 +0,0 @@ -package system; - -import java.util.Scanner; - -public class InputManager { - private static Scanner scanner = new Scanner(System.in); - - public static Scanner getScanner() { - return scanner; - } - - public static void closeScanner() { - if (scanner != null) { - scanner.close(); - } - } -} diff --git "a/Nguy\341\273\205n M\341\272\241nh D\305\251ng/Product/src/ui/TextEffect.java" "b/Nguy\341\273\205n M\341\272\241nh D\305\251ng/Product/src/ui/TextEffect.java" deleted file mode 100644 index feb4b7a..0000000 --- "a/Nguy\341\273\205n M\341\272\241nh D\305\251ng/Product/src/ui/TextEffect.java" +++ /dev/null @@ -1,17 +0,0 @@ -package ui; - -public class TextEffect { - public static void printWithEffect(String text) { - int delay = 250; - for (char c : text.toCharArray()) { - System.out.print(c); - System.out.flush(); - try { - Thread.sleep(delay); - } catch (InterruptedException e) { - Thread.currentThread().interrupt(); - } - } - System.out.println(); - } -} diff --git "a/Nguy\341\273\205n M\341\272\241nh D\305\251ng/Product/src/ui/TextScreen.java" "b/Nguy\341\273\205n M\341\272\241nh D\305\251ng/Product/src/ui/TextScreen.java" deleted file mode 100644 index 8f516e7..0000000 --- "a/Nguy\341\273\205n M\341\272\241nh D\305\251ng/Product/src/ui/TextScreen.java" +++ /dev/null @@ -1,96 +0,0 @@ -package ui; - -import system.ClearScreen; -import system.InputManager; -import main.Game; - -import java.util.Scanner; - -import static utilz.Constants.gameConstants.*; -import static utilz.Constants.textConstants.*; - -public class TextScreen { - - private Game game; - - public TextScreen(Game game) { - this.game = game; - } - - public void gameTitle() { - String seeBattleArt = """ - %s ████████ ███████ █████ ██████ █████ ████████ ████████ ██ ███████ %s - %s ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ %s - %s ████████ █████ ███████ ██████ ███████ ██ ██ ██ █████ %s - %s ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ %s - %s ████████ ███████ ██ ██ ██████ ██ ██ ██ ██ ███████ ███████ %s - """; - System.out.printf(seeBattleArt, RED_TEXT + BOLD, RESET, YELLOW_TEXT, RESET, GREEN_TEXT, RESET, CYAN_TEXT, RESET, BLUE_TEXT, RESET); - System.out.println(); - System.out.println(BLUE_BACKGROUND + "Made by DungNguyen" + RESET); - System.out.println(); - } - - public void beginningMenu() { - System.out.println("Welcome to my game!"); - System.out.println(); - System.out.println("---MENU---"); - System.out.println("1. Play"); - System.out.println("2. Quit"); - System.out.print("Enter your choice: "); - Scanner sc = InputManager.getScanner(); - int choice = sc.nextInt(); - ClearScreen.clearConsole(); - switch (choice) { - case 1: - enterInfo(); - break; - case 2: - TextEffect.printWithEffect("Good bye !"); - game.setGameOver(true); - return; - } - } - - public static void printBoard(String[][] board, String currentPlayer) { - System.out.print(WHITE_BACKGROUND + " " + RESET); - int n = 1; - for(int i = 0; i < board.length; i++) { - if(n < 10) - System.out.print(WHITE_BACKGROUND + "|_" + n++ + "_" + RESET); - else - System.out.print(WHITE_BACKGROUND + "|_" + n++ + RESET); - } - System.out.print(WHITE_BACKGROUND + "|" + RESET); - System.out.println(); - char k = 'a'; - for(int i = 0; i < board.length; i++) { - System.out.print(WHITE_BACKGROUND + "|_" + k++ + "_|" + RESET); - for(int j = 0; j < board[i].length; j++) { - System.out.print(board[i][j] + "|"); - } - System.out.println(); - } - System.out.println(); - System.out.println("REMEMBER !!!"); - System.out.println(PATROL_BOAT + ": Patrol Boat (1x2)"); - System.out.println(DESTROYER_BOAT + ": Destroyer Boat (1x4)"); - System.out.println(SUBMARINE + ": Submarine (1x3)"); - System.out.println(BATTLE_SHIP + ": Battle Ship (1x5)"); - System.out.println(SHOTTED_CELL + ": Cell has been miss"); - System.out.println(DESTROYER_CELL + ": Cell has been destroyed"); - } - - private void enterInfo() { - Scanner sc = InputManager.getScanner(); - System.out.print("Enter player 1 name: "); - String player1Name = sc.next(); - ClearScreen.clearConsole(); - System.out.print("Enter player 2 name: "); - String player2Name = sc.next(); - ClearScreen.clearConsole(); - game.getPlayer1().setName(player1Name); - game.getPlayer2().setName(player2Name); - } - -} diff --git "a/Nguy\341\273\205n M\341\272\241nh D\305\251ng/Product/src/utilz/Constants.java" "b/Nguy\341\273\205n M\341\272\241nh D\305\251ng/Product/src/utilz/Constants.java" deleted file mode 100644 index c63c71e..0000000 --- "a/Nguy\341\273\205n M\341\272\241nh D\305\251ng/Product/src/utilz/Constants.java" +++ /dev/null @@ -1,45 +0,0 @@ -package utilz; - -public class Constants { - - public static class textConstants { - public static final String RESET = "\u001B[0m"; - public static final String BOLD = "\u001B[1m"; - - public static final String RED_TEXT = "\u001B[31m"; - public static final String GREEN_TEXT = "\u001B[32m"; - public static final String YELLOW_TEXT = "\u001B[33m"; - public static final String BLUE_TEXT = "\u001B[34m"; - public static final String CYAN_TEXT = "\u001B[36m"; - - public static final String RED_BACKGROUND = "\u001B[41m"; - public static final String GREEN_BACKGROUND = "\u001B[42m"; - public static final String YELLOW_BACKGROUND = "\u001B[43m"; - public static final String BLUE_BACKGROUND = "\u001B[44m"; - public static final String CYAN_BACKGROUND = "\u001B[46m"; - public static final String WHITE_BACKGROUND = "\u001B[47m"; - public static final String PINK_BACKGROUND = "\033[45m"; - - } - - public static class audioConstants { - //todo - } - - public static class gameConstants { - public static final int BOARD_SIZE = 10; - public static final String EMPTY_BOAT = "_0_"; - public static final String PATROL_BOAT = textConstants.BLUE_BACKGROUND + "_P_" + textConstants.RESET; - public static final String DESTROYER_BOAT = textConstants.GREEN_BACKGROUND + "_D_" + textConstants.RESET; - public static final String SUBMARINE = textConstants.CYAN_BACKGROUND + "_S_" + textConstants.RESET; - public static final String BATTLE_SHIP = textConstants.PINK_BACKGROUND + "_B_" + textConstants.RESET; - public static final String DESTROYER_CELL = textConstants.RED_BACKGROUND + "_A_" + textConstants.RESET; - public static final String SHOTTED_CELL = textConstants.YELLOW_BACKGROUND + "_B_" + textConstants.RESET; - - public static final int PATROL_BOAT_SIZE = 2; - public static final int DESTROYER_BOAT_SIZE = 4; - public static final int SUBMARINE_SIZE = 3; - public static final int BATTLE_SHIP_SIZE = 5; - - } -} diff --git "a/Nguy\341\273\205n M\341\272\241nh D\305\251ng/Product/src/utilz/LoadSave.java" "b/Nguy\341\273\205n M\341\272\241nh D\305\251ng/Product/src/utilz/LoadSave.java" deleted file mode 100644 index 4521ed2..0000000 --- "a/Nguy\341\273\205n M\341\272\241nh D\305\251ng/Product/src/utilz/LoadSave.java" +++ /dev/null @@ -1,5 +0,0 @@ -package utilz; - -public class LoadSave { - -} diff --git "a/Nguy\341\273\205n M\341\272\241nh D\305\251ng/UML/Activity Diagram.drawio.png" "b/Nguy\341\273\205n M\341\272\241nh D\305\251ng/UML/Activity Diagram.drawio.png" deleted file mode 100644 index 1523ae8..0000000 Binary files "a/Nguy\341\273\205n M\341\272\241nh D\305\251ng/UML/Activity Diagram.drawio.png" and /dev/null differ diff --git "a/Nguy\341\273\205n M\341\272\241nh D\305\251ng/UML/Class Diagram.drawio.png" "b/Nguy\341\273\205n M\341\272\241nh D\305\251ng/UML/Class Diagram.drawio.png" deleted file mode 100644 index c899e35..0000000 Binary files "a/Nguy\341\273\205n M\341\272\241nh D\305\251ng/UML/Class Diagram.drawio.png" and /dev/null differ diff --git "a/Nguy\341\273\205n M\341\272\241nh D\305\251ng/UML/README.md" "b/Nguy\341\273\205n M\341\272\241nh D\305\251ng/UML/README.md" deleted file mode 100644 index 9db701f..0000000 --- "a/Nguy\341\273\205n M\341\272\241nh D\305\251ng/UML/README.md" +++ /dev/null @@ -1,7 +0,0 @@ -# UML - -- Đây là folder sẽ chứa các file UML của dự án -- Có thể sử dụng các công cụ sau để vẽ UML: - - [StarUML](https://staruml.io/) - - [Visual Paradigm](https://online.visual-paradigm.com/vpce/) -- Các file UML sẽ được lưu dưới dạng ảnh, và các em sửa file readme này đính kèm ảnh vào, ghi thêm giải thích nếu cần thiết \ No newline at end of file diff --git "a/Nguy\341\273\205n Nam H\341\272\243i/Product/README.md" "b/Nguy\341\273\205n Nam H\341\272\243i/Product/README.md" deleted file mode 100644 index a5bc01b..0000000 --- "a/Nguy\341\273\205n Nam H\341\272\243i/Product/README.md" +++ /dev/null @@ -1,60 +0,0 @@ -# Sea Battle - -Sea Battle is a game for two players. The game is played on four grids, two for each player. The grids are typically square – usually 10×10 – and the individual squares in the grid are identified by letter and number. On one grid the player arranges ships and records the shots by the opponent. On the other grid the player records their own shots. - -The project was done by [Nguyễn Văn A](https://github.com/naa-ntu), in the course of Object Oriented Programming at [ProPTIT](https://proptit.com/). - - -## Tech Stack - -- [Java](https://www.java.com/en/) - - -## Installation - -- Clone the repo -- Open the project in your IDE -- Run the project - - -## Usage - -- Project Structure - -```bash - -├── src -│ ├── main -│ │ ├── java -│ │ │ ├── controller -│ │ │ │ ├── Controller.java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ └── ....java -│ │ │ ├── model -│ │ │ │ ├── Board.java -│ │ │ │ ├── Cell.java -│ │ │ │ ├── Game.java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ └── ....java - - -``` - -## Contributing - -Pull requests are welcome. For major changes, please open an issue first -to discuss what you would like to change. - -Please make sure to update tests as appropriate. - -## License - -[MIT](https://choosealicense.com/licenses/mit/) \ No newline at end of file diff --git "a/Nguy\341\273\205n Nam H\341\272\243i/Product/src/test.md" "b/Nguy\341\273\205n Nam H\341\272\243i/Product/src/test.md" deleted file mode 100644 index e69de29..0000000 diff --git "a/Nguy\341\273\205n Nam H\341\272\243i/UML/ActivityDiagram.png" "b/Nguy\341\273\205n Nam H\341\272\243i/UML/ActivityDiagram.png" deleted file mode 100644 index 13e2c10..0000000 Binary files "a/Nguy\341\273\205n Nam H\341\272\243i/UML/ActivityDiagram.png" and /dev/null differ diff --git "a/Nguy\341\273\205n Nam H\341\272\243i/UML/ClassDiagram.png" "b/Nguy\341\273\205n Nam H\341\272\243i/UML/ClassDiagram.png" deleted file mode 100644 index cebb9f7..0000000 Binary files "a/Nguy\341\273\205n Nam H\341\272\243i/UML/ClassDiagram.png" and /dev/null differ diff --git "a/Nguy\341\273\205n Nam H\341\272\243i/UML/README.md" "b/Nguy\341\273\205n Nam H\341\272\243i/UML/README.md" deleted file mode 100644 index 9db701f..0000000 --- "a/Nguy\341\273\205n Nam H\341\272\243i/UML/README.md" +++ /dev/null @@ -1,7 +0,0 @@ -# UML - -- Đây là folder sẽ chứa các file UML của dự án -- Có thể sử dụng các công cụ sau để vẽ UML: - - [StarUML](https://staruml.io/) - - [Visual Paradigm](https://online.visual-paradigm.com/vpce/) -- Các file UML sẽ được lưu dưới dạng ảnh, và các em sửa file readme này đính kèm ảnh vào, ghi thêm giải thích nếu cần thiết \ No newline at end of file diff --git "a/Nguy\341\273\205n Th\303\240nh Trung/Product/README.md" "b/Nguy\341\273\205n Th\303\240nh Trung/Product/README.md" deleted file mode 100644 index a5bc01b..0000000 --- "a/Nguy\341\273\205n Th\303\240nh Trung/Product/README.md" +++ /dev/null @@ -1,60 +0,0 @@ -# Sea Battle - -Sea Battle is a game for two players. The game is played on four grids, two for each player. The grids are typically square – usually 10×10 – and the individual squares in the grid are identified by letter and number. On one grid the player arranges ships and records the shots by the opponent. On the other grid the player records their own shots. - -The project was done by [Nguyễn Văn A](https://github.com/naa-ntu), in the course of Object Oriented Programming at [ProPTIT](https://proptit.com/). - - -## Tech Stack - -- [Java](https://www.java.com/en/) - - -## Installation - -- Clone the repo -- Open the project in your IDE -- Run the project - - -## Usage - -- Project Structure - -```bash - -├── src -│ ├── main -│ │ ├── java -│ │ │ ├── controller -│ │ │ │ ├── Controller.java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ └── ....java -│ │ │ ├── model -│ │ │ │ ├── Board.java -│ │ │ │ ├── Cell.java -│ │ │ │ ├── Game.java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ └── ....java - - -``` - -## Contributing - -Pull requests are welcome. For major changes, please open an issue first -to discuss what you would like to change. - -Please make sure to update tests as appropriate. - -## License - -[MIT](https://choosealicense.com/licenses/mit/) \ No newline at end of file diff --git "a/Nguy\341\273\205n Th\303\240nh Trung/Product/src/test.md" "b/Nguy\341\273\205n Th\303\240nh Trung/Product/src/test.md" deleted file mode 100644 index e69de29..0000000 diff --git "a/Nguy\341\273\205n Th\303\240nh Trung/UML/README.md" "b/Nguy\341\273\205n Th\303\240nh Trung/UML/README.md" deleted file mode 100644 index 9db701f..0000000 --- "a/Nguy\341\273\205n Th\303\240nh Trung/UML/README.md" +++ /dev/null @@ -1,7 +0,0 @@ -# UML - -- Đây là folder sẽ chứa các file UML của dự án -- Có thể sử dụng các công cụ sau để vẽ UML: - - [StarUML](https://staruml.io/) - - [Visual Paradigm](https://online.visual-paradigm.com/vpce/) -- Các file UML sẽ được lưu dưới dạng ảnh, và các em sửa file readme này đính kèm ảnh vào, ghi thêm giải thích nếu cần thiết \ No newline at end of file diff --git "a/Nguy\341\273\205n Th\303\240nh Trung/UML/SeaBattleActivityDiagram.png" "b/Nguy\341\273\205n Th\303\240nh Trung/UML/SeaBattleActivityDiagram.png" deleted file mode 100644 index 93d8dcf..0000000 Binary files "a/Nguy\341\273\205n Th\303\240nh Trung/UML/SeaBattleActivityDiagram.png" and /dev/null differ diff --git "a/Nguy\341\273\205n Th\303\240nh Trung/UML/SeaBattleClassDiagram.png" "b/Nguy\341\273\205n Th\303\240nh Trung/UML/SeaBattleClassDiagram.png" deleted file mode 100644 index abc8355..0000000 Binary files "a/Nguy\341\273\205n Th\303\240nh Trung/UML/SeaBattleClassDiagram.png" and /dev/null differ diff --git "a/Nguy\341\273\205n Tr\341\273\215ng To\303\240n/Product/README.md" "b/Nguy\341\273\205n Tr\341\273\215ng To\303\240n/Product/README.md" deleted file mode 100644 index a5bc01b..0000000 --- "a/Nguy\341\273\205n Tr\341\273\215ng To\303\240n/Product/README.md" +++ /dev/null @@ -1,60 +0,0 @@ -# Sea Battle - -Sea Battle is a game for two players. The game is played on four grids, two for each player. The grids are typically square – usually 10×10 – and the individual squares in the grid are identified by letter and number. On one grid the player arranges ships and records the shots by the opponent. On the other grid the player records their own shots. - -The project was done by [Nguyễn Văn A](https://github.com/naa-ntu), in the course of Object Oriented Programming at [ProPTIT](https://proptit.com/). - - -## Tech Stack - -- [Java](https://www.java.com/en/) - - -## Installation - -- Clone the repo -- Open the project in your IDE -- Run the project - - -## Usage - -- Project Structure - -```bash - -├── src -│ ├── main -│ │ ├── java -│ │ │ ├── controller -│ │ │ │ ├── Controller.java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ └── ....java -│ │ │ ├── model -│ │ │ │ ├── Board.java -│ │ │ │ ├── Cell.java -│ │ │ │ ├── Game.java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ └── ....java - - -``` - -## Contributing - -Pull requests are welcome. For major changes, please open an issue first -to discuss what you would like to change. - -Please make sure to update tests as appropriate. - -## License - -[MIT](https://choosealicense.com/licenses/mit/) \ No newline at end of file diff --git "a/Nguy\341\273\205n Tr\341\273\215ng To\303\240n/Product/src/test.md" "b/Nguy\341\273\205n Tr\341\273\215ng To\303\240n/Product/src/test.md" deleted file mode 100644 index e69de29..0000000 diff --git "a/Nguy\341\273\205n Tr\341\273\215ng To\303\240n/UML/README.md" "b/Nguy\341\273\205n Tr\341\273\215ng To\303\240n/UML/README.md" deleted file mode 100644 index 9db701f..0000000 --- "a/Nguy\341\273\205n Tr\341\273\215ng To\303\240n/UML/README.md" +++ /dev/null @@ -1,7 +0,0 @@ -# UML - -- Đây là folder sẽ chứa các file UML của dự án -- Có thể sử dụng các công cụ sau để vẽ UML: - - [StarUML](https://staruml.io/) - - [Visual Paradigm](https://online.visual-paradigm.com/vpce/) -- Các file UML sẽ được lưu dưới dạng ảnh, và các em sửa file readme này đính kèm ảnh vào, ghi thêm giải thích nếu cần thiết \ No newline at end of file diff --git "a/Nguy\341\273\205n Tr\341\273\215ng To\303\240n/UML/Screenshot 2024-11-18 163025.png" "b/Nguy\341\273\205n Tr\341\273\215ng To\303\240n/UML/Screenshot 2024-11-18 163025.png" deleted file mode 100644 index 894ab11..0000000 Binary files "a/Nguy\341\273\205n Tr\341\273\215ng To\303\240n/UML/Screenshot 2024-11-18 163025.png" and /dev/null differ diff --git "a/Nguy\341\273\205n Tr\341\273\215ng To\303\240n/UML/Screenshot 2024-11-18 180308.png" "b/Nguy\341\273\205n Tr\341\273\215ng To\303\240n/UML/Screenshot 2024-11-18 180308.png" deleted file mode 100644 index 4dac788..0000000 Binary files "a/Nguy\341\273\205n Tr\341\273\215ng To\303\240n/UML/Screenshot 2024-11-18 180308.png" and /dev/null differ diff --git "a/Nguy\341\273\205n Tu\341\272\245n An/Product/README.md" "b/Nguy\341\273\205n Tu\341\272\245n An/Product/README.md" deleted file mode 100644 index a5bc01b..0000000 --- "a/Nguy\341\273\205n Tu\341\272\245n An/Product/README.md" +++ /dev/null @@ -1,60 +0,0 @@ -# Sea Battle - -Sea Battle is a game for two players. The game is played on four grids, two for each player. The grids are typically square – usually 10×10 – and the individual squares in the grid are identified by letter and number. On one grid the player arranges ships and records the shots by the opponent. On the other grid the player records their own shots. - -The project was done by [Nguyễn Văn A](https://github.com/naa-ntu), in the course of Object Oriented Programming at [ProPTIT](https://proptit.com/). - - -## Tech Stack - -- [Java](https://www.java.com/en/) - - -## Installation - -- Clone the repo -- Open the project in your IDE -- Run the project - - -## Usage - -- Project Structure - -```bash - -├── src -│ ├── main -│ │ ├── java -│ │ │ ├── controller -│ │ │ │ ├── Controller.java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ └── ....java -│ │ │ ├── model -│ │ │ │ ├── Board.java -│ │ │ │ ├── Cell.java -│ │ │ │ ├── Game.java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ └── ....java - - -``` - -## Contributing - -Pull requests are welcome. For major changes, please open an issue first -to discuss what you would like to change. - -Please make sure to update tests as appropriate. - -## License - -[MIT](https://choosealicense.com/licenses/mit/) \ No newline at end of file diff --git "a/Nguy\341\273\205n Tu\341\272\245n An/Product/src/test.md" "b/Nguy\341\273\205n Tu\341\272\245n An/Product/src/test.md" deleted file mode 100644 index e69de29..0000000 diff --git "a/Nguy\341\273\205n Tu\341\272\245n An/UML/Activity Diagram.png" "b/Nguy\341\273\205n Tu\341\272\245n An/UML/Activity Diagram.png" deleted file mode 100644 index 708e7aa..0000000 Binary files "a/Nguy\341\273\205n Tu\341\272\245n An/UML/Activity Diagram.png" and /dev/null differ diff --git "a/Nguy\341\273\205n Tu\341\272\245n An/UML/Class Diagram.png" "b/Nguy\341\273\205n Tu\341\272\245n An/UML/Class Diagram.png" deleted file mode 100644 index 539e006..0000000 Binary files "a/Nguy\341\273\205n Tu\341\272\245n An/UML/Class Diagram.png" and /dev/null differ diff --git "a/Nguy\341\273\205n Tu\341\272\245n An/UML/README.md" "b/Nguy\341\273\205n Tu\341\272\245n An/UML/README.md" deleted file mode 100644 index 9db701f..0000000 --- "a/Nguy\341\273\205n Tu\341\272\245n An/UML/README.md" +++ /dev/null @@ -1,7 +0,0 @@ -# UML - -- Đây là folder sẽ chứa các file UML của dự án -- Có thể sử dụng các công cụ sau để vẽ UML: - - [StarUML](https://staruml.io/) - - [Visual Paradigm](https://online.visual-paradigm.com/vpce/) -- Các file UML sẽ được lưu dưới dạng ảnh, và các em sửa file readme này đính kèm ảnh vào, ghi thêm giải thích nếu cần thiết \ No newline at end of file diff --git "a/Nguy\341\273\205n V\304\203n A/Product/README.md" "b/Nguy\341\273\205n V\304\203n A/Product/README.md" index a5bc01b..dadba9e 100644 --- "a/Nguy\341\273\205n V\304\203n A/Product/README.md" +++ "b/Nguy\341\273\205n V\304\203n A/Product/README.md" @@ -1,6 +1,6 @@ # Sea Battle -Sea Battle is a game for two players. The game is played on four grids, two for each player. The grids are typically square – usually 10×10 – and the individual squares in the grid are identified by letter and number. On one grid the player arranges ships and records the shots by the opponent. On the other grid the player records their own shots. +Sea Battle is a game for two players. The game is played on four grids, two for each game. The grids are typically square – usually 10×10 – and the individual squares in the grid are identified by letter and number. On one grid the game arranges ships and records the shots by the opponent. On the other grid the game records their own shots. The project was done by [Nguyễn Văn A](https://github.com/naa-ntu), in the course of Object Oriented Programming at [ProPTIT](https://proptit.com/). diff --git "a/Nguy\341\273\205n V\304\203n Minh L\341\273\261c/Product/README.md" "b/Nguy\341\273\205n V\304\203n Minh L\341\273\261c/Product/README.md" deleted file mode 100644 index a5bc01b..0000000 --- "a/Nguy\341\273\205n V\304\203n Minh L\341\273\261c/Product/README.md" +++ /dev/null @@ -1,60 +0,0 @@ -# Sea Battle - -Sea Battle is a game for two players. The game is played on four grids, two for each player. The grids are typically square – usually 10×10 – and the individual squares in the grid are identified by letter and number. On one grid the player arranges ships and records the shots by the opponent. On the other grid the player records their own shots. - -The project was done by [Nguyễn Văn A](https://github.com/naa-ntu), in the course of Object Oriented Programming at [ProPTIT](https://proptit.com/). - - -## Tech Stack - -- [Java](https://www.java.com/en/) - - -## Installation - -- Clone the repo -- Open the project in your IDE -- Run the project - - -## Usage - -- Project Structure - -```bash - -├── src -│ ├── main -│ │ ├── java -│ │ │ ├── controller -│ │ │ │ ├── Controller.java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ └── ....java -│ │ │ ├── model -│ │ │ │ ├── Board.java -│ │ │ │ ├── Cell.java -│ │ │ │ ├── Game.java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ └── ....java - - -``` - -## Contributing - -Pull requests are welcome. For major changes, please open an issue first -to discuss what you would like to change. - -Please make sure to update tests as appropriate. - -## License - -[MIT](https://choosealicense.com/licenses/mit/) \ No newline at end of file diff --git "a/Nguy\341\273\205n V\304\203n Minh L\341\273\261c/Product/src/test.md" "b/Nguy\341\273\205n V\304\203n Minh L\341\273\261c/Product/src/test.md" deleted file mode 100644 index e69de29..0000000 diff --git "a/Nguy\341\273\205n V\304\203n Minh L\341\273\261c/UML/README.md" "b/Nguy\341\273\205n V\304\203n Minh L\341\273\261c/UML/README.md" deleted file mode 100644 index 9db701f..0000000 --- "a/Nguy\341\273\205n V\304\203n Minh L\341\273\261c/UML/README.md" +++ /dev/null @@ -1,7 +0,0 @@ -# UML - -- Đây là folder sẽ chứa các file UML của dự án -- Có thể sử dụng các công cụ sau để vẽ UML: - - [StarUML](https://staruml.io/) - - [Visual Paradigm](https://online.visual-paradigm.com/vpce/) -- Các file UML sẽ được lưu dưới dạng ảnh, và các em sửa file readme này đính kèm ảnh vào, ghi thêm giải thích nếu cần thiết \ No newline at end of file diff --git "a/Phan An Ph\303\272c/Product/README.md" "b/Phan An Ph\303\272c/Product/README.md" deleted file mode 100644 index a5bc01b..0000000 --- "a/Phan An Ph\303\272c/Product/README.md" +++ /dev/null @@ -1,60 +0,0 @@ -# Sea Battle - -Sea Battle is a game for two players. The game is played on four grids, two for each player. The grids are typically square – usually 10×10 – and the individual squares in the grid are identified by letter and number. On one grid the player arranges ships and records the shots by the opponent. On the other grid the player records their own shots. - -The project was done by [Nguyễn Văn A](https://github.com/naa-ntu), in the course of Object Oriented Programming at [ProPTIT](https://proptit.com/). - - -## Tech Stack - -- [Java](https://www.java.com/en/) - - -## Installation - -- Clone the repo -- Open the project in your IDE -- Run the project - - -## Usage - -- Project Structure - -```bash - -├── src -│ ├── main -│ │ ├── java -│ │ │ ├── controller -│ │ │ │ ├── Controller.java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ └── ....java -│ │ │ ├── model -│ │ │ │ ├── Board.java -│ │ │ │ ├── Cell.java -│ │ │ │ ├── Game.java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ └── ....java - - -``` - -## Contributing - -Pull requests are welcome. For major changes, please open an issue first -to discuss what you would like to change. - -Please make sure to update tests as appropriate. - -## License - -[MIT](https://choosealicense.com/licenses/mit/) \ No newline at end of file diff --git "a/Phan An Ph\303\272c/Product/src/test.md" "b/Phan An Ph\303\272c/Product/src/test.md" deleted file mode 100644 index e69de29..0000000 diff --git "a/Phan An Ph\303\272c/UML/README.md" "b/Phan An Ph\303\272c/UML/README.md" deleted file mode 100644 index 9db701f..0000000 --- "a/Phan An Ph\303\272c/UML/README.md" +++ /dev/null @@ -1,7 +0,0 @@ -# UML - -- Đây là folder sẽ chứa các file UML của dự án -- Có thể sử dụng các công cụ sau để vẽ UML: - - [StarUML](https://staruml.io/) - - [Visual Paradigm](https://online.visual-paradigm.com/vpce/) -- Các file UML sẽ được lưu dưới dạng ảnh, và các em sửa file readme này đính kèm ảnh vào, ghi thêm giải thích nếu cần thiết \ No newline at end of file diff --git "a/Phan An Ph\303\272c/UML/SeaBattle-Activity Diagram.jpg" "b/Phan An Ph\303\272c/UML/SeaBattle-Activity Diagram.jpg" deleted file mode 100644 index f4c1607..0000000 Binary files "a/Phan An Ph\303\272c/UML/SeaBattle-Activity Diagram.jpg" and /dev/null differ diff --git "a/Phan An Ph\303\272c/UML/SeaBattle-Class Diagram.jpg" "b/Phan An Ph\303\272c/UML/SeaBattle-Class Diagram.jpg" deleted file mode 100644 index 3f2d657..0000000 Binary files "a/Phan An Ph\303\272c/UML/SeaBattle-Class Diagram.jpg" and /dev/null differ diff --git "a/Ph\341\272\241m Linh Th\341\272\243o/Product/README.md" "b/Ph\341\272\241m Linh Th\341\272\243o/Product/README.md" deleted file mode 100644 index a5bc01b..0000000 --- "a/Ph\341\272\241m Linh Th\341\272\243o/Product/README.md" +++ /dev/null @@ -1,60 +0,0 @@ -# Sea Battle - -Sea Battle is a game for two players. The game is played on four grids, two for each player. The grids are typically square – usually 10×10 – and the individual squares in the grid are identified by letter and number. On one grid the player arranges ships and records the shots by the opponent. On the other grid the player records their own shots. - -The project was done by [Nguyễn Văn A](https://github.com/naa-ntu), in the course of Object Oriented Programming at [ProPTIT](https://proptit.com/). - - -## Tech Stack - -- [Java](https://www.java.com/en/) - - -## Installation - -- Clone the repo -- Open the project in your IDE -- Run the project - - -## Usage - -- Project Structure - -```bash - -├── src -│ ├── main -│ │ ├── java -│ │ │ ├── controller -│ │ │ │ ├── Controller.java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ └── ....java -│ │ │ ├── model -│ │ │ │ ├── Board.java -│ │ │ │ ├── Cell.java -│ │ │ │ ├── Game.java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ └── ....java - - -``` - -## Contributing - -Pull requests are welcome. For major changes, please open an issue first -to discuss what you would like to change. - -Please make sure to update tests as appropriate. - -## License - -[MIT](https://choosealicense.com/licenses/mit/) \ No newline at end of file diff --git "a/Ph\341\272\241m Linh Th\341\272\243o/Product/src/test.md" "b/Ph\341\272\241m Linh Th\341\272\243o/Product/src/test.md" deleted file mode 100644 index e69de29..0000000 diff --git "a/Ph\341\272\241m Linh Th\341\272\243o/UML/ActivityDiagram.drawio.png" "b/Ph\341\272\241m Linh Th\341\272\243o/UML/ActivityDiagram.drawio.png" deleted file mode 100644 index fc43e9d..0000000 Binary files "a/Ph\341\272\241m Linh Th\341\272\243o/UML/ActivityDiagram.drawio.png" and /dev/null differ diff --git "a/Ph\341\272\241m Linh Th\341\272\243o/UML/ClassDiagram.drawio.png" "b/Ph\341\272\241m Linh Th\341\272\243o/UML/ClassDiagram.drawio.png" deleted file mode 100644 index 8902a27..0000000 Binary files "a/Ph\341\272\241m Linh Th\341\272\243o/UML/ClassDiagram.drawio.png" and /dev/null differ diff --git "a/Ph\341\272\241m Mai Linh/Product/README.md" "b/Ph\341\272\241m Mai Linh/Product/README.md" deleted file mode 100644 index a5bc01b..0000000 --- "a/Ph\341\272\241m Mai Linh/Product/README.md" +++ /dev/null @@ -1,60 +0,0 @@ -# Sea Battle - -Sea Battle is a game for two players. The game is played on four grids, two for each player. The grids are typically square – usually 10×10 – and the individual squares in the grid are identified by letter and number. On one grid the player arranges ships and records the shots by the opponent. On the other grid the player records their own shots. - -The project was done by [Nguyễn Văn A](https://github.com/naa-ntu), in the course of Object Oriented Programming at [ProPTIT](https://proptit.com/). - - -## Tech Stack - -- [Java](https://www.java.com/en/) - - -## Installation - -- Clone the repo -- Open the project in your IDE -- Run the project - - -## Usage - -- Project Structure - -```bash - -├── src -│ ├── main -│ │ ├── java -│ │ │ ├── controller -│ │ │ │ ├── Controller.java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ └── ....java -│ │ │ ├── model -│ │ │ │ ├── Board.java -│ │ │ │ ├── Cell.java -│ │ │ │ ├── Game.java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ └── ....java - - -``` - -## Contributing - -Pull requests are welcome. For major changes, please open an issue first -to discuss what you would like to change. - -Please make sure to update tests as appropriate. - -## License - -[MIT](https://choosealicense.com/licenses/mit/) \ No newline at end of file diff --git "a/Ph\341\272\241m Mai Linh/Product/src/test.md" "b/Ph\341\272\241m Mai Linh/Product/src/test.md" deleted file mode 100644 index e69de29..0000000 diff --git "a/Ph\341\272\241m Mai Linh/UML/Activity Diagram.png" "b/Ph\341\272\241m Mai Linh/UML/Activity Diagram.png" deleted file mode 100644 index c444835..0000000 Binary files "a/Ph\341\272\241m Mai Linh/UML/Activity Diagram.png" and /dev/null differ diff --git "a/Ph\341\272\241m Mai Linh/UML/Class Diagram.png" "b/Ph\341\272\241m Mai Linh/UML/Class Diagram.png" deleted file mode 100644 index a6a1e00..0000000 Binary files "a/Ph\341\272\241m Mai Linh/UML/Class Diagram.png" and /dev/null differ diff --git "a/Ph\341\272\241m Mai Linh/UML/README.md" "b/Ph\341\272\241m Mai Linh/UML/README.md" deleted file mode 100644 index 9db701f..0000000 --- "a/Ph\341\272\241m Mai Linh/UML/README.md" +++ /dev/null @@ -1,7 +0,0 @@ -# UML - -- Đây là folder sẽ chứa các file UML của dự án -- Có thể sử dụng các công cụ sau để vẽ UML: - - [StarUML](https://staruml.io/) - - [Visual Paradigm](https://online.visual-paradigm.com/vpce/) -- Các file UML sẽ được lưu dưới dạng ảnh, và các em sửa file readme này đính kèm ảnh vào, ghi thêm giải thích nếu cần thiết \ No newline at end of file diff --git a/README.md b/README.md index 2cf43f9..7f4496a 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ Cấu trúc folder ```bash ├── branch develop -│ ├── Nguyễn Văn A +│ ├── Nguyễn Văn Minh Lự │ │ ├── Product | | | ├── src | | | | ├── main diff --git "a/Tr\341\272\247n H\341\272\243i Long/Product/.idea/.gitignore" "b/Tr\341\272\247n H\341\272\243i Long/Product/.idea/.gitignore" deleted file mode 100644 index 13566b8..0000000 --- "a/Tr\341\272\247n H\341\272\243i Long/Product/.idea/.gitignore" +++ /dev/null @@ -1,8 +0,0 @@ -# Default ignored files -/shelf/ -/workspace.xml -# Editor-based HTTP Client requests -/httpRequests/ -# Datasource local storage ignored files -/dataSources/ -/dataSources.local.xml diff --git "a/Tr\341\272\247n H\341\272\243i Long/Product/.idea/libraries/Code.xml" "b/Tr\341\272\247n H\341\272\243i Long/Product/.idea/libraries/Code.xml" deleted file mode 100644 index fa621a4..0000000 --- "a/Tr\341\272\247n H\341\272\243i Long/Product/.idea/libraries/Code.xml" +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git "a/Tr\341\272\247n H\341\272\243i Long/Product/.idea/misc.xml" "b/Tr\341\272\247n H\341\272\243i Long/Product/.idea/misc.xml" deleted file mode 100644 index 1b2d693..0000000 --- "a/Tr\341\272\247n H\341\272\243i Long/Product/.idea/misc.xml" +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git "a/Tr\341\272\247n H\341\272\243i Long/Product/.idea/modules.xml" "b/Tr\341\272\247n H\341\272\243i Long/Product/.idea/modules.xml" deleted file mode 100644 index f653d5e..0000000 --- "a/Tr\341\272\247n H\341\272\243i Long/Product/.idea/modules.xml" +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git "a/Tr\341\272\247n H\341\272\243i Long/Product/.idea/vcs.xml" "b/Tr\341\272\247n H\341\272\243i Long/Product/.idea/vcs.xml" deleted file mode 100644 index b2bdec2..0000000 --- "a/Tr\341\272\247n H\341\272\243i Long/Product/.idea/vcs.xml" +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git "a/Tr\341\272\247n H\341\272\243i Long/Product/Product.iml" "b/Tr\341\272\247n H\341\272\243i Long/Product/Product.iml" deleted file mode 100644 index c90834f..0000000 --- "a/Tr\341\272\247n H\341\272\243i Long/Product/Product.iml" +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git "a/Tr\341\272\247n H\341\272\243i Long/Product/README.md" "b/Tr\341\272\247n H\341\272\243i Long/Product/README.md" deleted file mode 100644 index a5bc01b..0000000 --- "a/Tr\341\272\247n H\341\272\243i Long/Product/README.md" +++ /dev/null @@ -1,60 +0,0 @@ -# Sea Battle - -Sea Battle is a game for two players. The game is played on four grids, two for each player. The grids are typically square – usually 10×10 – and the individual squares in the grid are identified by letter and number. On one grid the player arranges ships and records the shots by the opponent. On the other grid the player records their own shots. - -The project was done by [Nguyễn Văn A](https://github.com/naa-ntu), in the course of Object Oriented Programming at [ProPTIT](https://proptit.com/). - - -## Tech Stack - -- [Java](https://www.java.com/en/) - - -## Installation - -- Clone the repo -- Open the project in your IDE -- Run the project - - -## Usage - -- Project Structure - -```bash - -├── src -│ ├── main -│ │ ├── java -│ │ │ ├── controller -│ │ │ │ ├── Controller.java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ └── ....java -│ │ │ ├── model -│ │ │ │ ├── Board.java -│ │ │ │ ├── Cell.java -│ │ │ │ ├── Game.java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ └── ....java - - -``` - -## Contributing - -Pull requests are welcome. For major changes, please open an issue first -to discuss what you would like to change. - -Please make sure to update tests as appropriate. - -## License - -[MIT](https://choosealicense.com/licenses/mit/) \ No newline at end of file diff --git "a/Tr\341\272\247n H\341\272\243i Long/Product/out/production/Product/.idea/.gitignore" "b/Tr\341\272\247n H\341\272\243i Long/Product/out/production/Product/.idea/.gitignore" deleted file mode 100644 index 13566b8..0000000 --- "a/Tr\341\272\247n H\341\272\243i Long/Product/out/production/Product/.idea/.gitignore" +++ /dev/null @@ -1,8 +0,0 @@ -# Default ignored files -/shelf/ -/workspace.xml -# Editor-based HTTP Client requests -/httpRequests/ -# Datasource local storage ignored files -/dataSources/ -/dataSources.local.xml diff --git "a/Tr\341\272\247n H\341\272\243i Long/Product/out/production/Product/.idea/Code.iml" "b/Tr\341\272\247n H\341\272\243i Long/Product/out/production/Product/.idea/Code.iml" deleted file mode 100644 index b107a2d..0000000 --- "a/Tr\341\272\247n H\341\272\243i Long/Product/out/production/Product/.idea/Code.iml" +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git "a/Tr\341\272\247n H\341\272\243i Long/Product/out/production/Product/.idea/artifacts/Code_jar.xml" "b/Tr\341\272\247n H\341\272\243i Long/Product/out/production/Product/.idea/artifacts/Code_jar.xml" deleted file mode 100644 index 4ddb759..0000000 --- "a/Tr\341\272\247n H\341\272\243i Long/Product/out/production/Product/.idea/artifacts/Code_jar.xml" +++ /dev/null @@ -1,8 +0,0 @@ - - - $PROJECT_DIR$/out/artifacts/Code_jar - - - - - \ No newline at end of file diff --git "a/Tr\341\272\247n H\341\272\243i Long/Product/out/production/Product/.idea/misc.xml" "b/Tr\341\272\247n H\341\272\243i Long/Product/out/production/Product/.idea/misc.xml" deleted file mode 100644 index 1b2d693..0000000 --- "a/Tr\341\272\247n H\341\272\243i Long/Product/out/production/Product/.idea/misc.xml" +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git "a/Tr\341\272\247n H\341\272\243i Long/Product/out/production/Product/.idea/modules.xml" "b/Tr\341\272\247n H\341\272\243i Long/Product/out/production/Product/.idea/modules.xml" deleted file mode 100644 index 74258af..0000000 --- "a/Tr\341\272\247n H\341\272\243i Long/Product/out/production/Product/.idea/modules.xml" +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git "a/Tr\341\272\247n H\341\272\243i Long/Product/out/production/Product/.idea/vcs.xml" "b/Tr\341\272\247n H\341\272\243i Long/Product/out/production/Product/.idea/vcs.xml" deleted file mode 100644 index b2bdec2..0000000 --- "a/Tr\341\272\247n H\341\272\243i Long/Product/out/production/Product/.idea/vcs.xml" +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git "a/Tr\341\272\247n H\341\272\243i Long/Product/out/production/Product/META-INF/MANIFEST.MF" "b/Tr\341\272\247n H\341\272\243i Long/Product/out/production/Product/META-INF/MANIFEST.MF" deleted file mode 100644 index c89698d..0000000 --- "a/Tr\341\272\247n H\341\272\243i Long/Product/out/production/Product/META-INF/MANIFEST.MF" +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -Main-Class: game.Main - diff --git "a/Tr\341\272\247n H\341\272\243i Long/Product/out/production/Product/game/.cph/.Main.java_17aca683d2fb1ce28f25e505c04fbfaf.prob" "b/Tr\341\272\247n H\341\272\243i Long/Product/out/production/Product/game/.cph/.Main.java_17aca683d2fb1ce28f25e505c04fbfaf.prob" deleted file mode 100644 index c328ef1..0000000 --- "a/Tr\341\272\247n H\341\272\243i Long/Product/out/production/Product/game/.cph/.Main.java_17aca683d2fb1ce28f25e505c04fbfaf.prob" +++ /dev/null @@ -1 +0,0 @@ -{"name":"Local: Main","url":"d:\\Code\\ProPTIT\\Java\\Sea Battle\\Code\\game\\Main.java","tests":[{"id":1732118831096,"input":"","output":""}],"interactive":false,"memoryLimit":1024,"timeLimit":3000,"srcPath":"d:\\Code\\ProPTIT\\Java\\Sea Battle\\Code\\game\\Main.java","group":"local","local":true} \ No newline at end of file diff --git "a/Tr\341\272\247n H\341\272\243i Long/Product/out/production/Product/out/production/Code/.idea/.gitignore" "b/Tr\341\272\247n H\341\272\243i Long/Product/out/production/Product/out/production/Code/.idea/.gitignore" deleted file mode 100644 index 13566b8..0000000 --- "a/Tr\341\272\247n H\341\272\243i Long/Product/out/production/Product/out/production/Code/.idea/.gitignore" +++ /dev/null @@ -1,8 +0,0 @@ -# Default ignored files -/shelf/ -/workspace.xml -# Editor-based HTTP Client requests -/httpRequests/ -# Datasource local storage ignored files -/dataSources/ -/dataSources.local.xml diff --git "a/Tr\341\272\247n H\341\272\243i Long/Product/out/production/Product/out/production/Code/.idea/Code.iml" "b/Tr\341\272\247n H\341\272\243i Long/Product/out/production/Product/out/production/Code/.idea/Code.iml" deleted file mode 100644 index b107a2d..0000000 --- "a/Tr\341\272\247n H\341\272\243i Long/Product/out/production/Product/out/production/Code/.idea/Code.iml" +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git "a/Tr\341\272\247n H\341\272\243i Long/Product/out/production/Product/out/production/Code/.idea/artifacts/Code_jar.xml" "b/Tr\341\272\247n H\341\272\243i Long/Product/out/production/Product/out/production/Code/.idea/artifacts/Code_jar.xml" deleted file mode 100644 index 4ddb759..0000000 --- "a/Tr\341\272\247n H\341\272\243i Long/Product/out/production/Product/out/production/Code/.idea/artifacts/Code_jar.xml" +++ /dev/null @@ -1,8 +0,0 @@ - - - $PROJECT_DIR$/out/artifacts/Code_jar - - - - - \ No newline at end of file diff --git "a/Tr\341\272\247n H\341\272\243i Long/Product/out/production/Product/out/production/Code/.idea/misc.xml" "b/Tr\341\272\247n H\341\272\243i Long/Product/out/production/Product/out/production/Code/.idea/misc.xml" deleted file mode 100644 index 1b2d693..0000000 --- "a/Tr\341\272\247n H\341\272\243i Long/Product/out/production/Product/out/production/Code/.idea/misc.xml" +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git "a/Tr\341\272\247n H\341\272\243i Long/Product/out/production/Product/out/production/Code/.idea/modules.xml" "b/Tr\341\272\247n H\341\272\243i Long/Product/out/production/Product/out/production/Code/.idea/modules.xml" deleted file mode 100644 index 74258af..0000000 --- "a/Tr\341\272\247n H\341\272\243i Long/Product/out/production/Product/out/production/Code/.idea/modules.xml" +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git "a/Tr\341\272\247n H\341\272\243i Long/Product/out/production/Product/out/production/Code/.idea/vcs.xml" "b/Tr\341\272\247n H\341\272\243i Long/Product/out/production/Product/out/production/Code/.idea/vcs.xml" deleted file mode 100644 index b2bdec2..0000000 --- "a/Tr\341\272\247n H\341\272\243i Long/Product/out/production/Product/out/production/Code/.idea/vcs.xml" +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git "a/Tr\341\272\247n H\341\272\243i Long/Product/out/production/Product/out/production/Code/META-INF/MANIFEST.MF" "b/Tr\341\272\247n H\341\272\243i Long/Product/out/production/Product/out/production/Code/META-INF/MANIFEST.MF" deleted file mode 100644 index c89698d..0000000 --- "a/Tr\341\272\247n H\341\272\243i Long/Product/out/production/Product/out/production/Code/META-INF/MANIFEST.MF" +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -Main-Class: game.Main - diff --git "a/Tr\341\272\247n H\341\272\243i Long/Product/out/production/Product/out/production/Code/game/.cph/.Main.java_17aca683d2fb1ce28f25e505c04fbfaf.prob" "b/Tr\341\272\247n H\341\272\243i Long/Product/out/production/Product/out/production/Code/game/.cph/.Main.java_17aca683d2fb1ce28f25e505c04fbfaf.prob" deleted file mode 100644 index c328ef1..0000000 --- "a/Tr\341\272\247n H\341\272\243i Long/Product/out/production/Product/out/production/Code/game/.cph/.Main.java_17aca683d2fb1ce28f25e505c04fbfaf.prob" +++ /dev/null @@ -1 +0,0 @@ -{"name":"Local: Main","url":"d:\\Code\\ProPTIT\\Java\\Sea Battle\\Code\\game\\Main.java","tests":[{"id":1732118831096,"input":"","output":""}],"interactive":false,"memoryLimit":1024,"timeLimit":3000,"srcPath":"d:\\Code\\ProPTIT\\Java\\Sea Battle\\Code\\game\\Main.java","group":"local","local":true} \ No newline at end of file diff --git "a/Tr\341\272\247n H\341\272\243i Long/Product/out/production/Product/out/production/Code/test.md" "b/Tr\341\272\247n H\341\272\243i Long/Product/out/production/Product/out/production/Code/test.md" deleted file mode 100644 index e69de29..0000000 diff --git "a/Tr\341\272\247n H\341\272\243i Long/Product/out/production/Product/test.md" "b/Tr\341\272\247n H\341\272\243i Long/Product/out/production/Product/test.md" deleted file mode 100644 index e69de29..0000000 diff --git "a/Tr\341\272\247n H\341\272\243i Long/Product/src/.idea/.gitignore" "b/Tr\341\272\247n H\341\272\243i Long/Product/src/.idea/.gitignore" deleted file mode 100644 index 13566b8..0000000 --- "a/Tr\341\272\247n H\341\272\243i Long/Product/src/.idea/.gitignore" +++ /dev/null @@ -1,8 +0,0 @@ -# Default ignored files -/shelf/ -/workspace.xml -# Editor-based HTTP Client requests -/httpRequests/ -# Datasource local storage ignored files -/dataSources/ -/dataSources.local.xml diff --git "a/Tr\341\272\247n H\341\272\243i Long/Product/src/.idea/Code.iml" "b/Tr\341\272\247n H\341\272\243i Long/Product/src/.idea/Code.iml" deleted file mode 100644 index b107a2d..0000000 --- "a/Tr\341\272\247n H\341\272\243i Long/Product/src/.idea/Code.iml" +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git "a/Tr\341\272\247n H\341\272\243i Long/Product/src/.idea/artifacts/Code_jar.xml" "b/Tr\341\272\247n H\341\272\243i Long/Product/src/.idea/artifacts/Code_jar.xml" deleted file mode 100644 index 4ddb759..0000000 --- "a/Tr\341\272\247n H\341\272\243i Long/Product/src/.idea/artifacts/Code_jar.xml" +++ /dev/null @@ -1,8 +0,0 @@ - - - $PROJECT_DIR$/out/artifacts/Code_jar - - - - - \ No newline at end of file diff --git "a/Tr\341\272\247n H\341\272\243i Long/Product/src/.idea/misc.xml" "b/Tr\341\272\247n H\341\272\243i Long/Product/src/.idea/misc.xml" deleted file mode 100644 index 1b2d693..0000000 --- "a/Tr\341\272\247n H\341\272\243i Long/Product/src/.idea/misc.xml" +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git "a/Tr\341\272\247n H\341\272\243i Long/Product/src/.idea/modules.xml" "b/Tr\341\272\247n H\341\272\243i Long/Product/src/.idea/modules.xml" deleted file mode 100644 index 74258af..0000000 --- "a/Tr\341\272\247n H\341\272\243i Long/Product/src/.idea/modules.xml" +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git "a/Tr\341\272\247n H\341\272\243i Long/Product/src/.idea/vcs.xml" "b/Tr\341\272\247n H\341\272\243i Long/Product/src/.idea/vcs.xml" deleted file mode 100644 index b2bdec2..0000000 --- "a/Tr\341\272\247n H\341\272\243i Long/Product/src/.idea/vcs.xml" +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git "a/Tr\341\272\247n H\341\272\243i Long/Product/src/META-INF/MANIFEST.MF" "b/Tr\341\272\247n H\341\272\243i Long/Product/src/META-INF/MANIFEST.MF" deleted file mode 100644 index c89698d..0000000 --- "a/Tr\341\272\247n H\341\272\243i Long/Product/src/META-INF/MANIFEST.MF" +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -Main-Class: game.Main - diff --git "a/Tr\341\272\247n H\341\272\243i Long/Product/src/enums/CellStatus.java" "b/Tr\341\272\247n H\341\272\243i Long/Product/src/enums/CellStatus.java" deleted file mode 100644 index aa6556a..0000000 --- "a/Tr\341\272\247n H\341\272\243i Long/Product/src/enums/CellStatus.java" +++ /dev/null @@ -1,9 +0,0 @@ -package enums; - -public enum CellStatus { - EMPTY, - HIT, - MISS, - SHIP -} - diff --git "a/Tr\341\272\247n H\341\272\243i Long/Product/src/enums/FireResult.java" "b/Tr\341\272\247n H\341\272\243i Long/Product/src/enums/FireResult.java" deleted file mode 100644 index 87d46d2..0000000 --- "a/Tr\341\272\247n H\341\272\243i Long/Product/src/enums/FireResult.java" +++ /dev/null @@ -1,7 +0,0 @@ -package enums; - -public enum FireResult { - MISS, - HIT, - SUNK -} diff --git "a/Tr\341\272\247n H\341\272\243i Long/Product/src/enums/GameStatus.java" "b/Tr\341\272\247n H\341\272\243i Long/Product/src/enums/GameStatus.java" deleted file mode 100644 index e10cb65..0000000 --- "a/Tr\341\272\247n H\341\272\243i Long/Product/src/enums/GameStatus.java" +++ /dev/null @@ -1,7 +0,0 @@ -package enums; - -public enum GameStatus { - PREPARATION, - IN_PROGRESS, - FINISHED -} diff --git "a/Tr\341\272\247n H\341\272\243i Long/Product/src/enums/Orientation.java" "b/Tr\341\272\247n H\341\272\243i Long/Product/src/enums/Orientation.java" deleted file mode 100644 index 27324f7..0000000 --- "a/Tr\341\272\247n H\341\272\243i Long/Product/src/enums/Orientation.java" +++ /dev/null @@ -1,6 +0,0 @@ -package enums; - -public enum Orientation { - HORIZONTAL, - VERTICAL -} diff --git "a/Tr\341\272\247n H\341\272\243i Long/Product/src/enums/ShipType.java" "b/Tr\341\272\247n H\341\272\243i Long/Product/src/enums/ShipType.java" deleted file mode 100644 index 0a09361..0000000 --- "a/Tr\341\272\247n H\341\272\243i Long/Product/src/enums/ShipType.java" +++ /dev/null @@ -1,9 +0,0 @@ -package enums; - -public enum ShipType { - PATROL_BOAT, // 1x2 - DESTROYER, // 1x4 - SUBMARINE, // 1x3 - BATTLESHIP // 1x5 -} - diff --git "a/Tr\341\272\247n H\341\272\243i Long/Product/src/game/.cph/.Main.java_17aca683d2fb1ce28f25e505c04fbfaf.prob" "b/Tr\341\272\247n H\341\272\243i Long/Product/src/game/.cph/.Main.java_17aca683d2fb1ce28f25e505c04fbfaf.prob" deleted file mode 100644 index c328ef1..0000000 --- "a/Tr\341\272\247n H\341\272\243i Long/Product/src/game/.cph/.Main.java_17aca683d2fb1ce28f25e505c04fbfaf.prob" +++ /dev/null @@ -1 +0,0 @@ -{"name":"Local: Main","url":"d:\\Code\\ProPTIT\\Java\\Sea Battle\\Code\\game\\Main.java","tests":[{"id":1732118831096,"input":"","output":""}],"interactive":false,"memoryLimit":1024,"timeLimit":3000,"srcPath":"d:\\Code\\ProPTIT\\Java\\Sea Battle\\Code\\game\\Main.java","group":"local","local":true} \ No newline at end of file diff --git "a/Tr\341\272\247n H\341\272\243i Long/Product/src/game/Board.java" "b/Tr\341\272\247n H\341\272\243i Long/Product/src/game/Board.java" deleted file mode 100644 index fecf5fc..0000000 --- "a/Tr\341\272\247n H\341\272\243i Long/Product/src/game/Board.java" +++ /dev/null @@ -1,134 +0,0 @@ -package game; - -import static game.Menu.reset; - -public class Board { - public int size; - public Cell[][] cells; - String redBackground = "\u001B[41m"; - String greenBackground = "\u001B[42m"; - String yellowBackground = "\u001B[43m"; - String blueBackground = "\u001B[44m"; - String purpleBackground = "\u001B[45m"; - - public void printShip(String shipIcon, int i, int j) { - switch (cells[i][j].getShip().getType()) { - case PATROL_BOAT: - System.out.print(blueBackground + shipIcon); - break; - case DESTROYER: - System.out.print(purpleBackground + shipIcon); - break; - case SUBMARINE: - System.out.print(yellowBackground + shipIcon); - break; - case BATTLESHIP: - System.out.print(greenBackground + shipIcon); - break; - } - if (j+1>=size || cells[i][j+1].getShip() != cells[i][j].getShip()) { - System.out.print(reset); - } - System.out.print(" "); - } - - public Board(int size) { - this.size = size; - cells = new Cell[size][size]; - initializeBoard(); - } - - private void initializeBoard() { - for (int i = 0; i < size; i++) { - char x = (char) ('A' + i); - for (int j = 0; j < size; j++) { - cells[i][j] = new Cell(x, j + 1); - } - } - } - - public int getSize() { - return size; - } - - public Cell[][] getCells() { - return cells; - } - - public boolean isCoordinateValid(char x, int y) { - if (x < 'A' || x >= ('A' + size)) return false; - return y >= 1 && y <= size; - } - - public Cell getCell(char x, int y) { - if (!isCoordinateValid(x, y)) return null; - int row = x - 'A'; - int col = y - 1; - return cells[row][col]; - } - - public void displayFullBoard() { - System.out.print(" "); - for (int i = 1; i <= size; i++) System.out.print(" " + i + " "); - System.out.println(); - System.out.print(" +"); - for (int k = 1; k <= size; k++) { - System.out.print("---"); - } - System.out.println("+"); - for (int i = 0; i < size; i++) { - char x = (char) ('A' + i); - System.out.print(x + "| "); - for (int j = 0; j < size; j++) { - Cell cell = cells[i][j]; - switch (cell.getStatus()) { - case HIT: - if(cell.getShip().isSunk()) - printShip("\uD83D\uDC7B", i, j); - else System.out.print("💥 "); - break; - case MISS: - System.out.print("❌ "); - break; - case EMPTY: - System.out.print("🌊 "); - break; - case SHIP: - printShip("🚢", i, j); - } - } - System.out.println(); - } - } - - public void displayFogOfWar() { - System.out.print(" "); - for (int i = 1; i <= size; i++) System.out.print(" " + i + " "); - System.out.println(); - System.out.print(" +"); - for (int k = 1; k <= size; k++) { - System.out.print("---"); - } - System.out.println("+"); - for (int i = 0; i < size; i++) { - char x = (char) ('A' + i); - System.out.print(x + "| "); - for (int j = 0; j < size; j++) { - Cell cell = cells[i][j]; - switch (cell.getStatus()) { - case HIT: - if(cell.getShip().isSunk()) - printShip("\uD83D\uDC7B", i, j); - else System.out.print("💥 "); - break; - case MISS: - System.out.print("❌ "); - break; - default: - System.out.print("🌊 "); - } - } - System.out.println(); - } - } -} \ No newline at end of file diff --git "a/Tr\341\272\247n H\341\272\243i Long/Product/src/game/Cell.java" "b/Tr\341\272\247n H\341\272\243i Long/Product/src/game/Cell.java" deleted file mode 100644 index 1c89027..0000000 --- "a/Tr\341\272\247n H\341\272\243i Long/Product/src/game/Cell.java" +++ /dev/null @@ -1,42 +0,0 @@ -package game; - -import enums.CellStatus; - -public class Cell { - public char x; - public int y; - private CellStatus status; - private Ship ship; - public Cell(char x, int y){ - this.x = x; - this.y = y; - this.status = CellStatus.EMPTY; - this.ship = null; - } - - public char getX() { - return x; - } - - - public int getY() { - return y; - } - - public CellStatus getStatus() { - return status; - } - - public void setStatus(CellStatus status) { - this.status = status; - } - - public Ship getShip() { - return ship; - } - - public void setShip(Ship ship) { - this.ship = ship; - } -} - diff --git "a/Tr\341\272\247n H\341\272\243i Long/Product/src/game/Game.java" "b/Tr\341\272\247n H\341\272\243i Long/Product/src/game/Game.java" deleted file mode 100644 index 6e588ed..0000000 --- "a/Tr\341\272\247n H\341\272\243i Long/Product/src/game/Game.java" +++ /dev/null @@ -1,49 +0,0 @@ -package game; - -import enums.GameStatus; - -public class Game { - private Player player1; - private Player player2; - private Player currentTurn; - private GameStatus status; - - public Game(String player1Name, String player2Name, int boardSize) { - this.player1 = new Player(player1Name, boardSize); - this.player2 = new Player(player2Name, boardSize); - this.currentTurn = player1; - this.status = GameStatus.PREPARATION; - } - - public Player getPlayer1() { - return player1; - } - - public void setPlayer1(Player player1) { - this.player1 = player1; - } - - public Player getPlayer2() { - return player2; - } - - public void setPlayer2(Player player2) { - this.player2 = player2; - } - - public Player getCurrentTurn() { - return currentTurn; - } - - public void setCurrentTurn(Player currentTurn) { - this.currentTurn = currentTurn; - } - - public GameStatus getStatus() { - return status; - } - - public void setStatus(GameStatus status) { - this.status = status; - } -} diff --git "a/Tr\341\272\247n H\341\272\243i Long/Product/src/game/Leaderboard.java" "b/Tr\341\272\247n H\341\272\243i Long/Product/src/game/Leaderboard.java" deleted file mode 100644 index d5e6df6..0000000 --- "a/Tr\341\272\247n H\341\272\243i Long/Product/src/game/Leaderboard.java" +++ /dev/null @@ -1,29 +0,0 @@ -package game; - -import java.util.ArrayList; -import java.util.List; - -public class Leaderboard { - private List records; - public Leaderboard() { - records = new ArrayList<>(); - } - public void addRecord(PlayerRecord record) { - records.add(record); - } - public void display() { - if (records.isEmpty()) { - System.out.println("Hiện chưa có thành tích nào được lưu lại."); - } - else { - System.out.println("╔══════════════════════════════════════════════════════════════════════════╗"); - System.out.println("║ Bảng Xếp Hạng ║"); - System.out.println("╠══════════════════════════════════════════════════════════════════════════╣"); - System.out.printf("║ %-32s | %-17s | %-17s ║\n", "Tên Người Chơi", "Số Lượt Bắn", "Số Tàu Còn Lại"); - for (PlayerRecord record : records) { - System.out.printf("║ %-32s | %-17d | %-17d ║\n", record.getPlayerName(), record.getShotsTaken(), record.getRemainingShips()); - } - System.out.println("╚══════════════════════════════════════════════════════════════════════════╝"); - } - } -} diff --git "a/Tr\341\272\247n H\341\272\243i Long/Product/src/game/Main.java" "b/Tr\341\272\247n H\341\272\243i Long/Product/src/game/Main.java" deleted file mode 100644 index d42c3d3..0000000 --- "a/Tr\341\272\247n H\341\272\243i Long/Product/src/game/Main.java" +++ /dev/null @@ -1,45 +0,0 @@ -package game; - -import java.util.Scanner; -import gamemanager.*; - -public class Main { - public static void main(String[] args) { - Scanner scanner = new Scanner(System.in); - Menu menu = new Menu(); - Leaderboard leaderboard = new Leaderboard(); - while (true) { - menu.seaBattle(); - System.out.print("Chọn một tùy chọn: "); - int option = Integer.parseInt(scanner.nextLine()); - if (option == 1) { - System.out.print("Hãy chọn kích thước bảng: "); - int size = Integer.parseInt(scanner.nextLine()); - System.out.println("+ Vui lòng nhập tên người chơi trước khi bắt đầu +"); - System.out.print("Nhập tên người chơi 1: "); - String player1Name = scanner.nextLine(); - System.out.print("Nhập tên người chơi 2: "); - String player2Name = scanner.nextLine(); - - Game game = new Game(player1Name, player2Name, size); - BoardController boardController1 = new BoardController(game.getPlayer1().getBoard()); - BoardController boardController2 = new BoardController(game.getPlayer2().getBoard()); - PlayerFunction playerFunction1 = new PlayerFunction(boardController1); - PlayerFunction playerFunction2 = new PlayerFunction(boardController2); - GameFunction gameFunction = new GameFunction(game, leaderboard, playerFunction1, playerFunction2); - - gameFunction.startGame(); - } - else if (option == 2) { - leaderboard.display(); - System.out.println("Vui lòng nhập bất kì kí tự nào để thoát bảng xếp hạng."); - scanner.nextLine(); - } - else if (option == 0){ - System.out.println("Cảm ơn bạn đã chơi trò chơi!"); - break; - } - else System.out.println("Lựa chọn không tồn tại, vui lòng nhập lại"); - } - } -} \ No newline at end of file diff --git "a/Tr\341\272\247n H\341\272\243i Long/Product/src/game/Menu.java" "b/Tr\341\272\247n H\341\272\243i Long/Product/src/game/Menu.java" deleted file mode 100644 index 3f82b74..0000000 --- "a/Tr\341\272\247n H\341\272\243i Long/Product/src/game/Menu.java" +++ /dev/null @@ -1,97 +0,0 @@ -package game; - -public class Menu { - public static final String reset = "\u001B[0m"; - public static final String red = "\u001B[31m"; - public static final String green = "\u001B[32m"; - public static final String yellow = "\u001B[33m"; - public static final String blue = "\u001B[34m"; - public static final String purple = "\u001B[35m"; - public static final String gray = "\u001B[90m"; - public void seaBattle(){ - System.out.println(blue + - "╔════════════════════════════════════════════════════════════════════════════╗\n"+ - "║ ███████╗███████╗ █████╗ ██████╗ █████╗ ████████╗████████╗██╗ ███████╗ ║\n" + - "║ ██╔════╝██╔════╝██╔══██╗██╔══██╗██╔══██╗╚══██╔══╝╚══██╔══╝██║ ██╔════╝ ║\n" + - "║ ███████╗█████╗ ███████║██████╔╝███████║ ██║ ██║ ██║ █████╗ ║\n" + - "║ ╚════██║██╔══╝ ██╔══██║██╔══██╗██╔══██║ ██║ ██║ ██║ ██╔══╝ ║\n" + - "║ ███████║███████╗██║ ██║██████╔╝██║ ██║ ██║ ██║ ███████╗███████╗ ║\n" + - "║ ╚══════╝╚══════╝╚═╝ ╚═╝╚═════╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚══════╝╚══════╝ ║\n" + - "╠════════════════════════════════════════════════════════════════════════════╣\n" + - "║ 1. Bắt đầu trò chơi ║\n" + - "║ 2. Hiển thị bảng xếp hạng ║\n" + - "║ 0. Thoát ║\n" + - "╚════════════════════════════════════════════════════════════════════════════╝\n" + - reset); - - } - public void start(){ - String[] lines = { - " ____ _____ _ ____ _____ _ ", - "/ ___|_ _|/ \\ | _ \\_ _| |", - "\\___ \\ | | / _ \\ | |_) || | | |", - " ___) || |/ ___ \\| _ < | | |_|", - "|____/ |_/_/ \\_\\_| \\_\\|_| (_)" - }; - - for (String line : lines) { - System.out.println(yellow + line + reset); - } - } - public void end(){ - String[] lines = { - " _____ _ _ ____ _ ", - "| ____| \\ | | _ \\| |", - "| _| | \\| | | | | |", - "| |___| |\\ | |_| |_|", - "|_____|_| \\_|____/(_)" - }; - - for (String line : lines) { - System.out.println(purple + line + reset); - } - } - - public void hit(){ - String[] lines = { - " __ __ __ .___________. __ ", - "| | | | | | | || |", - "| |__| | | | `---| |----`| |", - "| __ | | | | | | |", - "| | | | | | | | |__|", - "|__| |__| |__| |__| (__)" - }; - - for (String line : lines) { - System.out.println(red + line + reset); - } - } - public void miss(){ - String[] lines = { - ".___ ___. __ _______. _______.", - "| \\/ | | | / | / |", - "| \\ / | | | | (----` | (----`", - "| |\\/| | | | \\ \\ \\ \\ ", - "| | | | | | .----) | .----) | ", - "|__| |__| |__| |_______/ |_______/ " - }; - for (String line : lines) { - System.out.println(gray + line + reset); - } - } - public void sunk(){ - String[] lines = { - " _______. __ __ .__ __. __ ___ __ __ __ ", - " / || | | | | \\ | | | |/ / | | | | | |", - " | (----`| | | | | \\| | | ' / | | | | | |", - " \\ \\ | | | | | . ` | | < | | | | | |", - ".----) | | `--' | | |\\ | | . \\ |__| |__| |__|", - "|_______/ \\______/ |__| \\__| |__|\\__\\ (__) (__) (__)" - }; - - for (String line : lines) { - System.out.println(yellow + line + reset); - } - } - -} diff --git "a/Tr\341\272\247n H\341\272\243i Long/Product/src/game/Player.java" "b/Tr\341\272\247n H\341\272\243i Long/Product/src/game/Player.java" deleted file mode 100644 index c95a68d..0000000 --- "a/Tr\341\272\247n H\341\272\243i Long/Product/src/game/Player.java" +++ /dev/null @@ -1,61 +0,0 @@ -package game; - -import java.util.List; -import java.util.ArrayList; - -import enums.ShipType; -import enums.CellStatus; - -public class Player { - public String name; - public Board board; - public List ships; - public Player(String name, int boardSize) { - this.name = name; - this.board = new Board(boardSize); - this.ships = new ArrayList<>(); - initializeShips(); - } - - private void initializeShips() { - ships.add(new Ship(ShipType.PATROL_BOAT)); - ships.add(new Ship(ShipType.PATROL_BOAT)); -// ships.add(new Ship(ShipType.DESTROYER)); -// ships.add(new Ship(ShipType.SUBMARINE)); -// ships.add(new Ship(ShipType.BATTLESHIP)); - } - - public String getName() { - return name; - } - - public Board getBoard() { - return board; - } - - public List getShips() { - return ships; - } - - public int getHits() { - int hits = 0; - for (Ship ship : ships) { - hits += (int) ship.getCells().stream().filter(c -> c.getStatus() == CellStatus.HIT).count(); - } - return hits; - } - - public int getSunkShips() { - int sunk = 0; - for (Ship ship : ships) { - if (ship.isSunk()) { - sunk++; - } - } - return sunk; - } - - public int getRemainingShips() { - return ships.size()-getSunkShips(); - } -} diff --git "a/Tr\341\272\247n H\341\272\243i Long/Product/src/game/PlayerRecord.java" "b/Tr\341\272\247n H\341\272\243i Long/Product/src/game/PlayerRecord.java" deleted file mode 100644 index 4b1e8ef..0000000 --- "a/Tr\341\272\247n H\341\272\243i Long/Product/src/game/PlayerRecord.java" +++ /dev/null @@ -1,25 +0,0 @@ -package game; - -public class PlayerRecord { - public String playerName; - public int shotsTaken; - public int remainingShips; - - public PlayerRecord(String playerName, int shotsTaken, int remainingShips) { - this.playerName = playerName; - this.shotsTaken = shotsTaken; - this.remainingShips = remainingShips; - } - - public String getPlayerName() { - return playerName; - } - - public int getShotsTaken() { - return shotsTaken; - } - - public int getRemainingShips() { - return remainingShips; - } -} diff --git "a/Tr\341\272\247n H\341\272\243i Long/Product/src/game/Ship.java" "b/Tr\341\272\247n H\341\272\243i Long/Product/src/game/Ship.java" deleted file mode 100644 index 7df6eaa..0000000 --- "a/Tr\341\272\247n H\341\272\243i Long/Product/src/game/Ship.java" +++ /dev/null @@ -1,76 +0,0 @@ -package game; - -import java.util.ArrayList; -import java.util.List; - -import enums.ShipType; -import enums.CellStatus; - -public class Ship { - private ShipType type; - private int size; - private List cells; - private int hits; - - private int getSizeByType(ShipType type) { - return switch (type) { - case PATROL_BOAT -> 2; - case DESTROYER -> 4; - case SUBMARINE -> 3; - case BATTLESHIP -> 5; - }; - } - - public Ship(ShipType type) { - this.type = type; - this.size = getSizeByType(type); - this.cells = new ArrayList<>(); - this.hits = 0; - } - - public ShipType getType() { - return type; - } - - public void setType(ShipType type) { - this.type = type; - } - - public int getSize() { - return size; - } - - public void setSize(int size) { - this.size = size; - } - - public List getCells() { - return cells; - } - - public void setCells(List cells) { - this.cells = cells; - } - - public int getHits() { - return hits; - } - - public void setHits(int hits) { - this.hits = hits; - } - - public void addCell(Cell cell) { - cells.add(cell); - cell.setShip(this); - cell.setStatus(CellStatus.SHIP); - } - - public void takeHit() { - hits++; - } - - public boolean isSunk() { - return hits == size; - } -} diff --git "a/Tr\341\272\247n H\341\272\243i Long/Product/src/gamemanager/BoardController.java" "b/Tr\341\272\247n H\341\272\243i Long/Product/src/gamemanager/BoardController.java" deleted file mode 100644 index 55197de..0000000 --- "a/Tr\341\272\247n H\341\272\243i Long/Product/src/gamemanager/BoardController.java" +++ /dev/null @@ -1,62 +0,0 @@ -package gamemanager; - -import game.*; -import enums.*; - -public class BoardController { - public Board board; - - public BoardController(Board board) { - this.board = board; - } - - public boolean placeShip(Ship ship, Cell start, Orientation orientation) { - int dx = 0, dy = 0; - if (orientation == Orientation.HORIZONTAL) - dy = 1; - else - dx = 1; - - int row = start.getX() - 'A'; - int col = start.getY() - 1; - - int endRow = row + dx * (ship.getSize() - 1); - int endCol = col + dy * (ship.getSize() - 1); - if (endRow >= board.getSize() || endCol >= board.getSize()) { - return false; - } - - Cell[][] cells = board.getCells(); - for (int i = 0; i < ship.getSize(); i++) { - int currentRow = row + dx * i; - int currentCol = col + dy * i; - if (cells[currentRow][currentCol].getStatus() != CellStatus.EMPTY) { - return false; - } - } - - for (int i = 0; i < ship.getSize(); i++) { - int currentRow = row + dx * i; - int currentCol = col + dy * i; - Cell cell = cells[currentRow][currentCol]; - ship.addCell(cell); - } - - return true; - } - - public FireResult fireAt(Cell target) { - if (target.getStatus() == CellStatus.SHIP) { - target.setStatus(CellStatus.HIT); - Ship ship = target.getShip(); - ship.takeHit(); - if (ship.isSunk()) { - return FireResult.SUNK; - } - return FireResult.HIT; - } else { - target.setStatus(CellStatus.MISS); - return FireResult.MISS; - } - } -} \ No newline at end of file diff --git "a/Tr\341\272\247n H\341\272\243i Long/Product/src/gamemanager/GameFunction.java" "b/Tr\341\272\247n H\341\272\243i Long/Product/src/gamemanager/GameFunction.java" deleted file mode 100644 index 7174c7c..0000000 --- "a/Tr\341\272\247n H\341\272\243i Long/Product/src/gamemanager/GameFunction.java" +++ /dev/null @@ -1,105 +0,0 @@ -package gamemanager; - -import game.*; -import enums.FireResult; -import enums.GameStatus; - - -public class GameFunction { - public Game game; - public PlayerFunction playerFunction1; - public PlayerFunction playerFunction2; - public Menu menu; - public Leaderboard leaderboard; - - public GameFunction(Game game, Leaderboard leaderboard, PlayerFunction playerFunction1, PlayerFunction playerFunction2) { - this.game = game; - this.leaderboard = leaderboard; - this.playerFunction1 = playerFunction1; - this.playerFunction2 = playerFunction2; - this.menu = new Menu(); - } - - public void startGame() { - ready(); - int turn=0; - while (game.getStatus() == GameStatus.IN_PROGRESS) { - ++turn; - Player currentTurn = game.getCurrentTurn(); - Player opponent = (currentTurn == game.getPlayer1()) ? game.getPlayer2() : game.getPlayer1(); - System.out.println("Lượt bắn của " + currentTurn.getName() + " sẽ bắt đầu sau 3 giây, hãy sẵn sàng!"); - clearScreen(3); - PlayerFunction currentPlayerFunction = (currentTurn == game.getPlayer1()) ? playerFunction1 : playerFunction2; - while (true){ - status(currentTurn, opponent); - FireResult result = currentPlayerFunction.fireAt(currentTurn, opponent); - switch (result) { - case HIT: - menu.hit(); - break; - case MISS: - menu.miss(); - break; - case SUNK: - menu.sunk(); - break; - } - if (result == FireResult.MISS) { - break; - } - - if (opponent.getRemainingShips() == 0) { - end(currentTurn, turn); - break; - } - System.out.println("Bạn đã trúng tàu địch, bạn được bắn thêm lần nữa!"); - sleep(1000); - } - game.setCurrentTurn(opponent); - } - } - - public static void sleep(int milliseconds) { - try { - Thread.sleep(milliseconds); - } catch (InterruptedException e) { - Thread.currentThread().interrupt(); - } - } - - private void clearScreen(int seconds) { - sleep(seconds*1000); - System.out.print("\033[H\033[2J"); - System.out.flush(); - } - - public void ready() { - menu.start(); - clearScreen(1); - playerFunction1.placeShips(game.getPlayer1()); - playerFunction2.placeShips(game.getPlayer2()); - game.setStatus(GameStatus.IN_PROGRESS); - System.out.println("===== Khai màn trận chiến ====="); - } - - public void status(Player currentTurn, Player opponent) { - System.out.println("\n===== Lượt của " + currentTurn.getName() + " ====="); - System.out.println("Số tàu còn lại của địch: " + opponent.getRemainingShips()); - System.out.println("Số lần bắn trúng tàu địch: " + opponent.getHits()); - System.out.println("Số tàu của bạn đã bị phá hủy: " + currentTurn.getSunkShips()); - System.out.println("===== Bảng của " + currentTurn.getName() + " ====="); - currentTurn.getBoard().displayFullBoard(); - System.out.println("===== Bảng sương mù của " + opponent.getName() + " ====="); - opponent.getBoard().displayFogOfWar(); - } - - public void end(Player currentTurn, int turn){ - clearScreen(1); - game.setStatus(GameStatus.FINISHED); - menu.end(); - System.out.println(currentTurn.getName() + " chiến thắng!"); - System.out.println("Màn hình chính sẽ được mở sau 3s."); - clearScreen(3); - leaderboard.addRecord(new PlayerRecord(currentTurn.getName(), turn, currentTurn.getRemainingShips())); - } -} \ No newline at end of file diff --git "a/Tr\341\272\247n H\341\272\243i Long/Product/src/gamemanager/PlayerFunction.java" "b/Tr\341\272\247n H\341\272\243i Long/Product/src/gamemanager/PlayerFunction.java" deleted file mode 100644 index 7084c6c..0000000 --- "a/Tr\341\272\247n H\341\272\243i Long/Product/src/gamemanager/PlayerFunction.java" +++ /dev/null @@ -1,68 +0,0 @@ -package gamemanager; - -import java.util.Random; -import java.util.Scanner; -import game.Player; -import game.Ship; -import game.Cell; -import enums.*; - -public class PlayerFunction { - Scanner scanner = new Scanner(System.in); - public BoardController boardController; - Random random = new Random(); - - public PlayerFunction(BoardController boardController) { - this.boardController = boardController; - } - - public void placeShips(Player player) { - for (Ship ship : player.getShips()) { - boolean placed = false; - while (!placed) { - char x; - int y; - boolean valid; - do { - x = (char) ('A'+random.nextInt(player.getBoard().getSize())); - y = random.nextInt(player.getBoard().getSize()) + 1; - valid = player.getBoard().isCoordinateValid(x, y); - } while (!valid); - - Orientation orientation = random.nextBoolean() ? Orientation.HORIZONTAL : Orientation.VERTICAL; - - Cell startCell = player.getBoard().getCell(x, y); - placed = boardController.placeShip(ship, startCell, orientation); - } - } - } - - public FireResult fireAt(Player player, Player opponent) { - FireResult result = FireResult.MISS; - char x; - int y; - boolean valid = false; - do { - System.out.print(player.getName() + ", hãy nhập tọa độ bắn (ví dụ: B5): "); - String input = scanner.nextLine().toUpperCase(); - try { - x = input.charAt(0); - y = Integer.parseInt(input.substring(1)); - if (opponent.getBoard().isCoordinateValid(x, y)) { - Cell target = opponent.getBoard().getCell(x, y); - if (target.getStatus() != CellStatus.HIT && target.getStatus() != CellStatus.MISS) { - result = boardController.fireAt(target); - valid = true; - } - else { - System.out.println("Bạn đã bắn điểm này trước đó."); - } - } - else System.out.println("Định dạng tọa độ không hợp lệ. Vui lòng thử lại."); - } catch (Exception e) { - System.out.println("Định dạng tọa độ không hợp lệ. Vui lòng thử lại."); - } - } while (!valid); - return result; - } -} \ No newline at end of file diff --git "a/Tr\341\272\247n H\341\272\243i Long/Product/src/out/production/Code/.idea/.gitignore" "b/Tr\341\272\247n H\341\272\243i Long/Product/src/out/production/Code/.idea/.gitignore" deleted file mode 100644 index 13566b8..0000000 --- "a/Tr\341\272\247n H\341\272\243i Long/Product/src/out/production/Code/.idea/.gitignore" +++ /dev/null @@ -1,8 +0,0 @@ -# Default ignored files -/shelf/ -/workspace.xml -# Editor-based HTTP Client requests -/httpRequests/ -# Datasource local storage ignored files -/dataSources/ -/dataSources.local.xml diff --git "a/Tr\341\272\247n H\341\272\243i Long/Product/src/out/production/Code/.idea/Code.iml" "b/Tr\341\272\247n H\341\272\243i Long/Product/src/out/production/Code/.idea/Code.iml" deleted file mode 100644 index b107a2d..0000000 --- "a/Tr\341\272\247n H\341\272\243i Long/Product/src/out/production/Code/.idea/Code.iml" +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git "a/Tr\341\272\247n H\341\272\243i Long/Product/src/out/production/Code/.idea/artifacts/Code_jar.xml" "b/Tr\341\272\247n H\341\272\243i Long/Product/src/out/production/Code/.idea/artifacts/Code_jar.xml" deleted file mode 100644 index 4ddb759..0000000 --- "a/Tr\341\272\247n H\341\272\243i Long/Product/src/out/production/Code/.idea/artifacts/Code_jar.xml" +++ /dev/null @@ -1,8 +0,0 @@ - - - $PROJECT_DIR$/out/artifacts/Code_jar - - - - - \ No newline at end of file diff --git "a/Tr\341\272\247n H\341\272\243i Long/Product/src/out/production/Code/.idea/misc.xml" "b/Tr\341\272\247n H\341\272\243i Long/Product/src/out/production/Code/.idea/misc.xml" deleted file mode 100644 index 1b2d693..0000000 --- "a/Tr\341\272\247n H\341\272\243i Long/Product/src/out/production/Code/.idea/misc.xml" +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git "a/Tr\341\272\247n H\341\272\243i Long/Product/src/out/production/Code/.idea/modules.xml" "b/Tr\341\272\247n H\341\272\243i Long/Product/src/out/production/Code/.idea/modules.xml" deleted file mode 100644 index 74258af..0000000 --- "a/Tr\341\272\247n H\341\272\243i Long/Product/src/out/production/Code/.idea/modules.xml" +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git "a/Tr\341\272\247n H\341\272\243i Long/Product/src/out/production/Code/.idea/vcs.xml" "b/Tr\341\272\247n H\341\272\243i Long/Product/src/out/production/Code/.idea/vcs.xml" deleted file mode 100644 index b2bdec2..0000000 --- "a/Tr\341\272\247n H\341\272\243i Long/Product/src/out/production/Code/.idea/vcs.xml" +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git "a/Tr\341\272\247n H\341\272\243i Long/Product/src/out/production/Code/META-INF/MANIFEST.MF" "b/Tr\341\272\247n H\341\272\243i Long/Product/src/out/production/Code/META-INF/MANIFEST.MF" deleted file mode 100644 index c89698d..0000000 --- "a/Tr\341\272\247n H\341\272\243i Long/Product/src/out/production/Code/META-INF/MANIFEST.MF" +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -Main-Class: game.Main - diff --git "a/Tr\341\272\247n H\341\272\243i Long/Product/src/out/production/Code/game/.cph/.Main.java_17aca683d2fb1ce28f25e505c04fbfaf.prob" "b/Tr\341\272\247n H\341\272\243i Long/Product/src/out/production/Code/game/.cph/.Main.java_17aca683d2fb1ce28f25e505c04fbfaf.prob" deleted file mode 100644 index c328ef1..0000000 --- "a/Tr\341\272\247n H\341\272\243i Long/Product/src/out/production/Code/game/.cph/.Main.java_17aca683d2fb1ce28f25e505c04fbfaf.prob" +++ /dev/null @@ -1 +0,0 @@ -{"name":"Local: Main","url":"d:\\Code\\ProPTIT\\Java\\Sea Battle\\Code\\game\\Main.java","tests":[{"id":1732118831096,"input":"","output":""}],"interactive":false,"memoryLimit":1024,"timeLimit":3000,"srcPath":"d:\\Code\\ProPTIT\\Java\\Sea Battle\\Code\\game\\Main.java","group":"local","local":true} \ No newline at end of file diff --git "a/Tr\341\272\247n H\341\272\243i Long/Product/src/out/production/Code/test.md" "b/Tr\341\272\247n H\341\272\243i Long/Product/src/out/production/Code/test.md" deleted file mode 100644 index e69de29..0000000 diff --git "a/Tr\341\272\247n H\341\272\243i Long/Product/src/test.md" "b/Tr\341\272\247n H\341\272\243i Long/Product/src/test.md" deleted file mode 100644 index e69de29..0000000 diff --git "a/Tr\341\272\247n H\341\272\243i Long/UML/ActivityDiagram.png" "b/Tr\341\272\247n H\341\272\243i Long/UML/ActivityDiagram.png" deleted file mode 100644 index 0393b78..0000000 Binary files "a/Tr\341\272\247n H\341\272\243i Long/UML/ActivityDiagram.png" and /dev/null differ diff --git "a/Tr\341\272\247n H\341\272\243i Long/UML/ClassDiagram.png" "b/Tr\341\272\247n H\341\272\243i Long/UML/ClassDiagram.png" deleted file mode 100644 index 2914222..0000000 Binary files "a/Tr\341\272\247n H\341\272\243i Long/UML/ClassDiagram.png" and /dev/null differ diff --git "a/Tr\341\272\247n H\341\272\243i Long/UML/README.md" "b/Tr\341\272\247n H\341\272\243i Long/UML/README.md" deleted file mode 100644 index 9db701f..0000000 --- "a/Tr\341\272\247n H\341\272\243i Long/UML/README.md" +++ /dev/null @@ -1,7 +0,0 @@ -# UML - -- Đây là folder sẽ chứa các file UML của dự án -- Có thể sử dụng các công cụ sau để vẽ UML: - - [StarUML](https://staruml.io/) - - [Visual Paradigm](https://online.visual-paradigm.com/vpce/) -- Các file UML sẽ được lưu dưới dạng ảnh, và các em sửa file readme này đính kèm ảnh vào, ghi thêm giải thích nếu cần thiết \ No newline at end of file diff --git "a/Tr\341\272\247n Kh\341\272\257c Long/Product/README.md" "b/Tr\341\272\247n Kh\341\272\257c Long/Product/README.md" deleted file mode 100644 index e69de29..0000000 diff --git "a/Tr\341\272\247n Kh\341\272\257c Long/UML/Activity diagrams.png" "b/Tr\341\272\247n Kh\341\272\257c Long/UML/Activity diagrams.png" deleted file mode 100644 index 06dacb3..0000000 Binary files "a/Tr\341\272\247n Kh\341\272\257c Long/UML/Activity diagrams.png" and /dev/null differ diff --git "a/Tr\341\272\247n Kh\341\272\257c Long/UML/Class Diagram.png" "b/Tr\341\272\247n Kh\341\272\257c Long/UML/Class Diagram.png" deleted file mode 100644 index 42c325d..0000000 Binary files "a/Tr\341\272\247n Kh\341\272\257c Long/UML/Class Diagram.png" and /dev/null differ diff --git "a/Tr\341\272\247n Kh\341\272\257c Long/UML/README.md" "b/Tr\341\272\247n Kh\341\272\257c Long/UML/README.md" deleted file mode 100644 index 9db701f..0000000 --- "a/Tr\341\272\247n Kh\341\272\257c Long/UML/README.md" +++ /dev/null @@ -1,7 +0,0 @@ -# UML - -- Đây là folder sẽ chứa các file UML của dự án -- Có thể sử dụng các công cụ sau để vẽ UML: - - [StarUML](https://staruml.io/) - - [Visual Paradigm](https://online.visual-paradigm.com/vpce/) -- Các file UML sẽ được lưu dưới dạng ảnh, và các em sửa file readme này đính kèm ảnh vào, ghi thêm giải thích nếu cần thiết \ No newline at end of file diff --git "a/Tr\341\272\247n L\303\252 Nam Kh\303\241nh/Product/README.md" "b/Tr\341\272\247n L\303\252 Nam Kh\303\241nh/Product/README.md" deleted file mode 100644 index a5bc01b..0000000 --- "a/Tr\341\272\247n L\303\252 Nam Kh\303\241nh/Product/README.md" +++ /dev/null @@ -1,60 +0,0 @@ -# Sea Battle - -Sea Battle is a game for two players. The game is played on four grids, two for each player. The grids are typically square – usually 10×10 – and the individual squares in the grid are identified by letter and number. On one grid the player arranges ships and records the shots by the opponent. On the other grid the player records their own shots. - -The project was done by [Nguyễn Văn A](https://github.com/naa-ntu), in the course of Object Oriented Programming at [ProPTIT](https://proptit.com/). - - -## Tech Stack - -- [Java](https://www.java.com/en/) - - -## Installation - -- Clone the repo -- Open the project in your IDE -- Run the project - - -## Usage - -- Project Structure - -```bash - -├── src -│ ├── main -│ │ ├── java -│ │ │ ├── controller -│ │ │ │ ├── Controller.java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ └── ....java -│ │ │ ├── model -│ │ │ │ ├── Board.java -│ │ │ │ ├── Cell.java -│ │ │ │ ├── Game.java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ └── ....java - - -``` - -## Contributing - -Pull requests are welcome. For major changes, please open an issue first -to discuss what you would like to change. - -Please make sure to update tests as appropriate. - -## License - -[MIT](https://choosealicense.com/licenses/mit/) \ No newline at end of file diff --git "a/Tr\341\272\247n L\303\252 Nam Kh\303\241nh/Product/src/test.md" "b/Tr\341\272\247n L\303\252 Nam Kh\303\241nh/Product/src/test.md" deleted file mode 100644 index e69de29..0000000 diff --git "a/Tr\341\272\247n L\303\252 Nam Kh\303\241nh/UML/Activity Diagram - Sea Battle.jpg" "b/Tr\341\272\247n L\303\252 Nam Kh\303\241nh/UML/Activity Diagram - Sea Battle.jpg" deleted file mode 100644 index 13ce0bd..0000000 Binary files "a/Tr\341\272\247n L\303\252 Nam Kh\303\241nh/UML/Activity Diagram - Sea Battle.jpg" and /dev/null differ diff --git "a/Tr\341\272\247n L\303\252 Nam Kh\303\241nh/UML/Class Diagram - Sea Battle.jpg" "b/Tr\341\272\247n L\303\252 Nam Kh\303\241nh/UML/Class Diagram - Sea Battle.jpg" deleted file mode 100644 index ea24f79..0000000 Binary files "a/Tr\341\272\247n L\303\252 Nam Kh\303\241nh/UML/Class Diagram - Sea Battle.jpg" and /dev/null differ diff --git "a/Tr\341\272\247n L\303\252 Nam Kh\303\241nh/UML/README.md" "b/Tr\341\272\247n L\303\252 Nam Kh\303\241nh/UML/README.md" deleted file mode 100644 index 9db701f..0000000 --- "a/Tr\341\272\247n L\303\252 Nam Kh\303\241nh/UML/README.md" +++ /dev/null @@ -1,7 +0,0 @@ -# UML - -- Đây là folder sẽ chứa các file UML của dự án -- Có thể sử dụng các công cụ sau để vẽ UML: - - [StarUML](https://staruml.io/) - - [Visual Paradigm](https://online.visual-paradigm.com/vpce/) -- Các file UML sẽ được lưu dưới dạng ảnh, và các em sửa file readme này đính kèm ảnh vào, ghi thêm giải thích nếu cần thiết \ No newline at end of file diff --git "a/Tr\341\272\247n Ng\341\273\215c \303\201nh/Product/README.md" "b/Tr\341\272\247n Ng\341\273\215c \303\201nh/Product/README.md" deleted file mode 100644 index a5bc01b..0000000 --- "a/Tr\341\272\247n Ng\341\273\215c \303\201nh/Product/README.md" +++ /dev/null @@ -1,60 +0,0 @@ -# Sea Battle - -Sea Battle is a game for two players. The game is played on four grids, two for each player. The grids are typically square – usually 10×10 – and the individual squares in the grid are identified by letter and number. On one grid the player arranges ships and records the shots by the opponent. On the other grid the player records their own shots. - -The project was done by [Nguyễn Văn A](https://github.com/naa-ntu), in the course of Object Oriented Programming at [ProPTIT](https://proptit.com/). - - -## Tech Stack - -- [Java](https://www.java.com/en/) - - -## Installation - -- Clone the repo -- Open the project in your IDE -- Run the project - - -## Usage - -- Project Structure - -```bash - -├── src -│ ├── main -│ │ ├── java -│ │ │ ├── controller -│ │ │ │ ├── Controller.java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ └── ....java -│ │ │ ├── model -│ │ │ │ ├── Board.java -│ │ │ │ ├── Cell.java -│ │ │ │ ├── Game.java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ └── ....java - - -``` - -## Contributing - -Pull requests are welcome. For major changes, please open an issue first -to discuss what you would like to change. - -Please make sure to update tests as appropriate. - -## License - -[MIT](https://choosealicense.com/licenses/mit/) \ No newline at end of file diff --git "a/Tr\341\272\247n Ng\341\273\215c \303\201nh/Product/src/test.md" "b/Tr\341\272\247n Ng\341\273\215c \303\201nh/Product/src/test.md" deleted file mode 100644 index e69de29..0000000 diff --git "a/Tr\341\272\247n Ng\341\273\215c \303\201nh/UML/Activity Diagram.png" "b/Tr\341\272\247n Ng\341\273\215c \303\201nh/UML/Activity Diagram.png" deleted file mode 100644 index b3ecdb1..0000000 Binary files "a/Tr\341\272\247n Ng\341\273\215c \303\201nh/UML/Activity Diagram.png" and /dev/null differ diff --git "a/Tr\341\272\247n Ng\341\273\215c \303\201nh/UML/Class Diagram.png" "b/Tr\341\272\247n Ng\341\273\215c \303\201nh/UML/Class Diagram.png" deleted file mode 100644 index e50f7e3..0000000 Binary files "a/Tr\341\272\247n Ng\341\273\215c \303\201nh/UML/Class Diagram.png" and /dev/null differ diff --git "a/Tr\341\272\247n Ng\341\273\215c \303\201nh/UML/README.md" "b/Tr\341\272\247n Ng\341\273\215c \303\201nh/UML/README.md" deleted file mode 100644 index 9db701f..0000000 --- "a/Tr\341\272\247n Ng\341\273\215c \303\201nh/UML/README.md" +++ /dev/null @@ -1,7 +0,0 @@ -# UML - -- Đây là folder sẽ chứa các file UML của dự án -- Có thể sử dụng các công cụ sau để vẽ UML: - - [StarUML](https://staruml.io/) - - [Visual Paradigm](https://online.visual-paradigm.com/vpce/) -- Các file UML sẽ được lưu dưới dạng ảnh, và các em sửa file readme này đính kèm ảnh vào, ghi thêm giải thích nếu cần thiết \ No newline at end of file diff --git "a/V\304\203n Th\341\273\213 Mai Linh/Product/README.md" "b/V\304\203n Th\341\273\213 Mai Linh/Product/README.md" deleted file mode 100644 index a5bc01b..0000000 --- "a/V\304\203n Th\341\273\213 Mai Linh/Product/README.md" +++ /dev/null @@ -1,60 +0,0 @@ -# Sea Battle - -Sea Battle is a game for two players. The game is played on four grids, two for each player. The grids are typically square – usually 10×10 – and the individual squares in the grid are identified by letter and number. On one grid the player arranges ships and records the shots by the opponent. On the other grid the player records their own shots. - -The project was done by [Nguyễn Văn A](https://github.com/naa-ntu), in the course of Object Oriented Programming at [ProPTIT](https://proptit.com/). - - -## Tech Stack - -- [Java](https://www.java.com/en/) - - -## Installation - -- Clone the repo -- Open the project in your IDE -- Run the project - - -## Usage - -- Project Structure - -```bash - -├── src -│ ├── main -│ │ ├── java -│ │ │ ├── controller -│ │ │ │ ├── Controller.java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ └── ....java -│ │ │ ├── model -│ │ │ │ ├── Board.java -│ │ │ │ ├── Cell.java -│ │ │ │ ├── Game.java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ └── ....java - - -``` - -## Contributing - -Pull requests are welcome. For major changes, please open an issue first -to discuss what you would like to change. - -Please make sure to update tests as appropriate. - -## License - -[MIT](https://choosealicense.com/licenses/mit/) \ No newline at end of file diff --git "a/V\304\203n Th\341\273\213 Mai Linh/Product/src/test.md" "b/V\304\203n Th\341\273\213 Mai Linh/Product/src/test.md" deleted file mode 100644 index e69de29..0000000 diff --git "a/V\304\203n Th\341\273\213 Mai Linh/UML/ActivityDiagram.drawio.png" "b/V\304\203n Th\341\273\213 Mai Linh/UML/ActivityDiagram.drawio.png" deleted file mode 100644 index 06c3b64..0000000 Binary files "a/V\304\203n Th\341\273\213 Mai Linh/UML/ActivityDiagram.drawio.png" and /dev/null differ diff --git "a/V\304\203n Th\341\273\213 Mai Linh/UML/Class Diagram.drawio.png" "b/V\304\203n Th\341\273\213 Mai Linh/UML/Class Diagram.drawio.png" deleted file mode 100644 index 56e5dbe..0000000 Binary files "a/V\304\203n Th\341\273\213 Mai Linh/UML/Class Diagram.drawio.png" and /dev/null differ diff --git "a/V\304\203n Th\341\273\213 Mai Linh/UML/README.md" "b/V\304\203n Th\341\273\213 Mai Linh/UML/README.md" deleted file mode 100644 index 9db701f..0000000 --- "a/V\304\203n Th\341\273\213 Mai Linh/UML/README.md" +++ /dev/null @@ -1,7 +0,0 @@ -# UML - -- Đây là folder sẽ chứa các file UML của dự án -- Có thể sử dụng các công cụ sau để vẽ UML: - - [StarUML](https://staruml.io/) - - [Visual Paradigm](https://online.visual-paradigm.com/vpce/) -- Các file UML sẽ được lưu dưới dạng ảnh, và các em sửa file readme này đính kèm ảnh vào, ghi thêm giải thích nếu cần thiết \ No newline at end of file diff --git "a/\304\220\341\273\227 V\305\251 H\341\272\243i \304\220\304\203ng/Product/README.md" "b/\304\220\341\273\227 V\305\251 H\341\272\243i \304\220\304\203ng/Product/README.md" deleted file mode 100644 index a5bc01b..0000000 --- "a/\304\220\341\273\227 V\305\251 H\341\272\243i \304\220\304\203ng/Product/README.md" +++ /dev/null @@ -1,60 +0,0 @@ -# Sea Battle - -Sea Battle is a game for two players. The game is played on four grids, two for each player. The grids are typically square – usually 10×10 – and the individual squares in the grid are identified by letter and number. On one grid the player arranges ships and records the shots by the opponent. On the other grid the player records their own shots. - -The project was done by [Nguyễn Văn A](https://github.com/naa-ntu), in the course of Object Oriented Programming at [ProPTIT](https://proptit.com/). - - -## Tech Stack - -- [Java](https://www.java.com/en/) - - -## Installation - -- Clone the repo -- Open the project in your IDE -- Run the project - - -## Usage - -- Project Structure - -```bash - -├── src -│ ├── main -│ │ ├── java -│ │ │ ├── controller -│ │ │ │ ├── Controller.java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ └── ....java -│ │ │ ├── model -│ │ │ │ ├── Board.java -│ │ │ │ ├── Cell.java -│ │ │ │ ├── Game.java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ └── ....java - - -``` - -## Contributing - -Pull requests are welcome. For major changes, please open an issue first -to discuss what you would like to change. - -Please make sure to update tests as appropriate. - -## License - -[MIT](https://choosealicense.com/licenses/mit/) \ No newline at end of file diff --git "a/\304\220\341\273\227 V\305\251 H\341\272\243i \304\220\304\203ng/Product/src/test.md" "b/\304\220\341\273\227 V\305\251 H\341\272\243i \304\220\304\203ng/Product/src/test.md" deleted file mode 100644 index e69de29..0000000 diff --git "a/\304\220\341\273\227 V\305\251 H\341\272\243i \304\220\304\203ng/UML/Activity Diagram.png" "b/\304\220\341\273\227 V\305\251 H\341\272\243i \304\220\304\203ng/UML/Activity Diagram.png" deleted file mode 100644 index d4d2a7d..0000000 Binary files "a/\304\220\341\273\227 V\305\251 H\341\272\243i \304\220\304\203ng/UML/Activity Diagram.png" and /dev/null differ diff --git "a/\304\220\341\273\227 V\305\251 H\341\272\243i \304\220\304\203ng/UML/Class Diagram.drawio.png" "b/\304\220\341\273\227 V\305\251 H\341\272\243i \304\220\304\203ng/UML/Class Diagram.drawio.png" deleted file mode 100644 index a0da1bb..0000000 Binary files "a/\304\220\341\273\227 V\305\251 H\341\272\243i \304\220\304\203ng/UML/Class Diagram.drawio.png" and /dev/null differ diff --git "a/\304\220\341\273\227 V\305\251 H\341\272\243i \304\220\304\203ng/UML/README.md" "b/\304\220\341\273\227 V\305\251 H\341\272\243i \304\220\304\203ng/UML/README.md" deleted file mode 100644 index 9db701f..0000000 --- "a/\304\220\341\273\227 V\305\251 H\341\272\243i \304\220\304\203ng/UML/README.md" +++ /dev/null @@ -1,7 +0,0 @@ -# UML - -- Đây là folder sẽ chứa các file UML của dự án -- Có thể sử dụng các công cụ sau để vẽ UML: - - [StarUML](https://staruml.io/) - - [Visual Paradigm](https://online.visual-paradigm.com/vpce/) -- Các file UML sẽ được lưu dưới dạng ảnh, và các em sửa file readme này đính kèm ảnh vào, ghi thêm giải thích nếu cần thiết \ No newline at end of file diff --git "a/\304\220\341\273\227 \304\220\341\273\251c Tu\341\272\245n Anh/Product/README.md" "b/\304\220\341\273\227 \304\220\341\273\251c Tu\341\272\245n Anh/Product/README.md" deleted file mode 100644 index a5bc01b..0000000 --- "a/\304\220\341\273\227 \304\220\341\273\251c Tu\341\272\245n Anh/Product/README.md" +++ /dev/null @@ -1,60 +0,0 @@ -# Sea Battle - -Sea Battle is a game for two players. The game is played on four grids, two for each player. The grids are typically square – usually 10×10 – and the individual squares in the grid are identified by letter and number. On one grid the player arranges ships and records the shots by the opponent. On the other grid the player records their own shots. - -The project was done by [Nguyễn Văn A](https://github.com/naa-ntu), in the course of Object Oriented Programming at [ProPTIT](https://proptit.com/). - - -## Tech Stack - -- [Java](https://www.java.com/en/) - - -## Installation - -- Clone the repo -- Open the project in your IDE -- Run the project - - -## Usage - -- Project Structure - -```bash - -├── src -│ ├── main -│ │ ├── java -│ │ │ ├── controller -│ │ │ │ ├── Controller.java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ └── ....java -│ │ │ ├── model -│ │ │ │ ├── Board.java -│ │ │ │ ├── Cell.java -│ │ │ │ ├── Game.java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ ├── ....java -│ │ │ │ └── ....java - - -``` - -## Contributing - -Pull requests are welcome. For major changes, please open an issue first -to discuss what you would like to change. - -Please make sure to update tests as appropriate. - -## License - -[MIT](https://choosealicense.com/licenses/mit/) \ No newline at end of file diff --git "a/\304\220\341\273\227 \304\220\341\273\251c Tu\341\272\245n Anh/Product/src/test.md" "b/\304\220\341\273\227 \304\220\341\273\251c Tu\341\272\245n Anh/Product/src/test.md" deleted file mode 100644 index e69de29..0000000 diff --git "a/\304\220\341\273\227 \304\220\341\273\251c Tu\341\272\245n Anh/UML/Activity Diagram.png" "b/\304\220\341\273\227 \304\220\341\273\251c Tu\341\272\245n Anh/UML/Activity Diagram.png" deleted file mode 100644 index 7071ca3..0000000 Binary files "a/\304\220\341\273\227 \304\220\341\273\251c Tu\341\272\245n Anh/UML/Activity Diagram.png" and /dev/null differ diff --git "a/\304\220\341\273\227 \304\220\341\273\251c Tu\341\272\245n Anh/UML/Class DIagram.png" "b/\304\220\341\273\227 \304\220\341\273\251c Tu\341\272\245n Anh/UML/Class DIagram.png" deleted file mode 100644 index ce92f74..0000000 Binary files "a/\304\220\341\273\227 \304\220\341\273\251c Tu\341\272\245n Anh/UML/Class DIagram.png" and /dev/null differ diff --git "a/\304\220\341\273\227 \304\220\341\273\251c Tu\341\272\245n Anh/UML/README.md" "b/\304\220\341\273\227 \304\220\341\273\251c Tu\341\272\245n Anh/UML/README.md" deleted file mode 100644 index 9db701f..0000000 --- "a/\304\220\341\273\227 \304\220\341\273\251c Tu\341\272\245n Anh/UML/README.md" +++ /dev/null @@ -1,7 +0,0 @@ -# UML - -- Đây là folder sẽ chứa các file UML của dự án -- Có thể sử dụng các công cụ sau để vẽ UML: - - [StarUML](https://staruml.io/) - - [Visual Paradigm](https://online.visual-paradigm.com/vpce/) -- Các file UML sẽ được lưu dưới dạng ảnh, và các em sửa file readme này đính kèm ảnh vào, ghi thêm giải thích nếu cần thiết \ No newline at end of file