This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""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') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 } |