Skip to content

Instantly share code, notes, and snippets.

import math, re
from stack import *
class RPNCalculator:
def __init__(self):
self.data = stack()
# Create lists of valid operators.
self.lang_operators = ["+", "-", "*", "/", "**", "//"]
self.binary_operators = []
class GameEngine
constructor: ->
@bg = document.getElementById("bg").getContext("2d")
@fg = document.getElementById("fg").getContext("2d")
@gW = 5000
@gH = 3750
@vW = @fg.canvas.width
@vH = @fg.canvas.height
@dX = (@gW - @vW) / -2
class Game
constructor: ->
@ctx = document.getElementById("game").getContext("2d")
@ctx.canvas.style.background = "#000"
@startAngle = (5 * Math.PI) / 6
@endAngle = Math.PI / 6
@curSA = @startAngle
@curEA = @endAngle
@notifier = document.createElement("canvas")
@notifier.width = 64;
Your score: 18 (17 good, 4 not found, 1 too short, 1 repeated)
Your score: 33 (20 good, 4 not found, 2 too short, 2 repeated)
Your score: 23 (21 good, 5 not found, 2 too short, 4 repeated)
Your score: 13 (5 good, 0 not found, 0 too short, 0 repeated)
Your score: 24 (4 good, 1 not found, 0 too short, 0 repeated)
def unique(l):
return list(set(l))
def check(board, needle, path, pos):
if pos[0] < 0 or pos[0] > 3: return False
if pos[1] < 0 or pos[1] > 3: return False
if pos in path: return False
return board[pos[0]][pos[1]] == needle
def search(board, needle, pos, path = []):
#include <iostream>
#include <math.h>
using namespace std;
bool isCrystal(int m, int x, int y) {
int curX = x;
int curY = y;
for (int curM = m; curM > 0; curM--) {
int majorSize = pow(5, curM) / 5;
#include "WPILib.h"
#include "S5.h"
#define dashboard SmartDashboard::GetInstance()
static void PeriodicTask(S5 *encoder) {
while (1) {
encoder->Periodic();
Wait(0.005);
}
0xD # Correct start sequence byte one
0xA # Correct start sequence byte two
0x13 # Garbage....
0xD8 # ...
0x1 # ..
0x7E # Correct start sequence byte three
0x70 # Correct command ID
0x12 # Data count
0x1F # data
0x0
#include "TruePoint.h"
#define INT(name) (name) = GetInt(); printf("(name) int")
#define ANGLE(name) (name) = GetKang(); printf("(name) angle")
static void ComTask(TruePoint *truePoint) {
while (true) {
truePoint->Process();
Wait(0.005);
}
startSequence = [0x0D, 0x0E, 0x7E]
expectedByte = 0
packetByteCount = 0
currentPacketID = 0
dataSize = 0
loop:
byte = getByte()
if byte == startSequence[expectedByte]: