public static double[] GetMarks() { double[] source = new double[COUNT_MARKS]; for (int i = 0; i < COUNT_MARKS; i++) { source[i] = Randomaizer.GetDouble(MIN_MARK, MAX_MARK); } return(source); }
public static Coordinate getEmptyCellCoord(Ocean ocean) { Coordinate empty = new Coordinate(); do { empty._x = Randomaizer.nextIntBetween(0, Ocean.COL - 1); empty._y = Randomaizer.nextIntBetween(0, Ocean.ROW - 1); } while (ocean[empty._y, empty._x] != null); return(empty); }
/// <summary> /// этот понос нужно починить /// </summary> /// <param name="ocean"></param> /// <param name="coo"></param> /// <param name="image"></param> /// <returns></returns> public static Coordinate getNeighborWithImage(Ocean ocean, Coordinate coo, char image) // todo { Coordinate[] neighbors = new Coordinate[0x04]; int count = 0; Coordinate tmp = new Life_Game.Coordinate(); bool find = true; if (image == (char)ValueOcean.Sea) { find = false; } tmp = north(ocean, coo, image, find); if (tmp._x != coo._x || tmp._y != coo._y) { neighbors[count++] = north(ocean, coo, image, find); } tmp = south(ocean, coo, image, find); if (tmp._x != coo._x || tmp._y != coo._y) { neighbors[count++] = south(ocean, coo, image, find); } tmp = east(ocean, coo, image, find); if (tmp._x != coo._x || tmp._y != coo._y) { neighbors[count++] = east(ocean, coo, image, find); } tmp = west(ocean, coo, image, find); if (tmp._x != coo._x || tmp._y != coo._y) { neighbors[count++] = west(ocean, coo, image, find); } if (count == 0) { return(coo); } else { return(neighbors[Randomaizer.nextIntBetween(0, count - 1)]); } }
//конструктор сети - пустой public Net(byte input, byte hidden, byte output) { age_net = 0; qua_input = input; qua_hidden = hidden; qua_output = output; hiddenNodes = new Node[hidden]; outputNodes = new Node[output]; //заполнение + рандомные веса свзяей { int r_count = input * hidden + hidden * output; Randomaizer random = new Randomaizer(Random.Range(0, 9999), r_count); for (int i = 0; i < hidden; ++i) { hiddenNodes[i] = new Node(input); for (int j = 0; j < input; ++j) { hiddenNodes[i].SetNodeWeight(random.GetRandomFloat(--r_count), j); } } for (int i = 0; i < output; ++i) { outputNodes[i] = new Node(hidden); for (int j = 0; j < hidden; ++j) { outputNodes[i].SetNodeWeight(random.GetRandomFloat(--r_count), j); } } } //чистка муссора System.GC.Collect(); }