Posts

This code deletes n columns from ExSan(n, m) ---> ExSan(p, q-n)

Image
ExSan++ ExSan       1  /***********START***************/       2  //legend       3  // n: north   s: south  e: east  w: west  ptr: pointer       4  // This code deletes N columns from the data structure  ExSan       5  void Net::colDeleteNet(NETPTR net,   unsigned short deleteNcols) { // the number of deleted c       6            7     ROWPTR  rptr(nullptr);       8        9     if (net->get_net_cols() > 2) {      10        for (unsigned short col = 1; deleteNcols; col++) {      11           //opposite to insert               12           rptr = net->go_to_row(net, 1);      13           for (unsigned short row = 1; row <= net->get_net_rows(); row++) {//ok      14              rptr->get_backward_ptr()->get_previous_ptr()->set_next_ptr(nullptr);  //pending in inse      15              rptr->get_backward_ptr()->set_previous_ptr(nullptr);  //pending in insert      16       17              if (row == 1) {//ok  

This code adds one column to ExSan Grid // ExSan(n, m) ----> Exsan(n, m + 1)

Image
ExSan++       1  /***********START***************/       2  //This code adds one column to  ExSan Grid       3  // ExSan(n, m) ----> Exsan(n, m + 1)       1        2  /***********START***************/       3  void Net::colInsertNet(NETPTR net,       4                             unsigned short insertNcols, // ADD COLS       5                             ){       6     CELLPTR ptr(nullptr), newCell(nullptr);       7     ROWPTR  rptr(nullptr);       8        9     for (unsigned short col = 1; insertNcols; col++) {      10        rptr = net->go_to_row(net, 1);      11        for (unsigned short row = 1; row <= net->get_net_rows(); row++) {      12       13           newCell = newCell->create_cell(row, net->get_net_cols() + col);      14       15           newCell->set_previous_ptr(rptr->get_backward_ptr());      16           rptr->get_backward_ptr()->set_next_ptr(newCell);      17           rptr->set

How to scramble the lines of a txt file

Image
ExSan++       1  ///---------Today's ExSan Code----------------------       2  // How to scramble the lines of a txt  file       3  const string dbFile = " ... stocki.txt";   // source       4  string dbScrambledFile = " ... stockScrambled.txt";   // destination       5        6  fstream ffrom, fto;       7  vector  fileLine;       8  string line;       9  unsigned short lineCounter(0);      10  ffrom.open(dbFile, ios::in);      11  if (!ffrom) {// source      12     printf("Error! cant find this file");         13     return;      14     exit(1);      15  }      16  do {      17     getline(ffrom, line);         18     fileLine.push_back(line);      19     ++lineCounter;      20  } while (!ffrom.eof());      21  ffrom.close();      22       23  boost::random::uniform_int_distribution<> uniformRndInt{ 0, lineCounter - 1 }; //#include <      24       25  fto.open(dbScrambledFile, ios::