This file contains hidden or 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
| # See diagram: https://i.imgur.com/UWDrqcH.png | |
| # We need 8 equations to solve the diagram, but I can only come up with 5. | |
| # For three more equations, we will assume a value for X, A, and D. | |
| # If sympy times out, we will cancel the attempt. | |
| # Values for X: 7 choose 4, 35 possible values. | |
| # Values for A: 7. | |
| # (Naive) Maximum loops: 7*35 = 245. | |
| # (actual) maximum loops: 4 * 35 = 140. A has to be in the circle for the solution for X we're using. |
This file contains hidden or 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
| # See diagram: https://i.imgur.com/UWDrqcH.png | |
| from itertools import permutations | |
| for i, perm in enumerate(permutations([1,2,3,4,5,6,7])): | |
| a, b, c, d, e, f, g = perm | |
| if (a + d + g + f) / 2 == (b + d + e + g) / 3 == (c + e + f + g) / 4: | |
| print(f"\n{i}. Solution: a = {a}, b = {b}, c = {c}, d = {d}, e = {e}, f = {f}, x = {(a+d+g+f)/2}") | |
| else: | |
| print(f"{i} ", end='') |
This file contains hidden or 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
| # (Major issues) - not enough equations to solve this SOE! | |
| # See diagram: https://i.imgur.com/UWDrqcH.png | |
| # We need 7 equations to solve the diagram, but I can only come up with 5. | |
| # For two more equations, we will assume a value for X and A. | |
| # If sympy times out, we will cancel the attempt. | |
| # Values for X: 7 choose 4, 35 possible values. | |
| # Values for A: 7. | |
| # (Naive) Maximum loops: 7*35 = 245. |
This file contains hidden or 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 pandas as pd | |
| def region(row): | |
| #print(row) | |
| state = row["state"] | |
| if state in ("FL", "GA"): return "South" | |
| elif state in ("CA", "WA"): return "West" | |
| elif state in ("MT", "MN"): return "Central" | |
| elif state in ("NY", "ME"): return "North" | |
| else: return "Unknown" | |
This file contains hidden or 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
| # Pico W GPIO-over-website test | |
| # thanks to https://www.petecodes.co.uk/creating-a-basic-raspberry-pi-pico-web-server-using-micropython/ for the kickstart | |
| import network | |
| import socket | |
| import time | |
| from machine import Pin | |
| import secrets | |
| # secrets.py defines SSID and PASSWORD variables, used on line 12 - don't expose your SSID/passphrase to github, please | |
| import machine | |
| wlan = network.WLAN(network.STA_IF) |
This file contains hidden or 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
| // Python script engine includes | |
| #include <Python.h> | |
| #include <iostream> | |
| #include <stdlib.h> | |
| #include <vector> | |
| // SFML | |
| #include <SFML/Graphics.hpp> | |
| #include <SFML/Audio.hpp> |
This file contains hidden or 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
| // Python script engine includes | |
| #include <Python.h> | |
| #include <iostream> | |
| #include <stdlib.h> | |
| #include <vector> | |
| // SFML | |
| #include <SFML/Graphics.hpp> | |
| #include <SFML/Audio.hpp> |
This file contains hidden or 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
| // Python script engine includes | |
| #include <Python.h> | |
| #include <iostream> | |
| #include <stdlib.h> | |
| #include <vector> | |
| // SFML | |
| #include <SFML/Graphics.hpp> | |
| #include <SFML/Audio.hpp> |
This file contains hidden or 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 <Python.h> | |
| #include <iostream> | |
| // init_python - configure interpreter details here | |
| PyStatus init_python(const char *program_name) | |
| { | |
| PyStatus status; | |
| PyConfig config; | |
| PyConfig_InitPythonConfig(&config); |