STEMM Institute Press
Science, Technology, Engineering, Management and Medicine
Structural Similarity Detection for Scratch Programs Using Block Relationship Reconstruction
DOI: https://doi.org/10.62517/jike.202604402
Author(s)
Yingjiang Wang
Affiliation(s)
College of Information Engineering, Suqian University, Suqian, Jiangsu, China
Abstract
Direct text comparison of Scratch programs is not feasible because they are shown in graphical blocks. This paper studies block relationship reconstruction and opcode sequence matching in an existing program comparison system. Read sprite and block records in the system, organise scripts according to their connections, convert opcodes to text, and calculate structural similarity with difference feedback. The implementation is shown by source code analysis, project modification and small-scale structure tests. Out of 32 cases, 30 returned a similarity score, and the two cases with malformed connections exceeded the time limit set by the test harness. As shown in the results, the method can distinguish among the selected opcode substitutions, block insertions and deletions, ordering changes, etc., and filters out some differences in identifiers and editor coordinates. However, some parameter values, Stage codes and branches have not been fully included in the comparison. Therefore, we can compare the structure with the reference template, but we do not know whether it is effective.
Keywords
Scratch; Block-Based Programming; Structural Similarity; Opcode; Static Analysis
References
[1] MALONEY J, RESNICK M, RUSK N, et al. The Scratch programming language and environment. ACM Transactions on Computing Education, 2010, 10(4): Article 16. [2] RESNICK M, MALONEY J, MONROY-HERNÁNDEZ A, et al. Scratch: Programming for all. Communications of the ACM, 2009, 52(11): 60–67. [3] BOE B, HILL C, LEN M, et al. Hairball: Lint-inspired static analysis of Scratch projects. In: Proceedings of the 44th ACM Technical Symposium on Computer Science Education. New York: ACM, 2013: 215–220. [4] ROBLES G, PONS G, ESCOBAR-MORALES D, et al. Dr. Scratch 2.0 (CT4ALL): Advanced modes and rubrics for assessing computational thinking in Scratch projects. SoftwareX, 2025, 32: 102359. [5] FEIN B, OBERMÜLLER F, FRASER G. LitterBox+: An Extensible Framework for LLM-enhanced Scratch Static Code Analysis. In: 2025 40th IEEE/ACM International Conference on Automated Software Engineering (ASE). IEEE, 2025: 3989–3992. [6] FELDMEIER P, FRASER G, HEUER U, et al. A Block-Based Testing Framework for Scratch. In: Proceedings of the 24th Koli Calling International Conference on Computing Education Research. New York: ACM, 2024: Article 1, 1–12. [7] FELDMEIER P, SCHMELZ K, FRASER G. Many-Objective Neuroevolution for Testing Games. In: 2025 IEEE Conference on Software Testing, Verification and Validation (ICST). IEEE, 2025: 244–254. [8] GÖTZ K, FELDMEIER P, FRASER G. Model-based Testing of Scratch Programs. In: 2022 IEEE Conference on Software Testing, Verification and Validation (ICST). IEEE, 2022: 411–421. [9] QURADAA F H, SHAHZAD S, ALMOQBILY R S. A systematic literature review on the applications of recurrent neural networks in code clone research. PLOS ONE, 2024, 19(2): e0296858. [10]BRENNAN K, RESNICK M. New frameworks for studying and assessing the development of computational thinking. In: American Educational Research Association Annual Meeting. Vancouver, 2012. [11]SCRATCH FOUNDATION. Scratch-vm: src/serialization/sb3.js. develop branch. Accessed September 23, 2026. [12]PYTHON SOFTWARE FOUNDATION. difflib—Helpers for computing deltas. Python 3.12 documentation. Accessed September 23, 2026.
Copyright @ 2020-2035 STEMM Institute Press All Rights Reserved