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 random | |
currentround = 0 | |
rounds = 5 | |
while currentround < rounds: | |
currentround + 1 | |
answer = input("Select rock paper or scissors") | |
while answer != "rock" and answer != "paper" and answer != "scissors": | |
print "Bad answer" |
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.*; | |
public class MyGame extends ZenGame { | |
// What code should happen when you click run? | |
public static void main(String[] args) { | |
MyGame game = new MyGame(); | |
game.setName("My first game!"); | |
game.setSize(800, 600); | |
game.run(); |
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
boolean view[7][7]; | |
void setup() { | |
for (int i = 0 ; i < 14 ; i++) { | |
pinMode(i, OUTPUT); | |
digitalWrite(i, LOW); | |
} | |
for (int x = 0 ; x < 7 ; x++) { | |
for (int y = 0 ; y < 7 ; 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
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 |
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
<!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
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
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
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 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) { |
OlderNewer