Skip to content

Commit

Permalink
Merge pull request #4 from AY2223S2-CS2113-F10-1/revert-3-revert-1-ma…
Browse files Browse the repository at this point in the history
…ster

Revert "Revert "PR containing basic UI code and some basic package structure""
  • Loading branch information
mitchmalvin1 authored Mar 9, 2023
2 parents 52487d7 + 82dd730 commit 379f096
Show file tree
Hide file tree
Showing 14 changed files with 151 additions and 10 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
/.idea/
/out/
/*.iml
/*.class

# Gradle build files
/.gradle/
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ test {
}

application {
mainClass = "seedu.duke.Duke"
mainClass = "Inka"
}

shadowJar {
Expand Down
Binary file added src/main/java/Inka.class
Binary file not shown.
26 changes: 26 additions & 0 deletions src/main/java/Inka.java
Original file line number Diff line number Diff line change
@@ -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();
}
}
10 changes: 10 additions & 0 deletions src/main/java/model/card/Card.java
Original file line number Diff line number Diff line change
@@ -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
}
12 changes: 12 additions & 0 deletions src/main/java/model/cardlist/CardList.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package model.cardlist;

import model.card.Card;
import java.util.ArrayList;

public class CardList {
private ArrayList<Card> cards ;

CardList() {
this.cards = new ArrayList<>();
}
}
Binary file added src/main/java/utils/enums/StringArt.class
Binary file not shown.
22 changes: 22 additions & 0 deletions src/main/java/utils/enums/StringArt.java
Original file line number Diff line number Diff line change
@@ -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;
}
}
Binary file added src/main/java/utils/parser/Parser.class
Binary file not shown.
15 changes: 15 additions & 0 deletions src/main/java/utils/parser/Parser.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package utils.parser;

public class Parser {
private boolean isExecuting;

public Parser() {
this.isExecuting = true;
}

public boolean getIsExecuting() {
return isExecuting;
}

//add all parser methods here
}
Binary file not shown.
48 changes: 48 additions & 0 deletions src/main/java/utils/userinterface/UserInterface.java
Original file line number Diff line number Diff line change
@@ -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();
}
}
24 changes: 16 additions & 8 deletions text-ui-test/EXPECTED.TXT
Original file line number Diff line number Diff line change
@@ -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!!!
____________________________________________________________________________________________________
1 change: 0 additions & 1 deletion text-ui-test/input.txt
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
James Gosling

0 comments on commit 379f096

Please sign in to comment.