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.
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.
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.
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.
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.
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.
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.
- 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.
- 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.
-
Input Handling:
- The application captures the code from the
TextArea
fields for the test case generator, solution, and brute-force solution.
- The application captures the code from the
-
File Writing:
- The input code is written to corresponding
.java
files:Generator.java
,Solution.java
, andBruteForce.java
.
- The input code is written to corresponding
-
Compilation:
- The Java files are compiled using the
JavaCompiler
class.
- The Java files are compiled using the
-
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.
-
Output Display:
- The result of each test case is displayed in the
outputTextArea
field.
- The result of each test case is displayed in the
- 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.
- Clone the Repository:
git clone https://github.com/yourusername/stress-tester.git
- Open the Project:
- Open the project in your preferred Java IDE.
- Run the Application:
- Run the main application and input your test case generator, solution, and brute-force solution in the respective text areas.
- Start Testing:
- Click the "Start" button to begin the stress testing process.
- View the results in the output area.
- Java 8 or higher
- JavaFX library
Feel free to submit issues or pull requests to contribute to this project.
This project is licensed under the MIT License.
Allows users to search public workouts based on stroke and distance. Also allows them to register / login and create their own workouts.
Has two dropdowns that allows users to search workouts based on stroke and distance.
If logged in, a user can create a workout. This is prevented if you are just a guest user.
If logged in, a user can view their own workouts. They can also edit or delete each workout.
Allows user to register or login to their account.
- Download this repo as a zip and uncompress
- Run npm install on both the client and server directories
- Run
npm run dev
in the server directory - Run
npm start
in the client directory
- Add Procfile and write
web src/index.js
- Run
npm build
in the client directory - Copy that content and put it in a folder called "public" in the server directory
- Deploy with Heroku CLI instructions
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
Attributes: Color, position
Methods: Change color
Attributes: Image name, tool / icon name, position
Methods: Draw border
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
Attributes: Position
Methods: Update - Sets to visible or transparent depending on mouse size
Attributes: Color, position
Methods: Draw circle - draws a circle in the box if it is selected
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)
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
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
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)
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
Program Purpose: Generates a maze that then solves itself
Language: Python and Pygame
Algorithm: Randomized DFS / Floodfill / Recursive Backtracking
Wikipedia Algorithm Pseudocode
Screen.Recording.2021-06-04.at.11.57.55.PM.mov
- Maintain a matrix that keeps track of visited cells
- Maintain a stack that keeps track of cells on the current path
- Start at the top left cell
- Randomly choose one of the available neighbor cells
- If there are none, go to previous cell in the stack
- Color visited cells blue, current cell blue, and remove the white wall
- Will eventually return to the top left cell and guarantees a maze
- Maintain a matrix that keeps track of visited cells
- Maintain a stack that keeps track of cells on the current path
- Start at the top left cell
- Randomly choose one of the available neighbor cells without a wall
- If there are none, go to previous cell in the stack
- Color visited cells green and current cell red
- Will eventually reach the bottom right cell, at which point the program restarts
- 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
- Simulation Function
- Generation - Find next cell, check if it is inbounds and unvisited, remove the wall, move to that cell
- Solving - Find next cell, check if it is inbounds and unvisited, move to that cell
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
[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
- Begin The Game
.start @player1 @player2
- Start The Round
.next
- Choose Your Number
Simply click a button. The results will appear once everyone has chosen a number
- End The Game
.end
[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.
- Every live cell with 2 or 3 neighbors lives on.
- Every live cell with 4 neighbors dies due to overpopulation.
- Every live cell with 1 neighbor dies due to underpopulation.
- Every dead cell with 3 neighbors is reborn due to reproduction.
[Repository Link](https://github.com/joshualiu555/Chaos-Game "Repository)
A Pygame program that simulates the Chaos Game theory to generate a fractal.
- Draw three dots in the form of a triangle
- Start at point 1
- Randomly choose a point 1-3
- Draw a dot in the middle of those two points
- This dot is your new point
- Repeat from step 3 continuosly
You wil eventually draw the Sierpinski triangle
[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.
- Type Your Username
- Choose how many rounds someone has to win for the game to end.
- Start the Game
- Choose your icon
- Click shoot
The result will appear and you keep playing until the game ends.