public function run()
 {
     $success = false;
     if (need_level() == false) {
         redirect(base_url() . "games/chose_level");
     }
     $params["notice"] = get_notice();
     $game_sessions = need_game();
     if ($game_sessions != false) {
         $params['is_resume'] = 'true';
         $this->htmllib->add_js('pages/game.js');
         $this->load->view('plain/default_header');
         $this->load->view("games/home", $params);
         $this->load->view('plain/default_footer');
         // $this->load->view("games/run",$params);
     } else {
         if ($this->input->post("game_id") != "0") {
             $game_id = $this->input->post("game_id");
             $game = $this->game->get_by_id($game_id);
             $success = true;
         } else {
             $data["user_id"] = $this->session->userdata("user_id");
             $data["level_id"] = $this->session->userdata("level_id");
             $success = true;
             $game_id = $this->game->insert($data);
             $game = $this->game->get_by_id($game_id);
         }
         $this->session->set_userdata("game_id", $game_id);
         $this->session->set_userdata("game", $game);
         // $this->load->view("games/run",$params);
         echo json_encode($success);
     }
 }
 public function __construct()
 {
     parent::__construct();
     $this->load->library('htmllib');
     $this->load->model('tebak_regresi');
     $this->game_sessions = need_game();
     if ($this->game_sessions == false) {
         redirect(base_url() . "games/start");
     }
     // Your own constructor code
 }
 public function __construct()
 {
     parent::__construct();
     $this->load->library('htmllib');
     $this->load->model('question');
     $this->load->model('answer');
     $this->load->model('score_cost_summary', 'summary');
     $this->game_sessions = need_game();
     if ($this->game_sessions == false) {
         redirect(base_url() . "games/start");
     }
     // Your own constructor code
 }