Skip to content

Instantly share code, notes, and snippets.

View oyvindrobertsen's full-sized avatar

Øyvind Robertsen oyvindrobertsen

  • spacemaker.ai
  • Oslo, Norway
View GitHub Profile
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);
}
for (int i = 0; i < 100;i++) {
someobj c = new someobj();
}
package testBot1;
import robocode.*;
import java.awt.Color;
import java.util.Random;
public class Marvin extends Robot {
/**
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
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)
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)
class Player(self):
name = ""
score = 0
thrown = 0
throws_left = 10
def __init__(self, name="Anon"):
self.name = name
def throw(self):
Start:
LDR R0, =0b00000100
LDR R1, =0x40006500
STR R0, [R1]
#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"
/**************************************************************************//**
Start:
LDR R0, =GPIO_BASE
MOV R1, #0xA0
ADD R0, R0, R1
MOV R1, #0b0000100
STR R1, [R0]