Skip to content

Instantly share code, notes, and snippets.

@richardliaw
richardliaw / Board.java
Last active August 29, 2015 13:57
Project 2
package player;
public abstract class Board {
/**
* @param args
*/
public boolean isValidMove(Move m){
return false;
package player;
public class MyBoard extends Board {
private Piece[][] pieces = new Piece[8][8];
public Piece[][] getArray(){
return pieces;
}
#problem e
#Sk is total number of heads in trial of k total coin cosses
def deviation(k, p, e):
deviate = abs(numHeads(k,p) - k*p)
return deviate >= e*k
def probOfDeviation(numOfTrials, numOfTosses, prob, error):
actual = (prob*(1-prob)/(numOfTosses*error**2))
calculated = 0
private boolean networkParser(int playerColor) {
//find piece on left side and right side
boolean hasLeft,hasRight,hasTop,hasBottom;
Piece[] networkTop, networkBottom, networkLeft, networkRight;
if (playerColor == 0){
hasTop = false;
hasBottom = false;
networkTop = new Piece[8];
networkBottom = new Piece[8];
package player;
public abstract class MyBoard {
/**
* @param args
*/
private Piece[][] pieces = new Piece[8][8];
public boolean isValidMove(Move m){
return false;
@richardliaw
richardliaw / gist:9964058
Last active August 29, 2015 13:58 — forked from maxzhang000/gist:9961793
Making edits as we go, fixing up the style
public boolean networkParser(int playerColor) {
boolean hasLeft,hasRight,hasTop,hasBottom;
Piece[] networkTop, networkBottom, networkLeft, networkRight;
if (playerColor == 0){
hasTop = false;
hasBottom = false;
networkTop = new Piece[8];
networkBottom = new Piece[8];
class Receiver:
def __init__(self, num_chunks, channel):
self.num_chunks = num_chunks
self.received_packets = []
self.chunks = [ ]
for i in range(self.num_chunks):
self.chunks.append( np.zeros(Packet.size_of_packet, 'uint8') )
self.found = [ False for x in range(self.num_chunks) ]
self.channel = channel
@richardliaw
richardliaw / helloitsme.py
Last active February 17, 2016 06:36
TEST REWARDS RLPY HELP ME
[[0.0, 0.0, 0.03, 0.0],
[0.01, 0.0, 0.06, -0.02],
[0.03, -0.0, 0.09, -0.05],
[0.05, -0.0, 0.12, -0.1],
[0.09, -0.01, 0.15, -0.17],
[0.13, -0.01, 0.18, -0.26],
[0.19, -0.03, 0.21, -0.36],
[0.25, -0.05, 0.24, -0.48],
[0.31, -0.08, 0.27, -0.62],
[0.37, -0.13, 0.3, -0.78],
[[0.0, 0.0, 0.03, 0.0],
[0.05, -0.0, 0.12, -0.1],
[0.19, -0.03, 0.21, -0.36],
[0.36, -0.11, 0.18, -0.48],
[0.48, -0.18, 0.09, -0.48],
[0.53, -0.2, 0.0, -0.48],
[0.51, -0.19, -0.09, -0.48],
[0.41, -0.14, -0.18, -0.48],
[0.25, -0.05, -0.27, -0.48],
[0.01, 0.07, -0.3, -0.48],
[[0.0, 0.0, 0.03, 0.0],
[0.05, -0.0, 0.12, -0.1],
[0.17, -0.02, 0.09, -0.33],
[0.22, -0.04, 0.0, -0.43],
[0.19, -0.03, -0.09, -0.38],
[0.09, 0.0, -0.18, -0.17],
[-0.1, 0.01, -0.27, 0.19],
[-0.34, -0.08, -0.3, 0.35],
[-0.6, -0.12, -0.3, -0.17],
[-0.85, -0.03, -0.3, -0.69],