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
{"latitude": "12.986375", "user_id": 12, "name": "Chris", "longitude": "77.043701"} | |
{"latitude": "11.92893", "user_id": 1, "name": "Alice", "longitude": "78.27699"} | |
{"latitude": "11.8856167", "user_id": 2, "name": "Ian", "longitude": "78.4240911"} | |
{"latitude": "12.3191841", "user_id": 3, "name": "Jack", "longitude": "78.5072391"} | |
{"latitude": "13.807778", "user_id": 28, "name": "Charlie", "longitude": "76.714444"} | |
{"latitude": "13.4692815", "user_id": 7, "name": "Frank", "longitude": "-9.436036"} | |
{"latitude": "14.0894797", "user_id": 8, "name": "Eoin", "longitude": "77.18671"} | |
{"latitude": "13.038056", "user_id": 26, "name": "Stephen", "longitude": "76.613889"} | |
{"latitude": "14.1225", "user_id": 27, "name": "Enid", "longitude": "78.143333"} | |
{"latitude": "13.1229599", "user_id": 6, "name": "Theresa", "longitude": "77.2701202"} |
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
arr = [1, 2, 4, 10, 90, 302, 312, 500] | |
(2..arr.count).each do |len| | |
arr.combination(len).each do |comb| | |
sum = comb.inject(:+) | |
if arr.include? sum | |
puts (comb << sum).inspect | |
end | |
end | |
end |
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 setuptools import setup | |
# reading long description from file | |
with open('DESCRIPTION.txt') as file: | |
long_description = file.read() | |
# specify requirements of your package here | |
REQUIREMENTS = ['requests'] | |
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
var minimax = function (depth, game, isMaximisingPlayer) { | |
if (depth === 0) { | |
return -evaluateBoard(game.board()); | |
} | |
var newGameMoves = game.ugly_moves(); | |
if (isMaximisingPlayer) { | |
var bestMove = -9999; | |
for (var i = 0; i < newGameMoves.length; i++) { | |
game.ugly_move(newGameMoves[i]); | |
bestMove = Math.max(bestMove, minimax(depth - 1, game, !isMaximisingPlayer)); |
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
var calculateBestMove = function (game) { | |
var newGameMoves = game.ugly_moves(); | |
var bestMove = null; | |
//use any negative large number | |
var bestValue = -9999; | |
for (var i = 0; i < newGameMoves.length; i++) { | |
var newGameMove = newGameMoves[i]; | |
game.ugly_move(newGameMove); |
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
var calculateBestMove =function(game) { | |
//generate all the moves for a given position | |
var newGameMoves = game.ugly_moves(); | |
return newGameMoves[Math.floor(Math.random() * newGameMoves.length)]; | |
}; |
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
#include <cstdio> | |
#include <vector> | |
using namespace std; | |
#define root 0 | |
#define N 10100 | |
#define LN 14 | |
vector <int> adj[N], costs[N], indexx[N]; | |
int baseArray[N], ptr; |