public Monster_Blow(RBM method, RBE effect, byte d_dice, byte d_side) { this.method = method; this.effect = effect; this.d_dice = d_dice; this.d_side = d_side; }
public static RBM Load(Stream in_stream) { RBM result = new RBM(); result._rbm_stream = in_stream; byte[] dot_rbm = new byte[4]; dot_rbm[0] = result.ReadUInt8(); dot_rbm[1] = result.ReadUInt8(); dot_rbm[2] = result.ReadUInt8(); dot_rbm[3] = result.ReadUInt8(); if (System.Text.Encoding.ASCII.GetString(dot_rbm) != ".RBM") { return(null); } // read counts result._visible = result.ReadUInt16(); result._hidden = result.ReadUInt16(); // read biases result._visible_biases = (float *)Memory.malloc(sizeof(float) * result._visible); result.ReadSingle(result._visible_biases, result._visible); result._hidden_biases = (float *)Memory.malloc(sizeof(float) * result._hidden); result.ReadSingle(result._hidden_biases, result._hidden); // get the weights weights result._hidden_features = (float **)Memory.malloc(sizeof(float *) * result._visible); for (uint i = 0; i < result._visible; i++) { result._hidden_features[i] = (float *)Memory.malloc(sizeof(float) * result._hidden); result.ReadSingle(result._hidden_features[i], result._hidden); } // now transpose result._visible_features = (float **)Memory.malloc(sizeof(float *) * result._hidden); for (uint j = 0; j < result._hidden; j++) { result._visible_features[j] = (float *)Memory.malloc(sizeof(float) * result._visible); for (uint i = 0; i < result._visible; i++) { result._visible_features[j][i] = result._hidden_features[i][j]; } } // get seeds for our random buffer result._random = (uint *)Memory.malloc(sizeof(int) * result._hidden); Random rand = new Random(); for (int j = 0; j < result._hidden; j++) { result._random[j] = (uint)rand.Next(); } return(result); }
public static RBM Load(Stream in_stream) { RBM result = new RBM(); result._rbm_stream = in_stream; byte[] dot_rbm = new byte[4]; dot_rbm[0] = result.ReadUInt8(); dot_rbm[1] = result.ReadUInt8(); dot_rbm[2] = result.ReadUInt8(); dot_rbm[3] = result.ReadUInt8(); if (System.Text.Encoding.ASCII.GetString(dot_rbm) != ".RBM") { return null; } // read counts result._visible = result.ReadUInt16(); result._hidden = result.ReadUInt16(); // read biases result._visible_biases = (float*)Memory.malloc(sizeof(float) * result._visible); result.ReadSingle(result._visible_biases, result._visible); result._hidden_biases = (float*)Memory.malloc(sizeof(float) * result._hidden); result.ReadSingle(result._hidden_biases, result._hidden); // get the weights weights result._hidden_features = (float**)Memory.malloc(sizeof(float*) * result._visible); for (uint i = 0; i < result._visible; i++) { result._hidden_features[i] = (float*)Memory.malloc(sizeof(float) * result._hidden); result.ReadSingle(result._hidden_features[i], result._hidden); } // now transpose result._visible_features = (float**)Memory.malloc(sizeof(float*) * result._hidden); for (uint j = 0; j < result._hidden; j++) { result._visible_features[j] = (float*)Memory.malloc(sizeof(float) * result._visible); for (uint i = 0; i < result._visible; i++) { result._visible_features[j][i] = result._hidden_features[i][j]; } } // get seeds for our random buffer result._random = (uint*)Memory.malloc(sizeof(int) * result._hidden); Random rand = new Random(); for (int j = 0; j < result._hidden; j++) { result._random[j] = (uint)rand.Next(); } return result; }