我爱你

Portfolio

June 1, 2025

Collision Simulation
in Python

Tetris

each frame the simulator computes pairwise circle–circle collisions by first checking whether the squared center‑to ‑center distance ≤ (2 × radius + margin)², and when a collision is detected it moves into an elastic‑collision routine: it constructs the normalized impact normal by dividing the displacement vector by its Euclidean norm, projects each circle’s velocity onto that normal (v₁ₙ, v₂ₙ) and its perpendicular tangent, swaps the normal components (thereby exchanging momentum along the line of impact), then recombines them with the unchanged tangential components to yield new velocities. Wall collisions are handled similarly but simply by negating the velocity component on the axis where the circle breaches the ±bounds limit. Velocities are initialized by randomly partitioning a fixed speed into x/y components (with optional sign flips), positions are seeded uniformly within each quadrant, and to prevent “stuck” or pathological overlap states, the code counts collisions per frame and, if it exceeds a threshold, re‑randomizes all positions and velocities. Finally, Matplotlib’s FuncAnimation with blitting is used to efficiently update only the four Circle patches each 20ms.

January 18,2025

Breakout
in Java

Breakout is a classic arcade game where players control a paddle at the bottom of the screen to bounce a ball upward, breaking rows of bricks. The goal is to clear all the bricks without letting the ball fall past the paddle. Players move the paddle side to side to keep the ball in play, and as the game progresses, the ball speeds up, making it more challenging. Some versions include power-ups, different brick types, and multiple balls. The game requires precision, timing, and strategy to succeed.

January 12, 2025

Connect 4
in Python

Connect4

Connect 4 is a two-player strategy game where players take turns dropping colored discs into a 7-column, 6-row grid. The goal is to connect four discs in a row—vertically, horizontally, or diagonally—while blocking the opponent. Discs fall to the lowest available space, and the game ends when a player wins or the grid is full, resulting in a draw.

January 5, 2025

Snake
in Python

Snake Game

Snake is a classic arcade game where players control a growing snake that moves around the screen, eating food to increase in length. The goal is to survive as long as possible without running into the walls or the snake’s own body. Players can change the snake’s direction but cannot stop its movement. As the snake grows, maneuvering becomes more challenging, requiring quick reflexes and careful planning. The game ends when the snake collides with an obstacle, making it a test of skill and strategy.

December 28, 2024

Tictactoe
in c++

TicTacToe

Tic-Tac-Toe is a simple two-player game played on a 3×3 grid. Players take turns marking empty spaces with either an “X” or an “O,” aiming to form a row, column, or diagonal of three matching symbols. The game ends when a player achieves this or when all spaces are filled, resulting in a draw if no one wins. Tic-Tac-Toe is a game of strategy and foresight, often ending quickly with experienced players.

December 15, 2024

Binary Converter
in Java

Binary Converter

A binary converter is a program that converts numbers between binary (base 2) and other number systems, such as decimal (base 10) or hexadecimal (base 16). It takes user input in one format, processes it using Java’s built-in number conversion methods or custom logic, and outputs the equivalent value in another format. The converter may also handle binary-to-text conversions, allowing users to encode or decode binary messages.

December 3, 2024

Calculator
in Python

Calculator

A simple GUI-based calculator built using Python's Tkinter library. It allows users to input two numbers, select an arithmetic operator (+, -, *, /), and compute the result. The program includes error handling for invalid inputs and division by zero, displaying appropriate error messages using Tkinter's messagebox. The user interface consists of entry fields for numbers, a dropdown menu for selecting the operator, a calculate button, and a label to display the result.