Skip to content

Instantly share code, notes, and snippets.

@vadixidav
Created February 15, 2016 02:40
Show Gist options
  • Select an option

  • Save vadixidav/114517626e7c63fa7a88 to your computer and use it in GitHub Desktop.

Select an option

Save vadixidav/114517626e7c63fa7a88 to your computer and use it in GitHub Desktop.
attempted access of field `energy` on type `&zoom::vector::space::Box<bot::Bot>`, but no field with that name was foundat line 160 col 38 in src/main.rs
#[derive(Clone)]
pub struct Bot {
pub bot_brain: mli::Mep<Ins, R, i64, fn(&mut Ins, &mut R), fn(&Ins, i64, i64) -> i64>,
pub node_brain: mli::Mep<Ins, R, i64, fn(&mut Ins, &mut R), fn(&Ins, i64, i64) -> i64>,
pub final_brain: mli::Mep<Ins, R, i64, fn(&mut Ins, &mut R), fn(&Ins, i64, i64) -> i64>,
pub energy: i64,
pub signal: i64,
pub memory: [i64; finalbrain::TOTAL_MEMORY],
pub outputs: [i64; finalbrain::TOTAL_OUTPUTS],
}
//Iterate through all bots (b) in the node being processed
for (i, b) in pnode.bots.iter().enumerate() {
use std::collections::BinaryHeap;
//Create a BTree to rank the nodes and fill it with default nodes
let mut map = BinaryHeap::from(
vec![Rank{rank: 0, data: [-1; nodebrain::TOTAL_OUTPUTS]}; finalbrain::TOTAL_NODE_INPUTS]
);
//Iterate through each node and produce the outputs
for (i, &n) in neighbors.iter().enumerate() {
//Get the node reference
let n = deps.node_weight(n).unwrap();
//Set the inputs for the node brain
node_inputs[0] = n.energy;
node_inputs[1] = n.bots.len() as i64;
node_inputs[2] = pnode.bots.len() as i64;
node_inputs[3] = b.energy; //ERROR HERE
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment