Skip to content
View joshualiu555's full-sized avatar

Block or report joshualiu555

Block user

Prevent this user from interacting with your repositories and sending you notifications. Learn more about blocking users.

You must be logged in to block users.

Please don't include any personal information such as legal names or email addresses. Maximum 100 characters, markdown supported. This note will be visible to only you.
Report abuse

Contact GitHub support about this user’s behavior. Learn more about reporting abuse.

Report abuse
joshualiu555/README.md

My Portfolio

Stupid Superpowers

Repository Link

Website Link

This is the web version of a card game I made with two friends called "Stupid Superpowers." It is an "Apples to Apples" or "Cards Against Humanity" remake with only stupid superpowers. My web stack consisted of HTML, CSS, React, Node.js, Express.js, and Socket.io, multiple npm packages (profanity checker, random name generator, countdown). The website was deployed on Heroku.

There is no account creation, as the game is meant to be played casually without any need for progress.

Screen Shot 2023-01-02 at 7 56 30 PM

How The Code Works

Layout

I used flexbox to format the homescreen, lobby, and result screen in columns and rows. I used grid to format the game screen. This made separating the prompt, cards, scoreboard, and chat very simple.

Frontend and Backend

Whenever a user clicks something on the frontend, socket.io emits certain parameters such as player id to the backend "database." The backend then works through the array and does its magic, as I will describe below.

Joining a Game

Here's how the temporary "database" is formatted.

  • Array of Games
    • Game Attributes: Color, Code, Prompts, etc.
    • Chat
    • Array of Players
      • Player Attributes: Score, Powers, etc.

When a player joins a game, whether randomly or by code, the program searches for a valid room and allows them to join the lobby. Otherwise, an error message shows up.

Playing the Game

There is a countdown that works by resetting the React state every second. When a player chooses a card, they can submit and that changes their player attribute. When every player has selectd, the game attribute changes to "voting." The voting system works similar to the selecting system. When everyone votes, the highest scoring players get an extra point to their score. If someone has reached 7, the winning screen occurs. Otherwise, the game chooses the next prompt card in the deck. Each player then discards a power from their array and randomly picks a new one.

Chat

Each game has an array of chats. When a player enters a chat, the program finds the game code, and registers it into its chat array. Socket.io then sends the text back to the frontend.

Stress Tester

This Java application is designed to facilitate stress testing for coding solutions by comparing the output of a user-written solution against a brute-force solution using generated test cases. The application leverages JavaFX for a graphical user interface, allowing users to input their code directly into text areas.

Features

  • Test Case Generation: Automatically generates test cases using user-provided code.
  • Solution Testing: Runs both the user's solution and a brute-force solution on the generated test cases.
  • Output Comparison: Compares the outputs of the two solutions to verify correctness.
  • User Interface: Simple and interactive UI to input code and view results.

How It Works

Components

  • Text Areas: Users input their test case generator, solution, and brute-force solution code into the corresponding TextArea fields.
  • Compilation: The provided code is compiled at runtime using the Java Compiler API.
  • Execution: The test case generator code is executed to produce input data, which is then fed into both the solution and brute-force solution for comparison.
  • Output: The application displays whether the solution passed or failed the test case. In the event of a failure, it shows the test case input, the user's solution output, and the expected output.

Detailed Flow

  1. Input Handling:

    • The application captures the code from the TextArea fields for the test case generator, solution, and brute-force solution.
  2. File Writing:

    • The input code is written to corresponding .java files: Generator.java, Solution.java, and BruteForce.java.
  3. Compilation:

    • The Java files are compiled using the JavaCompiler class.
  4. Execution:

    • A separate thread is created to handle the execution and comparison process.
    • The test case generator (Generator.java) is executed, and its output is captured.
    • This output is then fed into both the solution (Solution.java) and brute-force solution (BruteForce.java).
    • The outputs of both solutions are compared:
      • If they match, the test case is marked as passed.
      • If they differ, the application stops and displays the failed test case details, including the input and both outputs.
  5. Output Display:

    • The result of each test case is displayed in the outputTextArea field.

Thread Management

  • The application uses a separate thread (runningThread) to manage the execution of test cases, allowing it to handle multiple cases in sequence without freezing the UI.
  • The thread is set as a daemon, ensuring it doesn't prevent the application from shutting down.

How to Use

  1. Clone the Repository:
    git clone https://github.com/yourusername/stress-tester.git
  2. Open the Project:
    • Open the project in your preferred Java IDE.
  3. Run the Application:
    • Run the main application and input your test case generator, solution, and brute-force solution in the respective text areas.
  4. Start Testing:
    • Click the "Start" button to begin the stress testing process.
    • View the results in the output area.

Requirements

  • Java 8 or higher
  • JavaFX library

