Programming for beginners: Learning basics with computer Shogi

Learn the basics of programming with Shogi × MATLAB! 

This is an introductory course (2023T3 version) for beginners of programming, taught by Professor Atsushi Takahashi, School of Engineering, and MATLAB TA. The basic rules of Shogi are explained in the course, so learners with no experience of Shogi can enjoy the course.  

During the duration of the course (5 weeks, plus some extra days), the MATLAB license will be issued by The MathWorks, Inc. Even those without the MATLAB environment will be able to have the full experience during the duration of the course. 

Course Open: September 28, 2022 - March 31, 2023 (scheduled)
Enrollment: Course Start Date - 3 Weeks before the Course Close Date
5 weeks
2-3 hours per week
費用 / FEE
Computer Science
None required
  • 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.
    Not available

    Course Description

    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”.

    The basic duration of the course is 5 weeks.  During the duration of the course (plus some extra days), the MATLB license will be issued by The MathWorks, Inc. Even those without the MATLAB environment will be able to have the full experience during the duration of the course.

    This is an updated version of the online course that was open to Tokyo Tech students and faculty until this March.   Extra contents have been added (“Week 4 Computer vs. computer game [Overview]” and “Week 5: Computer vs. computer game [Implementation]”), and quizzes have been updated.

    Students and faculty staff at Tokyo Tech have access to use MATLAB and Toolbox unlimitedly at the university. Please refer to Distribution of MATLAB for details.

    (*) 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.

    What You Will Learn

    • 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

    Course Syllabus

    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

    講師 / Instructor

    Atsushi Takahashi

    School of Engineering Professor
    Tokyo Institute of Technology