iT邦幫忙

2017 iT 邦幫忙鐵人賽
DAY 5
0
Big Data

體育競賽及日常生活裏遇到的數據收集及分析系列 第 5

體育競賽資料收集器:羽球篇之五,輸入更多的數據及建立查詢來驗証。

  • 分享至 

  • twitterImage
  •  

Table 建立之後,因為考慮不周詳等眾多原因,會新增,或減少欄位,或調整順序,
而Laravel 提供的指令列工具,挺方便的。

稍微解釋一下,上回開的TABLE的意思。


      Schema::create('bmlogs', function (Blueprint $table) {  //羽球記錄表 
            $table->increments('id');      //自動增號
            $table->string('eventId');   //盃賽代號或名稱
            $table->string('gameId');    //局號,最多三局 
             $table->integer('totalScore'); //總分
            $table->string('hostId');     //主方球員,示別用 
             $table->integer('hostScore');  //主方球員得分
            $table->string('guestId');    //客方球員 
             $table->integer('guestScore'); //客方球員得分
            $table->string('servePlayer')->nullable();  //由誰發球

            $table->integer('ballId');     //來回的球數,0是發球
             $table->string('location')->nullable();    //球的落點位置
             $table->string('handType')->nullable();    //正手拍FH,反手拍BH
             $table->string('attackType')->nullable();   //攻擊類型, 殺球SM ,劈球DO,撲球DV 
             $table->string('controllType')->nullable();  //控制類型,高球LG,吊球DP,搓球DR,勾對角XX,
             $table->string('defenseType')->nullable();   //防守類型,挑高球VL,擋網BK 
             $table->string('RecordType')->nullable();    //如實記錄DL,簡單記錄SL
             $table->string('EndType')->nullable();      //結束型態 , 失誤ER,出界OT,
             $table->string('winPlayer')->nullable();     //誰得分
            $table->timestamps();          //數據寫入時間
        });

及記錄資料的內容,代碼及其代表的意思。

接著是建立SELECT查詢語句,看看是否符合預期。不符合,再修改。

球場的圖面上座標示意圖

以香港公開賽,第一局由辛杜得第一分,來回4球,戴一姐出界為例。

public function run()
  {
      $event='HK 2016 Sunrise';   //固定的值用變數取代
      $game='G1';
      $host= 'Tai';
      $guest='P.V';

       DB::table('bmlogs')->insert(
      [
	'eventId' => $event,
	'gameId' =>$game,
	'totalScore' => 1+0,
	'hostId' =>$host,
	'hostScore' => 0,
	'guestId' => $guest,
	'guestScore' => 1,
	'servePlayer' => $guest, //客人發球
	'ballId' => 0,  //發球
	'location' => '175,200-300,500', //記錄發球位置 及 落點 
	'handType' => 'FH',   //正手發球
	'attackType' => '',
	'controllType' => 'LG',  //長遠球
	'defenseType' => '',
	'EndType' => '',
      ] );
      DB::table('bmlogs')->insert(         
     [
	'eventId' => $event,
	'gameId' =>$game,
	'totalScore' => 1+0,
	'hostId' => $host,
	'hostScore' => 0,
	'guestId' => $guest,
	'guestScore' =>1,
	'ballId' => 1,
	'location' => '360,70', //回球的位置
	'handType' => 'FH',  //仍是正手
	'attackType' => '',
	'controllType' => 'LG', //長遠球
	'defenseType' => '',
	'EndType' => '',
      ]);
      DB::table('bmlogs')->insert(         
     [
	'eventId' => $event,
	'gameId' =>$game,
	'totalScore' => 1+0,
	'hostId' => $host,
	'hostScore' => 0,
	'guestId' => $guest,

	'guestScore' => 1,
	'ballId' => 2,
	'location' => '50,500', //球的落點
	'handType' => 'BH', //反拍回球
	'attackType' => 'LG', //長遠球
	'controllType' => '',
	'defenseType' => '',
	'EndType' => '',
      ] );
      DB::table('bmlogs')->insert(         
     [
	'eventId' => $event,
	'gameId' =>$game,
	'totalScore' => 1+0,
	'hostId' => $host,
	'hostScore' => 0,  
	'guestId' => $guest,
	'guestScore' => 1,  //得1分 回寫
	'ballId' => 3,
	'location' => '380,240',  //出界的位置
	'handType' => 'FH', 
	'attackType' => '',
	'controllType' => 'DP', //吊球
	'defenseType' => '',
	'EndType' => 'OT',  //出界 失分
	'winPlayer' =>  $guest, //客人得分
      ] );

  }

題外話,在剛結束的澳門公開賽裏,男單一哥拿下亞軍,恭禧。

Yes

澳門公開賽的男子雙打,由台灣之光的雙李(李洋,李哲輝)拿下,而且他們今年至目前已拿下3座冠軍,以單打
而言,拿下3座冠軍,非常不得了,不過所參加的比賽級別也有差,績分有差,而他們算是比較長期固定的搭配,
但混雙的搭檔就比較沒有固定,這部分也是國內羽壇怪像之一,比較能有世界排名的選手,其能力都是超強,
在雙打部分,勝出的關鍵,應該是搭檔的默契佔很大部分,以馬來西亞混雙拿下奧銀的例子,長期配搭,而不會
一直更換搭擋。


上一篇
體育競賽資料收集器:羽球篇之四,數據輸入測試。
下一篇
體育競賽資料收集器:羽球篇之六,輸入更多的數據及建立查詢來驗証(ii)。
系列文
體育競賽及日常生活裏遇到的數據收集及分析30
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言