Skip to content

Instantly share code, notes, and snippets.

View Kneelawk's full-sized avatar

Cyan Kneelawk

View GitHub Profile
@Kneelawk
Kneelawk / Board.java
Last active March 22, 2020 05:44
My Final Tic Tac Toe project source code
// Jed Pommert
// CS 141
// Final Tic Tac Toe Discussion
import java.util.Arrays;
/**
* Board represents a game board with a variable width and height along with various management
* methods for both Tic-Tac-Toe and Connect-4, such as checking win conditions and placing tokens.
*/
private void moveBall(GOval ball, int height, int width, GRect paddle) {
// Update ball position
ball.setLocation(ball.getX() + vx, ball.getY() + vy);
// Make sure ball Y is within the area
if (ball.getY() <= 0) {
ball.setLocation(ball.getX(), 0);
vx += getVelOff();
vy = Math.abs(vy);
} else if (ball.getY() + BALL_RADIUS * 2 >= height) {