Contributing

Feel free to submit issues or pull requests to contribute to this project.

License

This project is licensed under the MIT License.

Screenshot 2024-08-11 at 11 55 29 AM

Find-A-Swim

Allows users to search public workouts based on stroke and distance. Also allows them to register / login and create their own workouts.

Website Link

Public Workouts

Has two dropdowns that allows users to search workouts based on stroke and distance.

Screen Shot 2023-12-03 at 7 00 02 PM

Create Workout

If logged in, a user can create a workout. This is prevented if you are just a guest user.

Screen Shot 2023-12-03 at 7 01 03 PM

My Workouts

If logged in, a user can view their own workouts. They can also edit or delete each workout.

Screen Shot 2023-12-03 at 7 01 40 PM

Login / Register

Allows user to register or login to their account.

Screen Shot 2023-12-03 at 7 02 05 PM

See For Yourself

  1. Download this repo as a zip and uncompress
  2. Run npm install on both the client and server directories
  3. Run npm run dev in the server directory
  4. Run npm start in the client directory

Deploy to Heroku

  1. Add Procfile and write web src/index.js
  2. Run npm build in the client directory
  3. Copy that content and put it in a folder called "public" in the server directory
  4. Deploy with Heroku CLI instructions

Pixel Art Maker

Repository Link

Link to Project

Program Purpose: Allows the user to make pixel art

Features: 16 colors, pencil, eraser, trashcan, square, line, bucket, undo / redo, export, different mouse size

Language: Python and Pygame

Inspired by pixilart

14:31:58

Class Overview

Pixel

Attributes: Color, position

Methods: Change color

Icon - Pencil, eraser, trashcan, etc.

Attributes: Image name, tool / icon name, position

Methods: Draw border

Mouse

Attributes: Size, color

Methods: Update - Highlights current pixel, becomes transparent if it is not on the board, changes cursor to diamond if it is on the board

Mouse Box - Boxes that show the size of the mouse

Attributes: Position

Methods: Update - Sets to visible or transparent depending on mouse size

Color Box - 16 of these that each represent a color presented in a grid

Attributes: Color, position

Methods: Draw circle - draws a circle in the box if it is selected

Tool - Each icons individual function when called

Trashcan: Erases the whole board and resets the alternating gray and white grid

Export: Takes a picture of the canvas and saves it to a screenshot folder

Bucket: Fills the surrounding area with a color

Pencil: Changes a pixel's color

Eraser: Resets a pixel's color to its original gray or white

