Exemple #1
0
void raise_layer(Block blockmap[][10]) {
	int i, j;
	for (i = 0; i < 20; i++) {
		for (j = 9; j > 0; j-- ) {
			blockmap[i][j].set(blockmap[i][j-1].check_type());
		}
	}
	generate_layer(blockmap);
}
Exemple #2
0
void NN::create_network(vector<int> layers) //create a new network
{
  network.clear();
  //  srand(time(NULL));
  for (unsigned int i=1; i<layers.size(); i++)
    {
      if(layers[i] == 0)
	{
	  printf("You can't have a network layer with zero neurons, aborting!\n");
	  exit(0);
	}
      network.push_back(generate_layer(layers[i],layers[i-1])); //(out, in)
    }
  
  learning_rate = 0.001; //standard value - can be changed using the set_learning_rate method
  linear_coef = 5;

}
Exemple #3
0
void cubic( float x_size, float y_size, float z_size, const float3 & position, const float4 & color,
            Vertex *res_vertices, Index *res_indices)
{
    Index vertex = 0; // index of current vertex
    DWORD index = 0; // index of current index
    
    _ASSERT(res_vertices != NULL);
    _ASSERT(res_indices != NULL);

    float x_step = x_size / CUBIC_X_EDGES;
    float y_step = y_size / CUBIC_Y_EDGES;
    float z_step = z_size / CUBIC_Z_EDGES;

    for(int i = 0; i <= CUBIC_Z_EDGES; ++i)
    {
        bool connect_with_previous_level = ( 0 != i);
        bool inside = ( 0 != i && CUBIC_Z_EDGES != i);
        generate_layer(x_step, y_step, position + float3(0, 0, i*z_step), color,
                       connect_with_previous_level, inside,
                       vertex, index, res_vertices, res_indices);
    }
}