void GFKSimple::Init()

in NearbyConnectionsCpp/app/src/main/cpp/GFKSimpleGame.cpp [107:143]


void GFKSimple::Init(void) {
  srand((unsigned)time(NULL));
  switch (level_) {
    case 0:
    default:
      max_operand_ = 10;
      operation_count_ = 2;
      break;
    case 1:
      max_operand_ = 100;
      operation_count_ = 2;
      break;
    case 3:
      max_operand_ = 100;
      operation_count_ = 4;
      break;
    case 4:
    case 5:
      max_operand_ = 100;
      operation_count_ = 6;
      break;
  }
  choices_ = nullptr;
  if (choice_count_) {
    choices_ = std::unique_ptr<int32_t[]>(new int32_t[choice_count_ + 1]);
    if (choices_) {
      memset(choices_.get(), 0, sizeof(int32_t) * (choice_count_ + 1));
    } else {
      LOGE("Out of the memory in %s at %d", __FILE__, __LINE__);
    }
  }
  if (operation_count_ > (sizeof(OPS_CODE) / sizeof(OPS_CODE[0]))) {
    LOGW("Operation (%d) is bigger than simple game capability(%d)",
         operation_count_, static_cast<int>(sizeof(OPS_CODE)/sizeof(OPS_CODE[0])));
    operation_count_ = (sizeof(OPS_CODE) / sizeof(OPS_CODE[0]));
  }
}