Skip to main content

TokyoTechX: 将棋で学ぶプログラミング基礎 | Programming for beginners: Learning basics with computer Shogi

将棋を題材にプログラミングの基礎と様々な工夫を学ぶ、初級者向けのコース(2022年T3版)です。プログラムの実行環境として、MATLAB版の将棋プログラム「MT将棋」を使用し、コードの要点をピックアップした解説を通してプログラミングの基本や考え方の一端を学びます。

----------

Learn the basics of programming and various techniques of coding with computer Shogi(2022 T3 edition). The course uses "MT Shogi", a Shogi program that runs on MATLAB. You will learn fundamental concepts of programming through easy-to-understand explanations on the key points of "MT Shogi".

5 weeks
2–3 hours per week
Instructor-paced
Instructor-led on a course schedule
Enrollment closed
Future dates to be announced

About this course

Skip About this course

将棋を題材にプログラミングの基礎と様々な工夫を学びます。

プログラムの実行環境として、MATLAB版の将棋プログラム「MT将棋(※)」を使用します。MATLABは数値計算を扱うことが得意なプログラミング言語で,MATLAB版の「MT将棋」は、その特徴を生かしながらコーディングされています。

本コースでは「MT将棋」のすべてのコードを詳細に説明することはしませんが、コードの要点をピックアップした解説を通してプログラミングの基本や考え方の一端を学ぶことができます。

MATLABの実行環境をお持ちの受講者の方は、実際に「MT将棋」を実行したり、修正したりしながら学ぶことができます。MATLABの実行環境をお持ちでない受講者の方には、MATLAB開発元のMathWorks社の協力により、本コースの受講者限定で、WebブラウザーからMATLABを使用できるMATLAB Onlineの期間限定(約9週間)ライセンスが発行されます。

(※)MT将棋:約50の関数ファイルからなる、合計で約2100行、約9500単語、ファイルサイズ約86KBのMATLABコードです。2018年に実施された「小学生向け将棋プログラミング講習会」(主催:東京工業大学工学院、共同主催:電子情報通信学会東京支部、後援:日本将棋連盟、協力:大田区立清水窪小学校・東工大将棋部)に向けて開発が開始され、その後、更新されてきました。

本コースは東京工業大学超スマート社会卓越教育院が制作し、提供しています。

----------

In this course, you will learn the basics of programming and various techniques of coding with computer Shogi. The course uses "MT Shogi(*)", a Shogi program that runs on MATLAB. MATLAB is a programming language that excels at handling numerical calculations, and "MT Shogi" was implemented to take advantage of such high computational power of MATLAB.

In this course, we will not explain all the code of "MT Shogi" in detail, but you will learn fundamental concepts of programming through easy-to-understand explanations on the key points of "MT Shogi".

Participants who have a MATLAB environment can learn by actually running and revising "MT Shogi". For participants who do not have a MATLAB environment, MathWorks, the developer of MATLAB, will provide a limited time (approximately 9 weeks) license for MATLAB Online, which allows participants to use MATLAB from a web browser, exclusively for this course.

(*) MT Shogi: MATLAB code consisting of about 50 function files with a total of about 2100 lines, about 9500 words, and a file size of about 86KB. This program was first developed for a "Shogi programming workshop for elementary school students" in 2018, and has been updated since then.

This course is produced and offered by Tokyo Tech Academy for Super Smart Society (WISE-SSS).

At a glance

  • Institution: TokyoTechX
  • Subject: Computer Science
  • Level: Introductory
  • Prerequisites:
    • プログラミング経験:不問
    • 将棋の知識:不問。将棋の事前知識があると理解が早いですが、内容を理解するために必要なルールはコース内で説明されます。

    ----------

    • No programming experience required.
    • No knowledge of Shogi required. Prior knowledge of Shogi is helpful for quick understanding, but the rules necessary to understand the content are explained in the course.
  • Language: 日本語
  • Video Transcript: 日本語
  • Associated skills:Cooperation, Ingenuity, MATLAB, Web Browsers

What you'll learn

Skip What you'll learn
  • プログラムの基本
    • 変数・配列
    • 演算と関数呼び出し
    • 制御文
  • プログラミングの様々な工夫
  • ゲーム木の探索
    • ミニマックス法
    • 将棋の局面評価
  • MATLABによる基本的なプログラミング

----------

  • Basics of programming
    • Variables and arrays
    • Operations and function calls
    • Control statements
  • Various techniques of coding
  • Game tree search
    • Minimax method
    • Board state evaluation of Shogi games
  • Basic programming with MATLAB

Week 1:駒の表示

  1. 駒の表示
  2. MT関数:駒表示
  3. MT変数:駒
  4. 配列
  5. 関数
  6. 制御文:for
  7. MATLAB関数・演算子

Week 2:駒の動き

  1. 駒の動き
  2. MT関数:周り候補マス
  3. 駒移動ベクトル
  4. MT関数:候補マス
  5. 制御文:while, if, switch
  6. MATLABの特徴
  7. MATLAB関数
  8. MATLABの演算

Week 3:人対人の対局

  1. 人対人の対局
  2. 対局の流れ
  3. MT将棋盤
  4. MT関数:選択と駒移動
  5. MATLAB関数:入出力
  6. 変数値の様々な設定方法

Week 4:コンピュータ対局[概要]

  1. コンピュータ対局
  2. 局面評価
  3. コンピュータ対局の流れ
  4. コンピュータによる局面評価

Week 5: コンピュータ対局[実装]

  1. MT関数:自動選択
  2. MT変数:点数行列・動き配列
  3. 関数解説:自動選択
  4. MATLAB関数:ソート・乱数・ファイル入出力
  5. 関数の様々な記述方法

----------

Week 1: Board representation

  1. Board representation
  2. MT function: placing pieces
  3. MT variable: pieces
  4. Array
  5. Function
  6. Control statement: for
  7. MATLAB functions and operators

Week 2: Piece movement

  1. Movement of pieces
  2. MT function: possible adjacent squares for piece movement
  3. Piece movement vector
  4. MT function: possible squares for piece movement
  5. Control statements: while, if, switch
  6. Features of MATLAB
  7. MATLAB functions
  8. MATLAB operations

Week 3: Human vs. human game

  1. Human vs. human game
  2. Flow of the game
  3. MT Shogi board
  4. MT function: selection and movement of a piece
  5. MATLAB function: input/output
  6. Various ways to set variable values

Week 4: Computer vs. computer game [Overview]

  1. Computer vs. computer game
  2. Board state evaluation methods
  3. Flow of computer vs. computer game
  4. Board state evaluation by computers

Week 5: Computer vs. computer game [Implementation]

  1. MT function: automatic selection of moves
  2. MT variables: score matrix and movement array
  3. Explanation on functions: automatic selection of moves
  4. MATLAB functions: sorting, generating random numbers, file input/output
  5. Various ways of coding functions

Interested in this course for your business or team?

Train your employees in the most in-demand topics, with edX For Business.