/** * Đưa ra 1 phần tử ở vị trí dòng $i, cột $j * @param $i * @param $j */ public function generate_item($i, $j) { $mis = $this->get_total_items($i, $j); if (($picks = $this->group_top_right_items($i, $j)) !== false) { //if($i==1&&$j==2) out1($picks,'b'); $picks = _drw($picks); if (count($e = $picks->removes($mis)->O)) { //if($i==1&&$j==2) out1($e,'b'); if (count($e) > 1) { if ($this->get_col_items($j + 1) !== null) { $e = cross_array('max', true, $this->get_col_items($j + 1), $e); } } $get = get_rand_item($e); //$get=pick_rand_number(1,$size,$mis); } else { $get = pick_rand_number(1, $this->size, $mis); } } else { $get = pick_rand_number(1, $this->size, $mis); } if ($get == false) { echo '{-----------<br>' . $i . ',' . ($j - 1); dump($this->group_top_right_items($i, $j - 1)); echo '-------------}<br>'; } return $get; }
function get_rand_item($opt = false) { return get_rand_item($this->O, $opt); }