Square: Creates a square based on 2 selected points (Bugs - Sometimes doesn't respond, when undoing, the second point is erased too)

Line: Creates a line based on 2 selected points (Bugs - same as square)

Undo: Reverses the board to the previous state (Bugs - takes 2 clicks for the first undo)

Redo: Restores the board to the state you just had (Bugs - same as undo)

How the program works - main.py

new() - initializing everything

The board and current selections (tool, mouse size, color) are created using a text file that allows for saving previous work.

Each class has its own sprite group and list containing instance

run() - performs every essential part of the game loop
events() - checks for mouse or keyboard events

Checks for escape key to exit. If it is, the program saves the current board and selections.

Checks if the mouse is being clicked. Everytime the mouse is released, a new board state is pushed to the undo stack

Checks for arrow keys to change the mouse size

update() - hanges the board and current selection

Checks if there the mouse and pixel collide. If they do, they perform the necessary function based on the current tool.

Checks if a color box or tool has been selected.

Updates the amount of mouse boxes to be shown.

Updates every sprite (polymorphism)

draw() - fills the screen, draws the sprites and borders, updates the display
program instance - creates the program

Install as an executable file

Open the terminal / command line

pip install pyinstaller

Open up a terminal / command line inside the directory

pyinstaller --add-data "board.txt:." --add-data "reset.txt:." --add-data "selections.txt:." --add-data "icons:icons" --add-data "screenshots:screenshots" main.py

Go to dist and select main.exe

Maze Generator And Solver

Program Purpose: Generates a maze that then solves itself

Language: Python and Pygame

Algorithm: Randomized DFS / Floodfill / Recursive Backtracking

Link to Project

Wikipedia Algorithm Pseudocode

Inspired by The Coding Train

Screen.Recording.2021-06-04.at.11.57.55.PM.mov

How the program works

Generation
  1. Maintain a matrix that keeps track of visited cells
  2. Maintain a stack that keeps track of cells on the current path
  3. Start at the top left cell
  4. Randomly choose one of the available neighbor cells
  5. If there are none, go to previous cell in the stack
  6. Color visited cells blue, current cell blue, and remove the white wall
  7. Will eventually return to the top left cell and guarantees a maze
Solving
  1. Maintain a matrix that keeps track of visited cells
  2. Maintain a stack that keeps track of cells on the current path
  3. Start at the top left cell
  4. Randomly choose one of the available neighbor cells without a wall
  5. If there are none, go to previous cell in the stack
  6. Color visited cells green and current cell red
  7. Will eventually reach the bottom right cell, at which point the program restarts

Code Overview

  1. A matrix of cell classes: each cell instance maintains properties such as a wall array, visited / current booleans, and methods to draw to the screen
  2. Simulation Function
    1. Generation - Find next cell, check if it is inbounds and unvisited, remove the wall, move to that cell
    2. Solving - Find next cell, check if it is inbounds and unvisited, move to that cell

Install as executable file

Open the terminal / command line

pip install pyinstaller

Put maze.py inside of a folder called main (or whatever name you want)

Open up a terminal / command line inside the folder

pyinstaller --onefile -w maze.py

Go to dist and select main.exe

Strategy Steps

[Repository Link](https://github.com/joshualiu555/Strategy-Steps "Repository)

A recreation of the Wii Party Minigame, "Strategy Steps" Allows unlimited players (preferably 4) Each round, players select a number: 1, 3, 5 After each round, if a player is the only number to select that number, they move up that number of steps. First to 10 wins

The program uses the discord API and discord buttoms library. The entire game is asynchronous as it relies on user inputs.

It cannot support multiple games being played. When an request to start the game is entered, an array of players is made in this format.

  • Player array
    • Score, Number Chosen

Screen Shot 2023-01-02 at 4 05 32 PM

How To Play

  1. Begin The Game

.start @player1 @player2

Screen Shot 2023-01-02 at 4 06 31 PM

  1. Start The Round

.next

Screen Shot 2023-01-02 at 4 08 29 PM

  1. Choose Your Number

Simply click a button. The results will appear once everyone has chosen a number

Screen Shot 2023-01-02 at 4 10 19 PM

  1. End The Game

.end

Screen Shot 2023-01-02 at 4 11 13 PM

Conway's Game of Life

[Repository Link](https://github.com/joshualiu555/Game-Of-Life "Repository)

A Python / Pygame simulation of Conway's Game of Life

The entire simulation runs on a Program Class. Once an instance is initialized, the program creates a new board. Each cell is its own class and is able to change states. Once initialized, the program object begins an infinite while loop until the user exits the program.

There is a 2D Grid of cells. Each cell checks its 4 neighbors.

  1. Every live cell with 2 or 3 neighbors lives on.
  2. Every live cell with 4 neighbors dies due to overpopulation.
  3. Every live cell with 1 neighbor dies due to underpopulation.
  4. Every dead cell with 3 neighbors is reborn due to reproduction.

Screen Shot 2023-01-02 at 4 25 03 PM

Chaos Game

[Repository Link](https://github.com/joshualiu555/Chaos-Game "Repository)

A Pygame program that simulates the Chaos Game theory to generate a fractal.

  1. Draw three dots in the form of a triangle
  2. Start at point 1
  3. Randomly choose a point 1-3
  4. Draw a dot in the middle of those two points
  5. This dot is your new point
  6. Repeat from step 3 continuosly

You wil eventually draw the Sierpinski triangle

Screen Shot 2023-01-02 at 4 29 23 PM

Rock Paper Scissors

[Repository Link](https://github.com/joshualiu555/Rock-Paper-Scissors "Repository)

A Javascript rock paper scissors game that let's you type a username and select how many games to play against the CPU.

Main Menu

  1. Type Your Username
  2. Choose how many rounds someone has to win for the game to end.
  3. Start the Game

Screen Shot 2023-01-02 at 4 15 49 PM

Game Screen

  1. Choose your icon
  2. Click shoot

Screen Shot 2023-01-02 at 4 17 16 PM

The result will appear and you keep playing until the game ends.

Popular repositories Loading

  1. Maze-Generator-And-Solver Maze-Generator-And-Solver Public

    A Python program that generates a maze that solves itself using DFS

    Python 1

  2. joshualiu555 joshualiu555 Public

    Config files for my GitHub profile.

  3. Pixel-Art-Maker Pixel-Art-Maker Public

    A pygame app that allows the user to make pixel art with a variety of colors and tools

    Python

  4. Strategy-Steps Strategy-Steps Public

    A recreation of the Wii Party Minigame, "Strategy Steps" Allows unlimited players (preferably 4) Each round, players select a number: 1, 3, 5 After each round, if a player is the only number to sel…

    Python

  5. Game-Of-Life Game-Of-Life Public

    A Python / Pygame simulation of Conway's Game of Life

    Python

  6. Rock-Paper-Scissors Rock-Paper-Scissors Public

    A Javascript rock paper scissors game that let's you type a username and select how many games to play against the CPU.

    JavaScript