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
| # Approximate e using bisection. | |
| import math | |
| ITERS = 25 | |
| H = 2 ** (-26) | |
| l = 2 | |
| m = 3 | |
| r = 4 |
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
| # kuSAT - an optimal 2x2 Rubik's cube solver that uses Z3's SAT solver under the hood | |
| # | |
| # Terminology: | |
| # - Face := one of the 6 sides of a cube. A common mistake is to try to solve a Rubik's cube one side at a time, when | |
| # it should be solved one piece (or more) at a time. | |
| # - Piece := one of the 8 corners of a 2x2 Rubik's cube. A Rubik's cube can be thought of as a collection of | |
| # of independent pieces that move from location to location based on a set of rules. A piece can be | |
| # identified using 3 faces. For example, ULB is a piece that would intersect the U, L, and B faces if the | |
| # cube was in its solved state. | |
| # - Location := one of the 8 places that a corner can be at. Similarly to a piece, a location is also identified 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
| //! A brute-force algorithm for finding a fixed-point iteration formula for an arbitrary constant. It can be used to | |
| //! find the Babylonian method for finding the square root of a number, or to find a way to divide using addition, | |
| //! subtraction and multiplication. More complex constants like pi are already too much for this algorithm, so overall | |
| //! it's pretty useless. | |
| //! | |
| //! Tested with Zig 0.11.0-dev.4191+1bf16b172. | |
| const std = @import("std"); | |
| fn neg(a: f64) f64 { |
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
| //! A brute-force optimal solver for the easy difficulty of the "Arrow" minigame from the game "Exponential Idle". | |
| //! Exponential Idle: https://conicgames.github.io/exponentialidle/ | |
| //! | |
| //! Usage: | |
| //! arrow_easy <board> | |
| //! where <board> is 9 digits from 1 to 4 describing the board. To easily get the required digits, click on the | |
| //! settings icon when playing the minigame and change the display mode to "Numbers". The digits should be entered from | |
| //! left to right, top to bottom. For example, the board | |
| //! | |
| //! 1 3 3 |