radius r =
384000 km
384000000 m
period p =
27.3 days
2358720 s
moon's speed =
d / t
import numpy as np | |
charWidth = 3 | |
char2index = { c : i*charWidth for i,c in enumerate('0123456789: ')} | |
bigAlphabet = ''' | |
_ _ _ _ _ _ _ _ | | |
| | | _| _||_||_ |_ ||_||_| . | | |
|_| ||_ _| | _||_| ||_| | . | | |
'''[1:-1].split('\n') | |
bigAlphabet = np.array(list(map(list, bigAlphabet))) |
// Counts how often a sequence zig zags. | |
// ie. switches from increasing to decreasing or from decreasing to increasing | |
// countZigZags([]) --> 0 | |
// countZigZags([5,5,5,5]) --> 0 | |
// countZigZags([1,2,3]) --> 0 | |
// countZigZags([1,2,3,2,1]) --> 1 | |
// countZigZags([5,6,5,6,5]) --> 3 | |
// countZigZags([2,2,2,6,6,5,5]) --> 1 | |
function countZigZags(numbers) { |
# Find a number n which is_twice_as_shifty(n) | |
def is_twice_as_shifty(n): | |
n = int(n) | |
if n < 1: | |
return False | |
n_str = str(n) | |
n_times_two_str = n_str[-1] + n_str[:-1] # Shift the digits around | |
n_times_two = int(n_times_two_str) |
const rp = require('request-promise-native'); | |
const crypto = require('crypto'); | |
const assert = require('assert'); | |
const signatureMethod = 'RSA-SHA256' | |
const protocolVersion = '0.0.1'; | |
const signatureEncoding = 'base64'; | |
class RpcClient { |
from inputs import get_gamepad # pip install inputs | |
import threading | |
def deadzone(normalized_axis): | |
if abs(normalized_axis) < 0.1: return 0.0 | |
return normalized_axis | |
class ControllerInput: | |
def __init__(self): | |
# self.fThrottle = 0.0 |
#include <iostream> | |
// File x.h | |
// This class was named X to be consistent with http://www.gotw.ca/gotw/076.htm | |
// | |
// Its primary purpose is to hold a private value which no one should be able | |
// to accidentally modify. | |
class X | |
{ | |
public: |
#include <iostream> | |
// This class was named X to be consistent with http://www.gotw.ca/gotw/076.htm | |
// | |
// Its primary purpose is to hold a private value which no one should be able | |
// to accidentally modify. | |
class X { | |
public: | |
X() : private_(1) { /*...*/ } | |
int getValue() { return private_; } |
In some future time, once bars may open again, Alice and her partner Bob head over to indulge in this way of socializing again. There are four other couples in the bar which, eager for social contact, do these cute footshakes with each person they haven't met before. After this initial mingling, Alice asks everyone how many people they did footshakes with. As some people knew each other beforehand, she gets nine different answers back.
How many footshakes did Bob do?
You play a game against Malory, in which you choose points on the 2D plane and Malory wins if she can cover them by using non-overlapping pennies (disks of radius 1). Show a minimal set of points that guarantees you a win.
Hint
At low numbers of dots, Malory is favoured (if there is 1 dot, just cover it with 1 circle), and at high numbers of dots you are favoured (e.g. by using a grid approach like https://www.desmos.com/calculator/gwwcn40xcp)
Here's something that'll let you test out your theories: https://www.desmos.com/calculator/ifhtfwhnqm