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 boolean isMotherOf(Person arg){ | |
try { | |
this.equals(arg.mother); | |
this.children.contains(arg); | |
} catch (NullPointerException npe) { | |
return false; | |
} | |
return this.equals(arg.mother) && this.children.contains(arg); | |
} |
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
for (int i = 0; i < 100;i++) { | |
someobj c = new someobj(); | |
} | |
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 testBot1; | |
import robocode.*; | |
import java.awt.Color; | |
import java.util.Random; | |
public class Marvin extends Robot { | |
/** |
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 math | |
def eval_func(function, lo, hi, n): | |
# Takes a function, and evaluates it in n points evenly distributed from lo to hi | |
step = abs(lo-hi)/float(n) | |
ret = [] | |
for i in xrange(n+1): | |
ret.append(function(lo + i*step)) | |
return ret |
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 imagestuff | |
import numpy as np | |
def coeff(n, funcvec): | |
ret = 0.0 | |
L = len(funcvec) | |
if n == 0: | |
for i in xrange(0, L): | |
ret += funcvec[i] | |
ret /= float(L) |
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
def fizzBuzz(n): | |
pos = [["FizzBuzz", "Fizz"], ["Fizz", ""]] | |
for i in range(n): | |
a = int(math.ceil((i%3) / float(n))) | |
b = int(math.ceil((i%5) / float(n))) | |
print i , ": " , pos[a][b] | |
fizzBuzz(100) |
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
class Player(self): | |
name = "" | |
score = 0 | |
thrown = 0 | |
throws_left = 10 | |
def __init__(self, name="Anon"): | |
self.name = name | |
def throw(self): |
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
Start: | |
LDR R0, =0b00000100 | |
LDR R1, =0x40006500 | |
STR R0, [R1] |
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
#include <stdint.h> | |
#include <stdbool.h> | |
#include "em_device.h" | |
#include "em_chip.h" | |
#include "em_cmu.h" | |
#include "em_emu.h" | |
#include "bsp.h" | |
#include "bsp_trace.h" | |
/**************************************************************************//** |
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
Start: | |
LDR R0, =GPIO_BASE | |
MOV R1, #0xA0 | |
ADD R0, R0, R1 | |
MOV R1, #0b0000100 | |
STR R1, [R0] |
OlderNewer