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
import { readFileSync } from 'fs'; | |
const expectedAnswers = JSON.parse(readFileSync('problem_1/problem_1_expected_answers.json', 'utf8')); | |
import { euler_1 } from './problem_1.js'; | |
let successfulTests = 0; | |
const failedTests = []; | |
expectedAnswers.forEach((expectedAnswer) => { | |
console.log(`Input of ${expectedAnswer.input} should yield ${expectedAnswer.expected_answer}`); |
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 json import loads, dumps | |
from os import path | |
from problem_1 import euler_1 as euler_function | |
def main(): | |
with open(path.dirname(__file__) + '/problem_1_expected_answers.json','r') as expected_answers_file: | |
current_expected_answers_data = expected_answers_file.read() | |
current_expected_answers = loads(current_expected_answers_data) | |
expected_answers_file.close() | |
for i in range(41,1001): |
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 json import loads | |
from os import path | |
from problem_1 import euler_1 as euler_function | |
# This allows for a bit more portability, rather than changing the name of the function every time I import this file to a new problem, just run euler_function each time. | |
def main(): | |
# Get the expected answers and load them into a list | |
with open(path.dirname(__file__) + '/problem_1_expected_answers.json','r') as expected_answers_file: | |
expected_answers_data = expected_answers_file.read() | |
expected_answers = loads(expected_answers_data) |
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
[ | |
{"input": 1, "expected_answer": 0}, | |
{"input": 2, "expected_answer": 0}, | |
{"input": 3, "expected_answer": 0}, | |
{"input": 4, "expected_answer": 3}, | |
// And so on and so forth | |
] |
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
const genStarPathData = (points,cx,cy,radius) => { | |
let radii = { | |
outer : radius, // this will be given to us when the function is called, | |
inner : radius * Math.cos(2 * Math.PI / points) / Math.cos(Math.PI /points) | |
/* | |
Wait, why Math.PI instead of 360 and 180? Well I remembered this time before | |
putting too much work in - JavaScript works in radians, not degrees! | |
π radians = 180° */ | |
}; | |
/* Now to redo the whole methodology as we can't really have an xpoints and |
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
{ | |
"os": "Darwin", | |
"os_release": "19.6.0", | |
"os_version": "Darwin Kernel Version 19.6.0: Mon Apr 12 20:57:45 PDT 2021; root:xnu-6153.141.28.1~1/RELEASE_X86_64", | |
"machine": "x86_64", | |
"processor": "i386", | |
"cpu_freq": 1800, | |
"memory": 8589934592 | |
} |
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
import platform | |
import psutil | |
import json | |
uname = platform.uname() | |
cpu = psutil.cpu_freq() | |
mem = psutil.virtual_memory() | |
environment = { |
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
def fullprint(challenge,fun,arg,filepath): | |
import time | |
import csv | |
import platform | |
import psutil | |
import sys | |
timing = {} | |
timing['start'] = time.time() | |
if arg: | |
result = fun(arg) |
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
[ | |
{ | |
"name": "C", | |
"type": "programming", | |
"extensions": [ | |
".c", | |
".cats", | |
".h", | |
".idc", | |
".w" |
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
############################################################################# | |
# Use the list below to determine which languages you will be working with, # | |
# then run this file to grab the language extensions and put them into # | |
# languages.json for the rest of this program to use. # | |
############################################################################# | |
############################################################################# | |
# Special thanks to Peter Pisarczyk and Aymen Mouelhi for their hard work # | |
# in putting together such comprehensive lists! # | |
# https://github.com/ppisarczyk # |
NewerOlder