このブログ記事では、私が最新作として開発したLunar Landerゲームを紹介します。Pythonで作成し、高性能なC++製ニューラルネットワークライブラリを活用しています。自作したMLPを遺伝的アルゴリズムで学習させ、多様でカスタマイズ可能なシナリオでAIパイロットが安全に着陸できるよう設計しました。プロジェクトには手動操作とAI制御の両モード、詳細なトレーニング環境も盛り込みました。今回の取り組みでPython/C++の連携、ニューラルネットワーク実装、ゲームAIのための遺伝的アルゴリズムを幅広く取り扱いました。全コードはGitHubで公開しており、AIは異なる環境に合わせて再学習可能です。
In questo blog post presento il mio ultimo progetto, un gioco lunar lander creato in Python e supportato da una mia libreria C++ per reti neurali ad alte prestazioni. Ho implementato una rete neurale MLP addestrata con algoritmo genetico che permette all'AI di eseguire atterraggi stabili in scenari configurabili. Il progetto offre sia modalità di gioco manuale che guidata dall'NN, e comprende un sistema di training dettagliato. Mi sono concentrato su interoperabilità Python/C++, reti neurali e applicazione di algoritmi genetici all'AI di gioco. Il codice completo è su GitHub ed è facilmente adattabile a nuovi scenari.
In this blog post, I present my latest project, a lunar lander game developed in Python, powered by a high-performance C++ neural network library designed and written by me. My implementation uses a multi-layer perceptron trained with a genetic algorithm to develop an AI pilot capable of stable landings in configurable environments. The project incorporates manual play and NN-driven play, and provides a comprehensive training setup. Throughout, I explored Python/C++ interop, neural networks, and genetic algorithms for game AI. The complete code is available on GitHub, and the training routines can be adapted for new gameplay scenarios.
In this blog post, I demonstrate the application of Lagrangian mechanics to another classic problem, the pendulum. I define the system as a mass m on a massless rod of length r swinging under gravity g. I choose the angle \theta as the single generalized coordinate. I then calculate the kinetic energy T and potential energy V in terms of \theta and \dot\theta. Using these, I construct the Lagrangian \mathcal L = T - V and apply Lagrange's equation. This process systematically yields the well-known nonlinear equation of motion for the pendulum, \ddot\theta + (g/r)\sin\theta = 0.
In this post, I apply the Lagrangian method derived previously to an example, the rectilinear motion of a particle. I consider a particle of mass m moving along the x-axis under a potential V(x). I identify the single generalized coordinate as x. Then, I construct the kinetic energy T and the Lagrangian \mathcal L = T - V. By calculating the necessary partial derivatives \partial \mathcal L / \partial \dot x and \partial \mathcal L / \partial x and substituting them into Lagrange's equation, \frac{\mathrm d}{\mathrm d t} (\frac{\partial \mathcal L}{\partial \dot q_j}) - \frac{\partial \mathcal L}{\partial q_j} = 0, I demonstrate how this formalism naturally yields Newton's second law, m\ddot{x} = F_x.
In this blog post, I introduce an alternative approach to classical mechanics, the Lagrangian method. I begin by defining holonomic constraints and explaining how they reduce the number of coordinates needed to describe a system to its degrees of freedom, n. These n coordinates are called generalized coordinates, q_j. I then discuss the concept of virtual displacements, \delta \mathbf r_i, which are infinitesimal changes in position consistent with the constraints. Using d'Alembert's principle, which states \sum_i (\mathbf F_i - m_i \mathbf a_i) \cdot \delta\mathbf r_i = 0, I show how constraint forces can be eliminated from the equations of motion. Finally, I define the generalized force Q_j associated with each generalized coordinate q_j.
Explore the development of a Lunar Lander game using Python and Pygame. This post covers the main game loop, event handling, rendering of the lander, terrain, and HUD, and how configuration options shape the gameplay experience.
Explore the development of a Lunar Lander game using Python and Pygame. This post covers the main game loop, event handling, rendering of the lander, terrain, and HUD, and how configuration options shape the gameplay experience.
In this blog post, I present a JavaScript solution for dynamically generating chess diagrams using the Chess Mérida font. Instead of manually writing the HTML for each board, I use a script that reads a Forsyth–Edwards Notation (FEN) string provided in a `data-fen` attribute. The JavaScript parses this FEN string, identifies each piece or number of empty squares, and determines the correct Mérida glyph based on the piece type and whether it sits on a light or dark square. It then constructs the necessary HTML `div` structure for the board, including optional coordinate borders, and injects it into the designated placeholder element.
In this blog post, I explain my process for integrating the Chess Mérida font to effectively represent chess diagrams and notation online. I cover the specific glyphs used for pieces on both white and black squares, along with characters for figurine notation, border elements, and coordinate markers. I provide the necessary CSS setup to use this font and demonstrate how to style the board appearance with different color themes, including examples showing standard and alternative coordinate representations. This approach helps in creating clear visual representations of chess positions suitable for web content.
Explore the technical foundation of the Chess PGN Viewer. Learn how its PWA architecture enables offline access using service workers and how the integrated Dropbox sync feature handles PGN file management, including authentication, file operations, and conflict resolution based on timestamps.
Learn about the Chess PGN Viewer, a Progressive Web App designed for chess enthusiasts. Load, view, and navigate PGN files, even offline. Features include an interactive board, move highlighting, PGN header display, and optional Dropbox integration for file management and synchronization across devices.
This post continues the development of a reusable PWA template. We dive into implementing robust file synchronization with the Dropbox API, including authentication, conflict resolution, and offline handling. We also cover adding multi-language support using i18next and enabling offline functionality through Service Worker caching strategies.
This post details the initial steps in creating a reusable Progressive Web Application template. We cover setting up the HTML structure using Bootstrap 5 components like offcanvas sidebars and modals, applying custom CSS themes, implementing the core application logic, managing local storage for file data, and integrating common UI elements like datepickers and switches.