|
| 1 | +# Asscii Games |
| 2 | + |
| 3 | +## Description |
| 4 | +This is a game manager for all of your java ascii games. It is super easy to add games to the manager. |
| 5 | + |
| 6 | +## Inspiration |
| 7 | +I wanted a way to easily have asscii games all in one place. |
| 8 | + |
| 9 | +## Current Games |
| 10 | +- Battleship - The classic game of Battleship. [@allancoding](https://github.com/allancoding) |
| 11 | +- Rock Paper Scissors - A really simple game of Rock Paper Scissors. [@allancoding](https://github.com/allancoding) |
| 12 | +- Tic Tac Toe - A simple version of Tick Tack Toe. [@allancoding](https://github.com/allancoding) |
| 13 | + |
| 14 | +## How to play |
| 15 | +1. Run the `manager` class. |
| 16 | +2. Select a game to play. |
| 17 | +3. Play the game and have fun! |
| 18 | + |
| 19 | + |
| 20 | + |
| 21 | + |
| 22 | +## How to add a game |
| 23 | +1. Create a new class inside of the games folder. |
| 24 | +2. Create nested class inside of the main class name it `Game` |
| 25 | +3. the method `start` should be the main method for the game. |
| 26 | +5. You can add a description and name to the game by adding a `description` & `name` variable to the `Game` class. |
| 27 | +6. 2 booleans should be passed to the `start` method. The first will be true and the second will be false. |
| 28 | +Example: |
| 29 | +```java |
| 30 | +public class Chess { |
| 31 | + public static class Game { |
| 32 | + public static final String Name = "Chess"; |
| 33 | + public static final String Description = "The classic game of Chess."; |
| 34 | + public static void start(boolean, instructions, boolean main) { |
| 35 | + // Game code here |
| 36 | + } |
| 37 | + } |
| 38 | +} |
| 39 | +``` |
| 40 | +Note: The methods will need to be static. |
| 41 | + |
| 42 | +## Build |
| 43 | +You can easily build the project by running the `build.sh` script. It will out put a jar called `asciiGames.jar`. |
| 44 | +```bash |
| 45 | +chmod +x build.sh |
| 46 | +./build.sh |
| 47 | +``` |
| 48 | + |
| 49 | +## Run |
| 50 | +To run the jar file: |
| 51 | +```bash |
| 52 | +java -jar asciiGames.jar |
| 53 | +``` |
| 54 | + |
| 55 | +## Dependencies |
| 56 | +- [Java](https://www.java.com/) 8 or higher is required. |
| 57 | +- [Janis](https://github.com/fusesource/jansi) 2.4.1 or higher is required. |
| 58 | + |
| 59 | +## Docs for the `ascii` class |
| 60 | +The asscii class is used as a helper class for asscii. It has a few methods that can be used to help with the game. |
| 61 | + |
| 62 | +### Methods: |
| 63 | +| Method | Description | Parameters | Returns | |
| 64 | +| --- | --- | --- | --- | |
| 65 | +| `ascii.clear` | Clears the screen. | null | null | |
| 66 | +| `ascii.print` | Prints a string to the screen. | `String` - The string to print. | null | |
| 67 | +| `ascii.println` | Prints a string to the screen with a new line. | `String` - The string to print. | null | |
| 68 | +| `ascii.printerror` | Prints an error message to the screen. | `String` - The error message to print. | null | |
| 69 | +| `ascii.printRepeated` | Prints a string repeated a number of times. | `String` - The string to print. <br>`int` - The number of times to print the string. <br>`boolean` - Whether to print a new line at the end. | null | |
| 70 | +| `ascii.wait` | Waits for a number of milliseconds. | `int` - The number of milliseconds to wait. | null | |
| 71 | +| `ascii.waitForEnter` | Waits for the user to press enter. | `String` - The message to print before waiting. | null | |
| 72 | +| `ascii.toS` | Converts a char to a string. | `char` - The char to convert. | `String` - The converted string. | |
| 73 | + |
| 74 | +### Variables: |
| 75 | +#### Ascii Characters: |
| 76 | +| Variable | Value | Returns | |
| 77 | +| --- | --- | --- | |
| 78 | +| `ascii.emDash` | ─ | Char | |
| 79 | +| `ascii.rectangle` | █ | Char | |
| 80 | +| `ascii.box` | ■ | Char | |
| 81 | + |
| 82 | +#### Colors: |
| 83 | +| Variable | Description | Returns | |
| 84 | +| --- | --- | --- | |
| 85 | +| `ascii.ANSI_RESET` | Resets the color. | String | |
| 86 | +| `ascii.ANSI_BLACK` | Black color. | String | |
| 87 | +| `ascii.ANSI_RED` | Red color. | String | |
| 88 | +| `ascii.ANSI_GREEN` | Green color. | String | |
| 89 | +| `ascii.ANSI_YELLOW` | Yellow color. | String | |
| 90 | +| `ascii.ANSI_BLUE` | Blue color. | String | |
| 91 | +| `ascii.ANSI_PURPLE` | Purple color. | String | |
| 92 | +| `ascii.ANSI_CYAN` | Cyan color. | String | |
| 93 | +| `ascii.ANSI_WHITE` | White color. | String | |
| 94 | +| `ascii.ANSI_BLACK_BACKGROUND` | Black background color. | String | |
| 95 | +| `ascii.ANSI_RED_BACKGROUND` | Red background color. | String | |
| 96 | +| `ascii.ANSI_GREEN_BACKGROUND` | Green background color. | String | |
| 97 | +| `ascii.ANSI_YELLOW_BACKGROUND` | Yellow background color. | String | |
| 98 | +| `ascii.ANSI_BLUE_BACKGROUND` | Blue background color. | String | |
| 99 | +| `ascii.ANSI_PURPLE_BACKGROUND` | Purple background color. | String | |
| 100 | +| `ascii.ANSI_CYAN_BACKGROUND` | Cyan background color. | String | |
| 101 | +| `ascii.ANSI_WHITE_BACKGROUND` | White background color. | String | |
| 102 | + |
| 103 | +#### Table: |
| 104 | +| Variable | Description | Value | Returns | |
| 105 | +| --- | --- | --- | --- | |
| 106 | +| `ascii.topCornerLeft` | Top left corner of a table. | ┌ | Char | |
| 107 | +| `ascii.topCornerRight` | Top right corner of a table. | ┐ | Char | |
| 108 | +| `ascii.bottomCornerLeft` | Bottom left corner of a table. | └ | Char | |
| 109 | +| `ascii.bottomCornerRight` | Bottom right corner of a table. | ┘ | Char | |
| 110 | +| `ascii.side` | Side of a table. | │ | Char | |
| 111 | +| `ascii.topT` | Top T of a table. | ┬ | Char | |
| 112 | +| `ascii.bottomT` | Bottom T of a table. | ┴ | Char | |
| 113 | +| `ascii.leftT` | Left T of a table. | ├ | Char | |
| 114 | +| `ascii.rightT` | Right T of a table. | ┤ | Char | |
| 115 | +| `ascii.cross` | Cross of a table. | ┼ | Char | |
| 116 | +| `ascii.horizontal` | Horizontal line of a table. | ─ | Char | |
| 117 | +| `ascii.vertical` | Vertical line of a table. | │ | Char | |
| 118 | + |
| 119 | + |
| 120 | +## How to contribute |
| 121 | +Contributing is super easy. Just add a new game to the games folder and follow the instructions above. Then create a pull request and I will review it. |
0 commit comments