auction method

List<String> auction(
  1. String callerS,
  2. int _r,
  3. int _c
)

"We are all gathered here in holy ceremony of auction, to make some deals.." usage: in example daily_action.dart weekBox simulation: Produce nice-looking allocation-list of resources. devl:MIS DONE hklTry addparameter: callerS devl:MIS :BUG: daily_action commented out call here

Implementation

List<String> auction(String callerS, int _r, int _c) {
  callerS;
  //  devl:MIS  use _c variable to control width
  //  init();  must be done somewhere.
  List<String> _l = [];
  StringBuffer _sB = StringBuffer();
  _l.add('Say Purp:   Lang:    area:    Prod:Sell:  Buy: Ask: ');
  for (var x = 0; x < _r; x++) {
    String _dS = x.toString();
    // devl:MIS  padRight(5, ' ')
    String _sbW = 'D:$_dS ';
    _sB.write(_sbW.padRight(5, ' '));

    ///  Write one of 8 resources in right place
    ///  int nextInt(int max);
    int _rand = treatyRandom.nextInt(8); //  get one of first 8 resources.
    for (var x = 0; x < 8; x++) {
      if (x == _rand) {
        //  padRight(8, ' ')
        //  :bug: 2022.4.2  vers:  0.9.6.
        //   RangeError (index): Invalid value: Valid value range is empty: 4
        //  #0      List.[] (dart:core-patch/growable_array.dart:281:36)
        //  #1      Treaty.auction (file:///C:/Users/Public/IdeaDart/dw/dawo/lib/mis/treaty.dart:243:32)
        String _sP = equ.resL[x].padRight(8, ' ');
        _sB.write(_sP);
      } else {
        _sB.write('_______ ');
      }
    }
    _l.add(_sB.toString());
    //  _sB.write();
    _sB.clear();
  }
  return _l;
}