Skip to content

Instantly share code, notes, and snippets.

CELO_VALIDATOR_GROUP_ADDRESS=0456e7b4b6a7e25f167f4ebeb17b7268e36af4f8 CELO_VALIDATOR_ADDRESS=7059f5038a97cb70f37c73fadae11b83dca982a8

@nambrot
nambrot / minsweeper.ruby
Created August 15, 2018 03:15
Minesweeper
require 'json'
class Minesweeper
def initialize(n, m, number_of_mines)
@n = n
@m = m
@number_of_mines = number_of_mines
@user_board = []
@visible = []
import java.io.*;
import java.util.*;
/*
* To execute Java, please define "static void main" on a class
* named Solution.
*
* If you need more classes, simply define them inline.
*/
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Approximate q-learning\n",
"\n",
"In this notebook you will teach a __tensorflow__ neural network to do Q-learning."
]

Keybase proof

I hereby claim:

  • I am nambrot on github.
  • I am nambrot (https://keybase.io/nambrot) on keybase.
  • I have a public key ASDfEQ9ohfu9htqGyMQjafRCaqXKvag1AeWymD3d81dOMwo

To claim this, I am signing this object:

This is a list of links for my kindle
PCollection<KV<Integer, Iterable<Alert>>> sessionedAlerts = alerts
.apply(Window.remerge())
.apply(Window.into(Sessions.withGapDuration(Duration.standardHours(1))))
.apply(MapElements.via((Alert event) -> KV.of(event.userId, event)).withOutputType(new TypeDescriptor<KV<Integer, Alert>>() {}))
.apply(GroupByKey.create());
PCollection<Alert> throttledAlerts = sessionedAlerts
.apply(FlatMapElements.via((KV<Integer, Iterable<Alert>> pair) -> {
ArrayList<Alert> acc = new ArrayList<>();
FluentIterable
final TupleTag<BloodPressureEvent> bpTag = new TupleTag<>();
final TupleTag<HeartRateEvent> hrTag = new TupleTag<>();
PCollection<KV<Integer, CoGbkResult>> joined =
KeyedPCollectionTuple.of(bpTag, bpEvents)
.and(hrTag, hrEvents)
.apply(CoGroupByKey.create());
PCollection<Alert> alerts = joined.apply(FlatMapElements.via((KV<Integer, CoGbkResult> pair) -> {
CoGbkResult result = pair.getValue();
Boolean hasLowSystolic = FluentIterable.from(result.getAll(bpTag)).anyMatch((BloodPressureEvent event) -> event.systolic < 100);