Compare commits

..

3 Commits

Author SHA1 Message Date
Arne Keller
38a5d2d36d Hotfix 2023-11-09 12:09:12 +01:00
Arne Keller
0723f5df4b Spicy 7-variable example 2023-11-09 11:42:59 +01:00
Arne Keller
07e0ce40c4 Fix display issue with >= 5 variables
Previously, the initial window would be too small.

Resolves #2
2023-11-09 11:36:14 +01:00
3 changed files with 7 additions and 5 deletions

View File

@ -46,7 +46,7 @@
Change output specification by scrolling (up => 1, down => 0), typing (=> 1, 0) or deleting (=> -). Change output specification by scrolling (up => 1, down => 0), typing (=> 1, 0) or deleting (=> -).
</p> </p>
<p id="examples"> <p id="examples">
Load <a href="#--111100">example 1</a>, <a href="#-1111000-1-01---">example 2</a>, <a href="#11101111111111111111101111111101">example 3</a>. Load <a href="#--111100">example 1</a>, <a href="#-1111000-1-01---">example 2</a>, <a href="#11101111111111111111101111111101">example 3</a>, <a href="#11101111111111111111101111111101--------------0-------1----------------------1--------------0----------1-----1-1------0-----0-0-">example 4</a>.
Set all cells to <button id="set-0">0</button>, <button id="set-1">1</button> or <button id="set-any">-</button>. Set all cells to <button id="set-0">0</button>, <button id="set-1">1</button> or <button id="set-any">-</button>.
</p> </p>
<div id="input-container"></div> <div id="input-container"></div>

View File

@ -7,10 +7,11 @@ const SIZE_FACTOR: usize = 64;
fn main() { fn main() {
let args = args().collect::<Vec<_>>(); let args = args().collect::<Vec<_>>();
let vars = [A, B, C, D]; let vars = [A, B, C, D, E];
//let function = vec![0, 0, 1, 1, 1, 1, 1, 0].into_iter().map(Into::into).collect(); //let function = vec![0, 0, 1, 1, 1, 1, 1, 0].into_iter().map(Into::into).collect();
//let function = vec![0, 0, 1, 1, 1, 1, 1, 2].into_iter().map(Into::into).collect(); //let function = vec![0, 0, 1, 1, 1, 1, 1, 2].into_iter().map(Into::into).collect();
let function = parse_function("-1111000-1-01---"); //let function = parse_function("-1111000-1-01---");
let function = parse_function("11101111111111111111101111111101");
let groups = find_groups(&function, &vars, One); let groups = find_groups(&function, &vars, One);
eprintln!("all:"); eprintln!("all:");
for x in &groups { for x in &groups {
@ -45,5 +46,5 @@ fn main() {
.collect() .collect()
}; };
println!("{}", svg::get_svg(SIZE_FACTOR, false, &function, &vars, &block_masks)); println!("{}", svg::get_svg(SIZE_FACTOR, true, &function, &vars, &block_masks));
} }

View File

@ -74,7 +74,8 @@ pub fn get_svg(size_factor: usize, print_labels: bool,
if print_labels { if print_labels {
for i in 0..vars.len() { for i in 0..vars.len() {
let offset = (i / 4) as f32 * size2 + size16; let offset = (i / 4) as f32 * size2 + size16;
let initial_window = 2usize.pow(((i + 2) / 4) as u32); let initial_window = 2usize.pow((i / 2) as u32);
//eprintln!("i = {i}, offset = {offset}, initial_window = {initial_window}");
let mut start = vec![false; initial_window]; let mut start = vec![false; initial_window];
start.extend(vec![true; initial_window]); start.extend(vec![true; initial_window]);
let desired_len = if i % 2 == 0 { w } else { h }; let desired_len = if i % 2 == 0 { w } else { h };