[EN] 15-Puzzle Game

This article is an example of a 15-Puzzle game using the ml4m board with the results shown in Figure 1. It is a game that allows players to practice their strategic thinking skills, looking ahead to plan their shifting numbers. In addition to being in the form of numbers, it can also be changed from numbers to images, that is, transformed into an image and divided into 16 parts, and then allow the player to move the image to make it the same as the original. Also in the example, a buzzer is used to generate a beep sound using an 8-bit DAC of an esp32 microcontroller, as well as programming in Python on MicroPython.

(Figure. 1 4×4 random)

[EN] ESP32-ML4M : Tic-Tac-Toe Ep.2

From the article Tic-Tac-Toe games or OC games played with computers (esp32) via the console of the terminal program are inconvenient. Now let’s learn how to use the esp32 peripheral circuit of the ML4M board (Figure 1), how it has an I/O circuit and how is Tic-Tac-Toe game is played through the device in which the code works with the joystick module and touch switch.

(Figure. 1 ml4m for Tic-Tac-Toe testing)

[EN] Tic-Tac-Toe

This article is a collection of examples of Tic-Tac-Toe games that our team uses to teach game development in different languages ​​as appropriate for the group of learners. But most of them use Python for teaching because it is easier to explain and write than other languages. In addition to wanting to see how it can be implemented on other platforms, we used an example with the MicroPython of a board we named ml4m. Based on this board, TensorFlow Lite is installed on an ESP32 with a 4MB ROM. The board looks like Figure 1.

(Figure. 1 ml4m for testing Tic-Tac-Toe)

[EN] Python multi-threaded programming

This article discusses Python multi-threaded programming. Compiled from the website tutorialspoint.com (Make this article a memo). Running multiple threads is like running several different programs at the same time, but it’s useful:

  • Each thread can share the memory with the main thread and can communicate with each other.
  • Threads are smaller processes because they consume less memory than process calls.

[EN] PyGlet

pyglet is a Python library to create windows and cross-platform multimedia on Windows (Windows), MacOS (macOS) and Linux (Linux) for developing games or visualization applications. The library itself supports creating windows, integration with users through an event-based system, support OpenGL graphics, image/video loading support, and playing music. This article discusses installing and using pyglet on Raspberry Pi 3 B+ and Raspberry Pi 4 as a test device.

(Figure. 1 Example from 1-6)

[EN] ulab v3.0

From the previous ulab article, it was found that Micropython can implement the same dataset processing instructions as used in Numpy through the previous ulab library v.0.54.0 which is the older version of ulab (currently v.3.0.1) brought up this article. This article describes how to create a Micropython that integrates the ulab library and uses it with SPIRAM versions of esp32.

(Figure. 1 Module list of ulab)

ulab3

From Figure 1, it can be seen that the structure of the ulab library has changed from the original. This causes the programming from the previous example to have to be modified. Under ulab there are libraries of numpy and scipy. The details of numpy that are supported are as follows.

[TH] Simple Tetris Ep.3

บทความตอนสุดท้ายของการทำเกมเตตริสแบบง่าย (Simple Tetris) ที่ใช้ MicroPython กับไมโครคอนโทรลเลอร์ esp32 ตามที่ได้เขียนถึงในตอนที่ 1 และ 2 จาก 2 บทความแรกนั้น ผู้อ่านได้เรียนรู้การออกแบบโครงสร้างข้อมูล การวาดวัตถุที่ตกลงมาทั้ง 7 ชนิด และการควบคุมวัตถุให้เคลื่อนที่ไปทางซ้าย ขวา และการหมุน ส่วนในบทความที่ 2 ได้ให้วัตถุตกลงมาจากด้านบนและเก็บสถานะตำแหน่งของวัตถุเอาไว้ และในบทความนี้เป็นการทำให้วัตถุที่ตกลงมานั้นซ้อนกันได้ พร้อมทั้งการเลื่อนซ้าย ขวา และการหมุนวัตถุจะตรวจสอบการชนกับวัตถุเก่าที่เคยตกลงมาก่อน พร้อมทั้งตรวจสอบว่าเมื่อวัตถุตกลงมาจนถึงด้านล่างแล้วนั้นมีแถวใดบ้างที่ไม่มีช่องว่าง ถ้าพบแถวที่ไม่มีช่องว่างจะทำการลบแถวนั้นออกไป และสุดท้ายได้เพิ่มส่วนของการตรวจสอบการสิ้นสุดเกมในกรณีที่ไม่มีที่จะให้วัตถุตกลงมาและเคลื่อนที่ได้อีกดังภาพที่ 1 เป็นอันสิ้นสุดกระบวนการสร้างเกมแบบง่าย ๆ ของเรา

ภาพที่ 1 ตัวอย่างเกมของบทความนี้

[TH] Simple Tetris Ep.2

จากตอนที่แล้วเราได้วาดฉากหลัง การสุ่มวัตถุ การวาดวัตถุ การเลื่อนซ้ายขวา และการหมุนไปแล้ว ในบทความตอนที่ 2 ซึ่งเป็นตอนก่อนตอนสุดท้ายของชุดการทำเกม Tetris โดยเนื้อหาเป็นเรื่องของการสร้างฉากหลังเป็นโครงสร้างข้อมูลตาราง ถ้าวัตถุตกลงมาจนถึงล่างสุดจะแปลงวัตถุนั้นให้เป็นข้อมูลหนึ่งของตาราง ดังภาพที่ 1และปรับปรุงเรื่องวิธีการตกลงมาของวัตถุและการควบคุม/แสดงผลวัตถุใหม่ด้วยการใช้ตัวตั้งเวลา โดยยังไม่ตรวจสอบการชนจากการเลื่อนซ้าย/ขวา การตรวจสอบว่าวัตถุตกลงมาซ้อนกับวัตถุก่อนหน้านี้หรือไม่การหมุน และการตัดแถวซึ่งจะกล่าวถึงในบทความตอนสุดท้ายหรือ Simple Tetris Ep.3

ภาพที่ 1 ตัวอย่างเกมของบทความนี้