add framework for 93 (WIP)
This commit is contained in:
@@ -6,3 +6,4 @@ edition = "2021"
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
itertools = "*"
|
||||
|
||||
+41
-10
@@ -1,3 +1,5 @@
|
||||
use itertools::Itertools;
|
||||
|
||||
type Num = f64;
|
||||
|
||||
fn main() {
|
||||
@@ -18,21 +20,50 @@ fn main() {
|
||||
}
|
||||
}
|
||||
|
||||
fn recurse(array: &[Num]) -> Vec<Num> {
|
||||
if array.len() == 2 {
|
||||
let [a, b] = array else { panic!() };
|
||||
|
||||
let mut v = vec![];
|
||||
|
||||
for ops in Operations::iter() {
|
||||
v.push(ops(*a, *b));
|
||||
}
|
||||
v
|
||||
} else {
|
||||
let a = array[0];
|
||||
let b = array[1];
|
||||
|
||||
let mut v = vec![];
|
||||
|
||||
for ops in Operations::iter() {
|
||||
v.push(ops(a, b));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct Digits(Num, Num, Num, Num);
|
||||
|
||||
impl Digits {
|
||||
fn all_possible_integers(&self) -> Vec<u32> {
|
||||
let a = self.0;
|
||||
let b = self.1;
|
||||
let c = self.2;
|
||||
let d = self.3;
|
||||
let array = [self.0, self.1, self.2, self.3];
|
||||
|
||||
let outcomes: Vec<_> = Operations::new()
|
||||
.map(|f| f(a, b) as u32)
|
||||
.filter(|i| *i > 0)
|
||||
.collect();
|
||||
array.into_iter().permutations(4).next().map(|a| {
|
||||
for ops in Operations::iter() {
|
||||
let x = ops(a[0], a[1]);
|
||||
}
|
||||
});
|
||||
|
||||
dbg!(outcomes)
|
||||
// dbg!(v);
|
||||
|
||||
todo!()
|
||||
|
||||
// let outcomes: Vec<_> = Operations::new()
|
||||
// .map(|f| f(a, b) as u32)
|
||||
// .filter(|i| *i > 0)
|
||||
// .collect();
|
||||
|
||||
// dbg!(outcomes)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,7 +89,7 @@ impl Iterator for Operations {
|
||||
}
|
||||
|
||||
impl Operations {
|
||||
fn new() -> Self {
|
||||
fn iter() -> Self {
|
||||
Self { last: 0 }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user