Skip to content

Instantly share code, notes, and snippets.

@melvincabatuan
Last active July 29, 2022 06:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save melvincabatuan/53233d185f86c70c07dadfaeb1131304 to your computer and use it in GitHub Desktop.
Save melvincabatuan/53233d185f86c70c07dadfaeb1131304 to your computer and use it in GitHub Desktop.
package ph.edu.dlsu.lbycpei;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// METHOD 1: Hardcoded ASCII Art
String ascii1 = """
+------------+ _________________
| | / \\
| _______ | AUGH, I'M DEAD. |
| / X X \\ / \\_________________/
| | . | /
| | ___ |
| \\_______/
| |
| \\\\----+----//
| |
| |
| / \\
| / \\
| __/ \\__
|
---+---
#######
""";
System.out.println(ascii1);
// METHOD 2: Java file reading
int guessCount = 0;
File file = new File("assets/display" + guessCount + ".txt");
Scanner scanner = null;
try {
scanner = new Scanner(file);
// int line_counter = 1;
while (scanner.hasNextLine()) {
String data = scanner.nextLine();
System.out.println(data);
// line_counter++;
}
scanner.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment