From 82dd7307be690dbf5164e36ba23fb384b0a1bd7a Mon Sep 17 00:00:00 2001 From: Mitch Malvin <89574448+mitchmalvin1@users.noreply.github.com> Date: Thu, 9 Mar 2023 16:56:56 +0800 Subject: [PATCH] Revert "Revert "PR containing basic UI code and some basic package structure"" --- .gitignore | 1 + build.gradle | 2 +- src/main/java/Inka.class | Bin 0 -> 616 bytes src/main/java/Inka.java | 26 ++++++++++ src/main/java/model/card/Card.java | 10 ++++ src/main/java/model/cardlist/CardList.java | 12 +++++ src/main/java/utils/enums/StringArt.class | Bin 0 -> 1257 bytes src/main/java/utils/enums/StringArt.java | 22 ++++++++ src/main/java/utils/parser/Parser.class | Bin 0 -> 314 bytes src/main/java/utils/parser/Parser.java | 15 ++++++ .../utils/userinterface/UserInterface.class | Bin 0 -> 1612 bytes .../utils/userinterface/UserInterface.java | 48 ++++++++++++++++++ text-ui-test/EXPECTED.TXT | 24 ++++++--- text-ui-test/input.txt | 1 - 14 files changed, 151 insertions(+), 10 deletions(-) create mode 100644 src/main/java/Inka.class create mode 100644 src/main/java/Inka.java create mode 100644 src/main/java/model/card/Card.java create mode 100644 src/main/java/model/cardlist/CardList.java create mode 100644 src/main/java/utils/enums/StringArt.class create mode 100644 src/main/java/utils/enums/StringArt.java create mode 100644 src/main/java/utils/parser/Parser.class create mode 100644 src/main/java/utils/parser/Parser.java create mode 100644 src/main/java/utils/userinterface/UserInterface.class create mode 100644 src/main/java/utils/userinterface/UserInterface.java diff --git a/.gitignore b/.gitignore index 2873e189e1..2b04b28136 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ /.idea/ /out/ /*.iml +/*.class # Gradle build files /.gradle/ diff --git a/build.gradle b/build.gradle index d5e548e85f..8063a8adb8 100644 --- a/build.gradle +++ b/build.gradle @@ -29,7 +29,7 @@ test { } application { - mainClass = "seedu.duke.Duke" + mainClass = "Inka" } shadowJar { diff --git a/src/main/java/Inka.class b/src/main/java/Inka.class new file mode 100644 index 0000000000000000000000000000000000000000..d8aee0ed39cdb6c7f81b1a1ccdb16355947c1109 GIT binary patch literal 616 zcmah{%Syvg5Ir}Irb*L>)^~i>s?{#c(nUopN9=AJoonB?R0^&P+}Di*SE3`|xOlL^8ban$kTc+WkQ_f&N=BWJ_T9o1S3zpxai2H9zp9b%E5< z@`-@Hb#pES@^wFud+~KchDTnb%}y$e13q7SKGVq3S^d(x^W3%WZXMpl zVN-7VYQ)?PuDlh+voVOGK^ClD zGZM(&sdnwa1c9_m-jB@$%htB=s1kxr7?6UcEJ=*!^l93@SR iVvHloNrhh3aOMpbH)oz<_XgEZ0#YrElQhm+!^9W=a&$ca literal 0 HcmV?d00001 diff --git a/src/main/java/Inka.java b/src/main/java/Inka.java new file mode 100644 index 0000000000..247f96f2b9 --- /dev/null +++ b/src/main/java/Inka.java @@ -0,0 +1,26 @@ +import utils.parser.Parser; +import utils.userinterface.UserInterface; + +public class Inka { + private final UserInterface ui; + private final Parser parser; + public Inka() { + ui = new UserInterface(); + parser = new Parser(); + } + + public void run() { + ui.printGreeting(); + + //fill in the method here + //while(parser.getIsExecuting()) { + // String fullCommand = ui.getCommand(); + //} + + ui.printBye(); + } + + public static void main(String[] args) { + new Inka().run(); + } +} diff --git a/src/main/java/model/card/Card.java b/src/main/java/model/card/Card.java new file mode 100644 index 0000000000..1c734e49fd --- /dev/null +++ b/src/main/java/model/card/Card.java @@ -0,0 +1,10 @@ +package model.card; + +//to be made into an abstract class containing a few types of Cards later, for now just a single Card will do +public class Card { + private int uuid ; //to be made into a hash later + private String question; + private String answer; + + //implement method such as toPrint() or any other appropriate method here +} diff --git a/src/main/java/model/cardlist/CardList.java b/src/main/java/model/cardlist/CardList.java new file mode 100644 index 0000000000..4e65cb4fdc --- /dev/null +++ b/src/main/java/model/cardlist/CardList.java @@ -0,0 +1,12 @@ +package model.cardlist; + +import model.card.Card; +import java.util.ArrayList; + +public class CardList { + private ArrayList cards ; + + CardList() { + this.cards = new ArrayList<>(); + } +} diff --git a/src/main/java/utils/enums/StringArt.class b/src/main/java/utils/enums/StringArt.class new file mode 100644 index 0000000000000000000000000000000000000000..7f0624d5d382300ce4ccfa3e52d49dc6093fb89c GIT binary patch literal 1257 zcmZ`&ZBNrs6n^g7ZCzIfRNg_oDr!4kDk$=Sg@9xv#03(kB*Z35nT3>;lI(>~{2Bj& zLKLIX@Yx?_Jf~a6BHPV&?s<96IZyAo_s`!SzX7aZB?A>tbv%QW#%LP0jsfIZ%yMK- z!=Q$Fozw-k9Sx?2=d3QKu_T~w@4VR%7%Md!L0EVEsCiO%%8gnO9c|Pas{+dF{US-P z)(|jD$KILegkE&i#t@Xlzb-Io+5J)K=IKXYV4xI4{!a7c zz^}dY4np#zv& z5sM_*tdl}yNY~@;4oNa%okAAH4Vc_5cXMTVFapVHcpA~k4_nNPp>c$Wau;FGUQq#P0!F2}o#o7&BvrZ;>PkEd7MKZ)%E}xq^O)Y-}2; oc_%h=$zK#!E|4wns~2?NFCqT#!zYv_W(xIab$W~$s+_=+f9R(Rc>n+a literal 0 HcmV?d00001 diff --git a/src/main/java/utils/enums/StringArt.java b/src/main/java/utils/enums/StringArt.java new file mode 100644 index 0000000000..87f8c9cf2c --- /dev/null +++ b/src/main/java/utils/enums/StringArt.java @@ -0,0 +1,22 @@ +package utils.enums; + +public enum StringArt { + INKA( + ".___ __ \n" + + "| | ____ | | _______ \n" + + "| |/ \\| |/ /\\__ \\ \n" + + "| | | \\ < / __ \\_\n" + + "|___|___| /__|_ \\(____ /\n" + + " \\/ \\/ \\/ "), + BYE( + " ____ _ _ ____ _ \n" + + "( _ \\( \\/ )( __) / \\ \n" + + " ) _ ( ) / ) _) \\_/ \n" + + "(____/(__/ (____) (_) " + ); + + public final String art; + StringArt(String art) { + this.art = art; + } +} diff --git a/src/main/java/utils/parser/Parser.class b/src/main/java/utils/parser/Parser.class new file mode 100644 index 0000000000000000000000000000000000000000..583e71710e5a22b61d3412ccc4de14e2896d0d20 GIT binary patch literal 314 zcmYk0y-LJT5QWcV?R3+Nu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mode 100644 index 0000000000..3b610ccc40 --- /dev/null +++ b/src/main/java/utils/userinterface/UserInterface.java @@ -0,0 +1,48 @@ +package utils.userinterface; + +import utils.enums.StringArt; + +import java.util.Scanner; + +public class UserInterface { + private static final int LINE_LENGTH = 100; + private static final String INKA_ART = + ".___ __ \n" + + "| | ____ | | _______ \n" + + "| |/ \\| |/ /\\__ \\ \n" + + "| | | \\ < / __ \\_\n" + + "|___|___| /__|_ \\(____ /\n" + + " \\/ \\/ \\/ "; + + private static final String BYE_ART = + " ____ _ _ ____ _ \n" + + "( _ \\( \\/ )( __) / \\ \n" + + " ) _ ( ) / ) _) \\_/ \n" + + "(____/(__/ (____) (_) "; + private final Scanner scanner; + public UserInterface() { + scanner = new Scanner(System.in); + } + + public String getCommand() { + return scanner.nextLine(); + } + + public void printLine() { + System.out.println("_".repeat(LINE_LENGTH)); + } + + public void printGreeting() { + printLine(); + System.out.println(StringArt.INKA.art); + System.out.println("Welcome to Inka ! Say no more to failing exams as Inka will be your lord and saviour!"); + printLine(); + } + + public void printBye() { + printLine(); + System.out.println(StringArt.BYE.art); + System.out.println("\n Bye! All the best for your exams man!!!"); + printLine(); + } +} diff --git a/text-ui-test/EXPECTED.TXT b/text-ui-test/EXPECTED.TXT index 892cb6cae7..79c073f18d 100644 --- a/text-ui-test/EXPECTED.TXT +++ b/text-ui-test/EXPECTED.TXT @@ -1,9 +1,17 @@ -Hello from - ____ _ -| _ \ _ _| | _____ -| | | | | | | |/ / _ \ -| |_| | |_| | < __/ -|____/ \__,_|_|\_\___| +____________________________________________________________________________________________________ +.___ __ +| | ____ | | _______ +| |/ \| |/ /\__ \ +| | | \ < / __ \_ +|___|___| /__|_ \(____ / + \/ \/ \/ +Welcome to Inka ! Say no more to failing exams as Inka will be your lord and saviour! +____________________________________________________________________________________________________ +____________________________________________________________________________________________________ + ____ _ _ ____ _ +( _ \( \/ )( __) / \ + ) _ ( ) / ) _) \_/ +(____/(__/ (____) (_) -What is your name? -Hello James Gosling + Bye! All the best for your exams man!!! +____________________________________________________________________________________________________ diff --git a/text-ui-test/input.txt b/text-ui-test/input.txt index f6ec2e9f95..e69de29bb2 100644 --- a/text-ui-test/input.txt +++ b/text-ui-test/input.txt @@ -1 +0,0 @@ -James Gosling \ No newline at end of file