Skip to content

Instantly share code, notes, and snippets.

"""Script to automate insertion of values in Google Sheets.
Google Sheets API credentials are required that can be obtained at
https://console.developers.google.com/flows/enableapi?apiid=sheets.googleapis.com
Example usage:
client = GoogleSheetsClient('https://docs.google.com/spreadsheets/d/.../edit#gid=0',
'./client_secret.json')
client.set_cell_value('Column name', 'Row name', 'New value')
set_value = client.get_cell_value_formatted('Column name', 'Row name')
from heapq import heappop, heappush
import itertools
class Node:
'Represents a vertex in an undirected weighted graph'
def __init__(self, index):
self.index = index
self.parent = None
@anikkon
anikkon / BattleshipSimulation.kt
Last active December 25, 2017 23:06
BATTLESHIP SIMULATION
val random = java.util.Random()
data class TorpedoAttack(val source: Int, val target: Int)
// CommandCenter interface with the default behaviour
interface CommandCenter {
fun fireTorpedo(ships: BooleanArray): TorpedoAttack {
// Flagship is marked as Boolean TRUE
val flagship = ships.indexOfFirst { it }