This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import zen.core.Zen; | |
public class Card { | |
public static final int HEART = 1; | |
public static final int DIAMOND = 2; | |
public static final int SPADE = 3; | |
public static final int CLOVER = 4; | |
public static final int JACK = 11; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void step() { | |
boolean[][] newGrid = new boolean[50][50]; | |
for (int x = 0 ; x < 50 ; x++) { | |
for (int y = 0 ; y < 50 ; y++) { | |
// Get how many neighbors this cell has. | |
int count = neighbors(x, y); | |
// 1. If the square is alive, but has less than two neighbors, it dies. | |
if (grid[x][y] == true && count < 2) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.File; | |
import java.io.FileNotFoundException; | |
import java.util.ArrayList; | |
import java.util.Arrays; | |
import java.util.HashMap; | |
import java.util.Map; | |
import java.util.Scanner; | |
public class MarkTwainWroteIt { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Move { | |
private int x; | |
private int y; | |
public Move(int x, int y) { | |
this.x = x; | |
this.y = y; | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Board { | |
private int[][] board; | |
private int current = 1; | |
private int empty = 9; | |
private int winner = 0; | |
/** | |
* Creates a new board. | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import zen.core.Zen; | |
public class RainbowSort { | |
// Just some utility stuff, leave these variables alone. | |
private static boolean visualized = false; | |
private static int size = 500, step = 1; | |
private static int min = 0, max = 0; | |
private static int[] cache; | |
// Creates an array and visualizes the sorting of it. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> | |
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet"> | |
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script> | |
<style> | |
</style> | |
</head> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.awt.event.ActionEvent; | |
import java.awt.event.ActionListener; | |
import java.io.File; | |
import java.io.FileNotFoundException; | |
import java.util.Scanner; | |
import javax.swing.JFileChooser; | |
import javax.swing.JFrame; | |
import javax.swing.JMenu; | |
import javax.swing.JMenuBar; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package PhotoEditor; | |
import java.io.File; | |
import java.io.FileNotFoundException; | |
import java.util.HashMap; | |
import java.util.Scanner; | |
public class HashMapFun { | |
public static void main(String[] args) { | |
HashMap <String, Integer> wordFrequency = new HashMap <String, Integer> (); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package PhotoEditor; | |
import java.util.ArrayList; | |
public class Calculator { | |
public int calculate( String expression ) { | |
// Split it apart | |
String[] parts = splitApart(expression); | |
// Make two lists, one for numbers and another for operators |