Example #1
0
//Calls layer 3, 2,and 1 within layer 4 
struct l2pdu* transmit(char*buf, char pos)
{
	struct l3pdu* strptr3; 
	struct l2pdu* strptr2;
	struct l2pdu* strptr1;
	strptr3 = layer3(strptr2,buf,pos); //empty structures passed in to satisfy parameter requirements
	strptr2= layer2(strptr3,strptr2,pos);
	strptr1 = layer1(strptr2,pos);
	return strptr1;
}
void layer2(struct eth_hdr *ethhead, int size) {
	printf("Ethernet Header\n");
	printf("	eth_dst = %02x:%02x:%02x:%02x:%02x:%02x\n", (*ethhead).eth_dst.data[0],
			(*ethhead).eth_dst.data[1],
			(*ethhead).eth_dst.data[2],
			(*ethhead).eth_dst.data[3],
			(*ethhead).eth_dst.data[4],
			(*ethhead).eth_dst.data[5]);
	printf("	eth_src = %02x:%02x:%02x:%02x:%02x:%02x\n", (*ethhead).eth_src.data[0],
			(*ethhead).eth_src.data[1],
			(*ethhead).eth_src.data[2],
			(*ethhead).eth_src.data[3],
			(*ethhead).eth_src.data[4],
			(*ethhead).eth_src.data[5]);

	layer3(((char *)ethhead)+14,ntohs((*ethhead).eth_type));
}
Example #3
0
Level::Level()
: hero(nullptr)
, hero_panel(nullptr)
, map(nullptr)
, scene_graph()
{
	SceneNode::PtrNode layer1(new SceneNode());
	layers.push_back(layer1.get());
	scene_graph.addChild(std::move(layer1));

	SceneNode::PtrNode layer2(new SceneNode());
	layers.push_back(layer2.get());
	scene_graph.addChild(std::move(layer2));

	SceneNode::PtrNode layer3(new SceneNode());
	layers.push_back(layer3.get());
	scene_graph.addChild(std::move(layer3));

	SceneNode::PtrNode layer4(new SceneNode());
	layers.push_back(layer4.get());
	scene_graph.addChild(std::move(layer4));

	SceneNode::PtrNode layer5(new SceneNode());
	layers.push_back(layer5.get());
	scene_graph.addChild(std::move(layer5));

	texture_generator.load(SystemImage::TextContinueButton, "textures/text_continue_button.png");
	texture_generator.load(SystemImage::LifeFlower, "textures/life_flower.png");

	//World::current_level->getTG().load(201, "textures/smoke_puffup.png");

	std::unique_ptr<HeroPanel> h_panel(new HeroPanel(texture_generator));
	hero_panel = h_panel.get();
	h_panel->initPosition();
	node_vector.push_back(hero_panel);
	layers[3]->addChild(std::move(h_panel));


	

	std::cout << "Level created" << std::endl;	
}
void layer2(int i, int j) {
  layer3(i, j, 7);
}
Example #5
0
int main(int argc, char *argv[]) {
	ANN::BPNet cpu_one;

	ANN::BPLayer layer1(56, ANN::ANLayerInput);
        ANN::BPLayer layer2(64, ANN::ANLayerHidden);
        ANN::BPLayer layer3(64, ANN::ANLayerHidden);
        ANN::BPLayer layer4(64, ANN::ANLayerHidden);
	ANN::BPLayer layer5(9, ANN::ANLayerOutput);

	layer1.ConnectLayer(&layer2);
	layer2.ConnectLayer(&layer3);
        layer3.ConnectLayer(&layer4);
        layer4.ConnectLayer(&layer5);
        
	cpu_one.AddLayer(&layer1);
	cpu_one.AddLayer(&layer2);
        cpu_one.AddLayer(&layer3);
        cpu_one.AddLayer(&layer4);
        cpu_one.AddLayer(&layer5);

	ANN::TrainingSet input;
	input.AddInput(fInp1, 56);
	input.AddOutput(fOut1, 9);
	input.AddInput(fInp2, 56);
	input.AddOutput(fOut2, 9);
	input.AddInput(fInp3, 56);
	input.AddOutput(fOut3, 9);
	input.AddInput(fInp4, 56);
	input.AddOutput(fOut4, 9);
	input.AddInput(fInp5, 56);
	input.AddOutput(fOut5, 9);
	input.AddInput(fInp6, 56);
	input.AddOutput(fOut6, 9);
	input.AddInput(fInp7, 56);
	input.AddOutput(fOut7, 9);
	input.AddInput(fInp8, 56);
	input.AddOutput(fOut8, 9);
	input.AddInput(fInp9, 56);
	input.AddOutput(fOut9, 9);
	input.AddInput(fInp10, 56);
	input.AddOutput(fOut10, 9);
	
	std::vector<float> errors;
	cpu_one.SetLearningRate(0.5);
	cpu_one.SetMomentum(0);
	cpu_one.SetWeightDecay(0);
	cpu_one.SetTrainingSet(input);

	bool b = false;
	float f;
	errors = cpu_one.TrainFromData(300, 0, b, f);
	std::cout<< cpu_one <<std::endl;
/*
	cpu_one.ExpToFS("foo.bar");
	cpu_one.ImpFromFS("foo.bar");

	cpu_one.SetTrainingSet(input);
	std::cout<< cpu_one <<std::endl;
*/
	return 0;
}