Skip to content

Commit

Permalink
Merge branch 'main' of github.com:unknownK19/Logic-TriOxide
Browse files Browse the repository at this point in the history
  • Loading branch information
unknownK19 committed May 31, 2024
2 parents 7a1a246 + 88e8d4a commit 814d855
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion examples/example01.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ fn main() {
nand.update();
// TADA !!
println!("{:?}", nand.know_output());
}
}
9 changes: 9 additions & 0 deletions examples/example02.rs
Original file line number Diff line number Diff line change
@@ -1,21 +1,30 @@
use logic_o3::logic::{Circuit, LogicCircuit};

fn main() {
// Create new Logic Gate
let or1 = LogicCircuit::new(logic_o3::logic::LogicGate::OR);
let not1 = LogicCircuit::new(logic_o3::logic::LogicGate::NOT);

// Create Empty Circuit
let mut nor = Circuit::new();

// Add Two Logic Gate AKA Component
nor.add_logic_gate(or1);
nor.add_logic_gate(not1);

// Connect wire between two component (from_comp_id, to_comp_id, to_comp_input_index)
nor.connection_scheme((0, 1, 0));

// Add Two Input Signal
nor.add_input_connection((false, vec![(0, 0)]));
nor.add_input_connection((false, vec![(0, 1)]));

// Add One Output Signal
nor.add_output_connection(1);

// Refreshing for change
nor.update();

// And Done
println!("{:?}", nor.know_output());
}
3 changes: 3 additions & 0 deletions examples/example03.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
use logic_o3::logic::{Circuit, LogicCircuit};

fn main() {
// Create new Logic Gate
let or1 = LogicCircuit::new(logic_o3::logic::LogicGate::OR);
let and1 = LogicCircuit::new(logic_o3::logic::LogicGate::AND);
let not1 = LogicCircuit::new(logic_o3::logic::LogicGate::NOT);

// Create empty Circuit
let mut circuit01 = Circuit::new();


circuit01.add_logic_gate(and1);
circuit01.add_logic_gate(or1);
circuit01.add_logic_gate(not1);
Expand Down

0 comments on commit 814d855

Please sign in to comment.