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.
- 5 weeks
- 2-3 hours per week
- Computer Science
- 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
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
Week 1: Board representation
- Board representation
- MT function: placing pieces
- MT variable: pieces
- Control statement: for
- MATLAB functions and operators
Week 2: Piece movement
- Movement of pieces
- MT function: possible adjacent squares for piece movement
- Piece movement vector
- MT function: possible squares for piece movement
- Control statements: while, if, switch
- Features of MATLAB
- MATLAB functions
- MATLAB operations
Week 3: Human vs. human game
- Human vs. human game
- Flow of the game
- MT Shogi board
- MT function: selection and movement of a piece
- MATLAB function: input/output
- Various ways to set variable values
Week 4: Computer vs. computer game [Overview]
- Computer vs. computer game
- Board state evaluation methods
- Flow of computer vs. computer game
- Board state evaluation by computers
Week 5: Computer vs. computer game [Implementation]
- MT function: automatic selection of moves
- MT variables: score matrix and movement array
- Explanation on functions: automatic selection of moves
- MATLAB functions: sorting, generating random numbers, file input/output
- Various ways of coding functions