Graphical programming code judgment method and device and computer storage medium

By constructing a directed graph model and pre-setting judgment conditions, and parsing Scratch programming code, efficient and accurate automated judgment is achieved. This solves the problems of low efficiency and strong subjectivity in existing technologies, provides instant feedback and flexible configuration, and adapts to diverse teaching needs.

CN121597189APending Publication Date: 2026-03-03GUANGDONG LUXI ONLINE NON-DISCIPLINE TRAINING SCHOOL CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511613090.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-06
Publication Date
2026-03-03

AI Technical Summary

Technical Problem

Existing Scratch programming judging methods are inefficient, highly subjective, unable to effectively evaluate code process and structure, and lack flexibility and configurability, making them difficult to adapt to diverse teaching scenarios and personalized question requirements.

Method used

By parsing graphical programming code files, constructing a directed graph model, analyzing the logical connections between code blocks, and matching them with preset judging conditions, automated judging is achieved. This includes magic block combination patterns, logical predicate rules, and weighted scoring models.

Benefits of technology

It achieves efficient, accurate, and flexible automated grading, can identify logical structures and redundancy issues in code, provides instant and accurate feedback, reduces dependence on the runtime environment, adapts to various teaching scenarios, and improves teaching efficiency and learning experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121597189A_ABST
    Figure CN121597189A_ABST
Patent Text Reader

Abstract

The invention discloses a graphical programming code judgment method and device and a computer storage medium, and the method comprises the steps: receiving a graphical programming code file submitted by a user; analyzing the graphical programming code file, extracting code block information and parameters, and performing code structure analysis; and according to a code structure analysis result, matching with a preset question judgment condition, and giving a question judgment conclusion based on a matching result. According to the method for judging the problem of the graphical programming code, a code structure analysis and parameter matching method is adopted, so that the dependence on an operating environment is avoided, and the accuracy and the applicability of judging the problem are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of graphical programming technology, and specifically provides a method, apparatus, and computer storage medium for judging graphical programming code. Background Technology

[0002] With the rapid development of information technology, programming education has become an important way to cultivate computational thinking and innovation abilities in teenagers. In early childhood programming education, the Scratch graphical programming language, developed by the MIT Media Lab, has gained widespread global application due to its intuitive block-based interface and low barrier to entry. Learners can create programs by dragging and dropping coding blocks and combining them like building blocks, greatly reducing the cognitive load of learning programming.

[0003] However, with the surge in the number of Scratch programming learners, how to efficiently, accurately, and scalably assess students' programming assignments has become a significant challenge for educators. Currently, the assessment of Scratch code (usually saved as .sb3 project files) primarily relies on the following two traditional methods: Manual grading: Teachers manually download and open each student's project file, verifying its correctness by observing the code structure and running the program. While this method is flexible and allows for comprehensive evaluation, its drawbacks are extremely obvious: it is extremely inefficient and unsuitable for large classes; it is highly subjective, with different teachers potentially having different evaluation criteria for the same code; and it lacks timely feedback, failing to provide learners with real-time learning support.

[0004] Automated judging based on execution results: Some existing systems attempt to automatically run Scratch programs and capture their output (such as the final position and appearance changes of sprites on the stage) for comparison with preset correct answers. While this method frees up manpower to some extent, it has inherent and insurmountable technical flaws: Limitations of the judgment dimension: It can only judge the final result of a program's execution, but cannot evaluate the code process and structure that achieves that result. This leads to the possibility that multiple code implementations may produce the same result, but some of these implementations may use redundant, inefficient, or opportunistic logic that does not meet teaching requirements (e.g., using repeated move instructions instead of loop structures), and these structural problems cannot be detected by the execution result.

[0005] Insufficient coverage: For some problems that do not produce intuitive stage changes or are logically complex (e.g., require the use of specific variables or data structures), it is difficult to make an effective and accurate evaluation based solely on the results of the test.

[0006] Poor flexibility and configurability: Such systems typically lack the ability to allow teachers to customize complex grading rules, making them unable to adapt to diverse teaching scenarios and personalized question requirements.

[0007] In summary, existing Scratch judging methods are either limited by extremely low human efficiency and subjectivity, or by the inherent shortcomings of result-based judging in code structure evaluation. Therefore, there is an urgent need in this field for an intelligent judging technology that can directly perform deep structural analysis on the graphical code itself, thereby achieving automation, high precision, and flexible configuration, to overcome the aforementioned deficiencies of existing technologies.

[0008] In view of this, this invention patent is hereby proposed. Summary of the Invention

[0009] To address the aforementioned technical problems, this invention proposes a graphical programming code-based problem-solving method, apparatus, and computer storage medium. Specifically, the following technical solution is adopted: In a first aspect, the present invention provides a method for judging graphical programming code, comprising: Receive graphical programming code files submitted by users; The graphical programming code file is parsed to extract code block information and parameters, and code structure analysis is performed. Based on the code structure analysis results, the results are matched with the preset judgment conditions, and a judgment conclusion is given based on the matching results.

[0010] As an optional embodiment of the present invention, in the graphical programming code judgment method of the present invention, parsing the graphical programming code file, extracting code block information and parameters, and performing code structure analysis includes: Parse the JSON structure of the graphical programming code file to locate the list of code blocks; Traverse each code block node, extract its opcode, input parameters, parent node identifier, and child node identifier, and reconstruct the logical connection relationship of the code block.

[0011] As an optional embodiment of the present invention, in the graphical programming code judgment method of the present invention, the reconstruction of the logical connection relationship of the code block includes: Directed graph model for constructing code blocks G=(V, E) ,in, V It is a set of vertices, representing various code blocks; E yes An edge set represents the logical connection relationship between code blocks; by analyzing the topology of the directed graph model, the control flow structure and nesting hierarchy of the code are identified.

[0012] As an optional embodiment of the present invention, in the graphical programming code judgment method of the present invention, the analysis The topology of the directed graph model includes: calculating the out-degree and in-degree of the key code block nodes, wherein, Valid in-degree of event-type code blocks deg- ( v event)=0; This controls the out-degree of the code block. deg +( v control)≥1; The legality of the code block connection and the integrity of the logical structure are determined by the out-degree and in-degree information.

[0013] As an optional embodiment of the present invention, in the graphical programming code judging method of the present invention, according to The code structure analysis results are matched with the preset judging conditions. Based on the matching results, the judging conclusions are given, including: The preset judging criteria include at least one magic block combination pattern; The code block sequence obtained from the code structure analysis is matched with the magic block combination pattern. If the code block sequence contains the magic block combination pattern, the match is considered successful and the result is "pass". Otherwise, the match is considered unsuccessful and the result is "fail".

[0014] As an optional embodiment of the present invention, in the graphical programming code judgment method of the present invention, the subsequence matching of the code block sequence obtained by code structure analysis with the magic block combination pattern adopts a sequence similarity algorithm based on dynamic time warping: Calculate the sequence of user code blocks S =( s 1, s 2, ..., sm ) and standard magic block sequence T =( t 1, t 2, ..., tn Regularized paths and similarities between them; Define the cumulative cost matrix. D Its elements D ( i , j ) represents a subsequence S (1: i )and T (1: j The minimum cumulative distance between them is calculated recursively using the following formula: ; Among them, dist( si , tjLet be the distance function between two code blocks on their opcodes and arguments; the final similarity is... When Sim≥ θ During match, θ `match` is a preset similarity threshold; if a match is deemed successful, the conclusion is "passed".

[0015] As an optional embodiment of the present invention, in the graphical programming code judging method of the present invention, according to The code structure analysis results are matched with the preset judging conditions. Based on the matching results, the judging conclusions are given, including: The preset judgment conditions are defined by a set of logical predicate rules; The code structure analysis results are mapped to a series of factual propositions, which are then substituted into the logical predicate rules for logical reasoning. The logical predicate rule takes the following form: ; in, P 1, P 2, ..., Pk The conditional predicate is constructed based on the opcode, parameters, and nesting relationships of the code block. If all conditional predicates are true, then the judgment is true, and the conclusion is passed.

[0016] As an optional embodiment of the present invention, the graphical programming code judging method of the present invention includes: Preset multiple judgment conditions and their corresponding weights wi ; Based on the code structure analysis results, calculate the matching score for each judgment condition. si ∈[0,1]; The total score of the judgment results Score Calculated using the following formula: ; like Score ≥ θ If the condition is "pass", the conclusion is "passed"; otherwise, the conclusion is "failed". θ `pass` is the preset pass threshold.

[0017] In a second aspect, the present invention provides a graphical programming code judging device, comprising: The programming code file receiving module receives graphical programming code files submitted by users; The code structure parsing module parses the graphical programming code file, extracts code block information and parameters, and performs code structure analysis. The code evaluation module matches the code structure analysis results with preset evaluation conditions and gives a evaluation conclusion based on the matching results.

[0018] In a third aspect, the present invention provides a computer-readable recording medium storing a computer-executable program, which, when executed, implements the graphical programming code-based judgment method.

[0019] The graphical programming code judging method provided by this invention achieves automatic judging by directly parsing and analyzing the code structure and matching it with preset judging conditions. This brings a series of significant technical advancements and beneficial effects, specifically reflected in the following aspects: 1. Significantly improved the accuracy and reliability of question judging. By directly analyzing the opcodes, parameters, and logical structure of code blocks, this invention can accurately identify the implementation logic of the code, effectively avoiding the misjudgment problem caused by "different codes producing the same result" in traditional test-taking. The system can detect whether there are specific structures in the code that meet teaching requirements (such as loops and conditional statements), or whether there are redundant or inefficient implementation methods, thereby making a more realistic and comprehensive assessment of students' programming abilities, and fundamentally improving the accuracy and reliability of the test-taking results.

[0020] 2. Greatly enhances the flexibility and configurability of the grading process. The core of this method lies in matching with "pre-defined judging conditions." This allows teachers or question setters to flexibly define diverse judging rules based on teaching objectives and question requirements, including but not limited to: requiring the use of specific code blocks, prohibiting the use of certain code blocks, requiring parameters to meet specific ranges, and requiring code blocks to follow specific nesting or combination patterns (magic block judging). This flexibility enables the system to adapt to various teaching scenarios, from basic syntax checking to complex logic evaluation, meeting the urgent need for personalized and refined assessment in modern programming education.

[0021] 3. It achieves high efficiency and automation, significantly reducing labor costs. This method achieves a fully automated code analysis, matching, and judging process, enabling the batch processing of a large number of student submissions in an instant. This completely solves the pain points of traditional manual judging, such as low efficiency, strong subjectivity, and delayed feedback, freeing teachers from heavy repetitive tasks and allowing them to focus more on instructional design and personalized guidance. This significantly reduces teaching and operational costs and improves overall teaching efficiency.

[0022] 4. Provides instant and accurate feedback to optimize the learning experience. The system can provide an immediate assessment result after students submit their code. More importantly, the matching process based on code structure analysis allows the system not only to determine whether the code is correct or incorrect, but also to accurately pinpoint the cause of the error or missing parts of the code (e.g., "loop structure not used" or "incorrect steering angle parameter"), thus providing students with clear and instructive feedback. This instant and precise feedback mechanism greatly optimizes the student learning experience, promotes self-directed learning and rapid iteration, and effectively improves learning outcomes.

[0023] 5. Reduced dependence on the operating environment and enhanced system applicability. Because this method does not require actual code execution, it avoids dependencies on the Scratch runtime environment, browser plugins, or virtual display devices, and also mitigates the risk of runtime failure due to infinite loops, performance issues, or external dependencies. This makes the system more stable and easier to deploy on various servers and teaching platforms, expanding its application scope. Attached Figure Description

[0024] Figure 1 A flowchart of a graphical programming code-based problem-solving method according to an embodiment of the present invention; Figure 2 A schematic diagram of the structure of the electronic device according to an embodiment of the present invention; Figure 3 A schematic diagram of a computer-readable recording medium according to an embodiment of the present invention. Detailed Implementation

[0025] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments.

[0026] Therefore, the following detailed description of embodiments of the present invention is not intended to limit the scope of the claimed invention, but merely illustrates some embodiments of the invention. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without inventive effort are within the scope of protection of the present invention.

[0027] It should be noted that, unless otherwise specified, the embodiments and features and technical solutions in the present invention can be combined with each other.

[0028] It should be noted that similar labels and letters in the following figures indicate similar items. Therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures.

[0029] In the description of this invention, it should be noted that the terms "upper," "lower," etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings, or the orientation or positional relationship commonly used when the product of this invention is in use, or the orientation or positional relationship commonly understood by those skilled in the art. These terms are only for the convenience of describing this invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation, and therefore should not be construed as a limitation of this invention. In addition, the terms "first," "second," etc., are only used to distinguish descriptions and should not be construed as indicating or implying relative importance.

[0030] See Figure 1 As shown, this embodiment provides a graphical programming code-based problem-solving method, including: Receive graphical programming code files submitted by users; The graphical programming code file is parsed to extract code block information and parameters, and code structure analysis is performed. Based on the code structure analysis results, the results are matched with the preset judgment conditions, and a judgment conclusion is given based on the matching results.

[0031] The graphical programming code judging method provided in this invention achieves automatic judging by directly parsing and analyzing the code structure and matching it with preset judging conditions. This brings a series of significant technical advancements and beneficial effects, specifically reflected in the following aspects: 1. Significantly improved the accuracy and reliability of question judging. By directly analyzing the opcodes, parameters, and logical structure of code blocks, this invention can accurately identify the implementation logic of the code, effectively avoiding the misjudgment problem caused by "different codes producing the same result" in traditional test-taking. The system can detect whether there are specific structures in the code that meet teaching requirements (such as loops and conditional statements), or whether there are redundant or inefficient implementation methods, thereby making a more realistic and comprehensive assessment of students' programming abilities, and fundamentally improving the accuracy and reliability of the test-taking results.

[0032] 2. Greatly enhances the flexibility and configurability of the grading process. The core of this method lies in matching with "pre-defined judging conditions." This allows teachers or question setters to flexibly define diverse judging rules based on teaching objectives and question requirements, including but not limited to: requiring the use of specific code blocks, prohibiting the use of certain code blocks, requiring parameters to meet specific ranges, and requiring code blocks to follow specific nesting or combination patterns (magic block judging). This flexibility enables the system to adapt to various teaching scenarios, from basic syntax checking to complex logic evaluation, meeting the urgent need for personalized and refined assessment in modern programming education.

[0033] 3. It achieves high efficiency and automation, significantly reducing labor costs. This method achieves a fully automated code analysis, matching, and judging process, enabling the batch processing of a large number of student submissions in an instant. This completely solves the pain points of traditional manual judging, such as low efficiency, strong subjectivity, and delayed feedback, freeing teachers from heavy repetitive tasks and allowing them to focus more on instructional design and personalized guidance. This significantly reduces teaching and operational costs and improves overall teaching efficiency.

[0034] 4. Provides instant and accurate feedback to optimize the learning experience. The system can provide an immediate assessment result after students submit their code. More importantly, the matching process based on code structure analysis allows the system not only to determine whether the code is correct or incorrect, but also to accurately pinpoint the cause of the error or missing parts of the code (e.g., "loop structure not used" or "incorrect steering angle parameter"), thus providing students with clear and instructive feedback. This instant and precise feedback mechanism greatly optimizes the student learning experience, promotes self-directed learning and rapid iteration, and effectively improves learning outcomes.

[0035] 5. Reduced dependence on the operating environment and enhanced system applicability. Because this method does not require actual code execution, it avoids dependencies on the Scratch runtime environment, browser plugins, or virtual display devices, and also mitigates the risk of runtime failure due to infinite loops, performance issues, or external dependencies. This makes the system more stable and easier to deploy on various servers and teaching platforms, expanding its application scope.

[0036] As an optional implementation of this embodiment, in the graphical programming code judging method described in this embodiment, parsing the graphical programming code file, extracting code block information and parameters, and performing code structure analysis includes: Parse the JSON structure of the graphical programming code file to locate the list of code blocks; Traverse each code block node, extract its opcode, input parameters, parent node identifier, and child node identifier, and reconstruct the logical connection relationship of the code block.

[0037] This embodiment parses the JSON structure of Scratch project files and extracts key attributes. This method accurately transforms abstract, visual block code into structured data objects. The step of "reconstructing the logical connections between code blocks" restores scattered code block nodes to a logical flow with complete semantics, achieving the crucial transformation from data to model. This provides an accurate and reliable data foundation for all subsequent automated analysis and is a technological prerequisite for replacing human visual recognition of code structure.

[0038] Furthermore, in the graphical programming code judging method described in this embodiment, the reconstruction of the logical connection relationship of the code blocks includes: Directed graph model for constructing code blocks G=(V, E) ,in, V It is a set of vertices, representing various code blocks; E yes An edge set represents the logical connection relationship between code blocks; by analyzing the topology of the directed graph model, the control flow structure and nesting hierarchy of the code are identified.

[0039] This embodiment abstracts the code structure into a directed graph model. G=(V, E) This is a major technical contribution of the present invention. The model naturally expresses the connections, nesting, and control flow relationships between code blocks, enabling computers to use mature graph algorithms for deep traversal and analysis of the code. Based on this model, the system can identify complex logical structures that are difficult to quickly discern with the naked eye, such as deeply nested loops, convergence points of conditional branches, and concurrently executing threads, thereby achieving a qualitative leap in understanding code logic and a depth of analysis far exceeding simple string or sequence matching.

[0040] In this embodiment of the graphical programming code judgment method, analyzing the topology of the directed graph model includes: calculating the out-degree and in-degree of key code block nodes, wherein, Valid in-degree of event-type code blocks deg- ( v event)=0; This controls the out-degree of the code block. deg +( v control)≥1; The legality of the code block connection and the integrity of the logical structure are determined by the out-degree and in-degree information.

[0041] This implementation innovatively proposes determining the legality of code logic by analyzing the topology of a directed graph and calculating the out-degree and in-degree of key nodes. For example: The rule that event blocks (such as "when the green flag is clicked") must have an in-degree of 0 effectively identifies incorrect event block connections.

[0042] By specifying that the out-degree of control blocks (such as "loop" and "conditional judgment") must be at least 1, the integrity of the control structure is ensured, and logical errors such as "empty loop" or "default branch" can be effectively detected.

[0043] This rule-based judgment, based on graph theory properties, provides a calculable and objective standard for verifying "code structural integrity" and "syntactic compliance," enabling automated evaluation of code quality—something traditional runtime judgment methods cannot achieve.

[0044] Because the entire code structure analysis process is based on a clear graph model and mathematical rules, the system can accurately pinpoint abnormal nodes or illegal connections in the structure graph when providing judgments. For example, it can explicitly point out that "a control block lacks an internal execution body (out-degree is 0)" or "an event block is incorrectly nested (in-degree is not 0)." This makes the generated feedback information no longer a vague "error," but rather specific, locatable, and understandable guidance, greatly improving the quality of teaching feedback and directly contributing to students' learning improvement.

[0045] In summary, this optional implementation method, by transforming graphical code into a graph model and applying graph theory analysis, not only provides a core technical means for achieving high-precision judgment, but also enables the system to perceive the "form" of code logic, thereby resulting in significant technical progress in automation, intelligence, and interpretability.

[0046] As an optional implementation of this embodiment, in a graphical programming code-based problem-solving method, according to The code structure analysis results are matched with the preset judging conditions. Based on the matching results, the judging conclusions are given, including: The preset judging criteria include at least one magic block combination pattern; The code block sequence obtained from the code structure analysis is matched with the magic block combination pattern. If the code block sequence contains the magic block combination pattern, the match is considered successful and the result is "pass". Otherwise, the match is considered unsuccessful and the result is "fail".

[0047] Specifically, in the graphical programming code judgment method of this embodiment, the subsequence matching of the code block sequence obtained from code structure analysis with the magic block combination pattern adopts a sequence similarity algorithm based on dynamic time warping: Calculate the sequence of user code blocks S =( s 1, s 2, ..., sm ) and standard magic block sequence T =( t 1, t 2, ..., tn Regularized paths and similarities between them; Define the cumulative cost matrix. D Its elements D ( i , j ) represents a subsequence S (1: i )and T (1: j The minimum cumulative distance between them is calculated recursively using the following formula: Among them, dist( si , tj Let be the distance function between two code blocks on their opcodes and arguments; the final similarity is... When Sim≥ θ During match, θ `match` is a preset similarity threshold; if a match is deemed successful, the conclusion is "passed".

[0048] This optional implementation method, by introducing the "magic block combination pattern" and its subsequence matching algorithm, provides an efficient, accurate, and highly flexible implementation path for the core judging method. The specific benefits it brings are as follows: 1. It achieves precise capture of programming logic and intent, improving the essential accuracy of judgment. Traditional judgment methods focus solely on the "effect" of program output, while this method, by matching "magic block combination patterns," directly focuses on the "cause" of functionality. It accurately identifies whether the code contains key building block combinations that embody specific programming thinking (such as loops, conditional statements, and event handling), thereby determining whether students truly understand and master the core knowledge points required by the question. This direct verification of programming logic and intent fundamentally avoids misjudgments caused by different code achieving the same result, elevating the accuracy of judgment from "correct result" to a higher level of "logical correctness."

[0049] 2. It offers extremely high teaching flexibility and configurability, perfectly adapting to diverse teaching scenarios.

[0050] The "Magic Block Combination Pattern," as an abstract concept, allows teachers to freely define what constitutes a "correct" or "excellent" code pattern based on the teaching progress and the objectives of the problem. For example, for a problem involving "drawing a square," the teacher can define that a combination of repetitive execution + movement + turning must be used, thus guiding students to use loop structures instead of repetitive movement instructions. This design empowers educational experts to make decisions regarding the grading system, transforming it from a rigid automation tool into an intelligent agent capable of executing complex teaching strategies, greatly expanding its application scope in education.

[0051] 3. The algorithm is extremely efficient, supports real-time feedback, and optimizes the interactive experience. Subsequence matching algorithms (such as variants based on dynamic programming or efficient string matching algorithms) have relatively low computational complexity, enabling the scanning and matching of code sequences within milliseconds. This allows the present invention to support real-time grading requirements under high concurrency, providing immediate feedback to students after they submit their code. This immediacy is crucial for maintaining students' learning motivation, promoting rapid trial and error, and iterative optimization, completely changing the pain point of long feedback cycles in previous programming assignments and greatly optimizing the human-computer interaction experience.

[0052] 4. Enhanced system reliability and robustness, and reduced false positive rate. Because this method is based on deterministic matching of code structure, its results are unaffected by the program's runtime environment, external dependencies, or random factors. As long as the code is parsed correctly, the matching process is stable and repeatable. It will not completely reject an entire work due to non-critical errors in the program (such as a deviation in the initial position of a character) or irrelevant extra code (such as redundant comment blocks or sound blocks); as long as the core "magic block combination" exists and is correct, it will be judged as passing. This fault tolerance based on core logic makes the judgment conclusions more fair and reasonable, and better meets the actual needs of teaching assessment.

[0053] 5. Provides a data foundation for generating targeted learning feedback. The matching process not only produces a binary "pass / fail" conclusion, but also pinpoints the exact location of the matching failure. Based on this, the system can generate highly valuable formative feedback, such as: "Your code is missing a 'loop' structure" or "Your 'if...then' condition has an incorrect evaluation." This specific, actionable guidance goes beyond simple result judgment, truly aiding learning and promoting understanding, making it a key element in achieving personalized instruction.

[0054] In summary, this implementation method transforms the abstract "code structure matching" into a concrete, computable, and highly efficient algorithmic process through subsequence matching of the "magic block combination pattern." While ensuring the accuracy of judgment, it endows the system with unprecedented flexibility and educational value, representing a key technological breakthrough in the practical application of this invention.

[0055] As another optional implementation of this embodiment, in a graphical programming code judgment method of this embodiment, the code structure analysis results are matched with preset judgment conditions, and a judgment conclusion is given based on the matching results. include: The preset judgment conditions are defined by a set of logical predicate rules; The code structure analysis results are mapped to a series of factual propositions, which are then substituted into the logical predicate rules for logical reasoning. The logical predicate rule takes the following form: ; in, P 1, P 2, ..., Pk The conditional predicate is constructed based on the opcode, parameters, and nesting relationships of the code block. If all conditional predicates are true, then the judgment is true, and the conclusion is passed.

[0056] This embodiment presents a graphical programming code-based judgment method that defines a set of logical predicate rules to construct a small expert system or inference engine. The judgment process is based on symbolic derivation of logical rules, rather than computation using a black-box model. This makes the entire inference chain transparent, traceable, and absolutely rigorous. When the system provides a judgment conclusion, it clearly shows which rule(s) were triggered or not satisfied, thus providing irrefutable logical evidence for the "pass" or "fail" conclusion. This interpretability is crucial for teaching scenarios, enabling students and teachers to clearly understand the compliance and defects of the code, elevating the judgment system from a "judge" to a "mentor."

[0057] Logic-based reasoning is deterministic: the same code and rules as input will always produce the same output. Its performance does not depend on uncontrollable training data or random initialization, and the results are unaffected by probability. This makes the system highly stable and reliable, ideal for high-stakes testing or certification environments, providing a solid guarantee for the fairness and consistency of automated assessment.

[0058] Logical predicate rules, as independent and modular knowledge units, allow teachers or domain experts to flexibly define and adjust grading criteria by adding, deleting, or modifying predicate rules without altering the system's core code. This design enables the system to easily adapt to the needs of different courses, questions, and even grading standards, achieving decoupling between the grading logic and the system platform. The system is highly scalable and can support new programming concepts or code anti-pattern checks by expanding the rule base in the future, giving it long-term viability.

[0059] Furthermore, a method for judging graphical programming code in this embodiment includes: Preset multiple judgment conditions and their corresponding weights wi ; Based on the code structure analysis results, calculate the matching score for each judgment condition. si ∈[0,1]; The total score of the judgment results Score Calculated using the following formula: ; like Score ≥ θIf the condition is "pass", the conclusion is "passed"; otherwise, the conclusion is "failed". θ `pass` is the preset pass threshold.

[0060] The optional implementation of the graphical programming code judging method in this embodiment upgrades binary judging to refined scoring by introducing a weighted scoring model, providing a more modern educational evaluation approach for the core judging method. Traditional automated judging systems typically output binary conclusions of "correct" or "incorrect," failing to reflect the actual situation where students' code may contain partially correct or substandard parts. This method addresses this by assigning weights to each judging condition. wi And calculate the matching score. si Finally, a continuous score is synthesized. Score This enables a multi-dimensional and refined evaluation of submitted code. This allows the system to identify and reward code that achieves the core objectives but has minor flaws, as well as code that, while lacking core logic, only partially implements functionality. Consequently, it provides more scientific and fairer evaluation results, more accurately reflecting students' mastery levels.

[0061] Weight wi The allocation of scores essentially quantifies the importance of different assessment criteria (i.e., different knowledge points and ability requirements). Teachers can adjust the weights to clearly convey teaching priorities; for example, the weight of "using loop structures" can be set much higher than that of "the character's initial position is correct." This design ensures that the scoring criteria are highly aligned with the teaching objectives. Through score feedback, students not only know whether they have passed or not, but also clearly understand where their code falls short in key areas, effectively guiding their subsequent learning and modification, thus fulfilling the guiding and motivating functions of evaluation.

[0062] The weighted scoring model has extremely strong expressive power, and can be modified by configuring different weight combinations and thresholds. θ The `pass` function can be easily adapted to diverse teaching scenarios. For example: For formative exercises: a low pass threshold can be set to encourage students to try boldly.

[0063] For summative exams: High pass thresholds can be set and multiple core criteria must be scored highly for rigorous assessment.

[0064] Support challenging tasks: Additional weight can be assigned to supplementary questions such as "implementing innovative functions" to incentivize students with extra learning capacity.

[0065] This flexibility allows a single system to serve the diverse assessment needs throughout the entire teaching process.

[0066] In summary, the graphical programming code-based question-judging method of this embodiment, by introducing a weighted scoring model, elevates the present invention from a functional question-judging tool to a powerful teaching assessment and analysis platform. It not only overcomes the limitations of binary question-judging but also deeply integrates teaching intent, learning feedback, and data analysis through quantitative scoring and weight configuration, greatly enhancing the system's scientific rigor, adaptability, and practical value.

[0067] This embodiment also provides a graphical programming code judging device, including: The programming code file receiving module receives graphical programming code files submitted by users; The code structure parsing module parses the graphical programming code file, extracts code block information and parameters, and performs code structure analysis. The code evaluation module matches the code structure analysis results with preset evaluation conditions and gives a evaluation conclusion based on the matching results.

[0068] Figure 2 This is a schematic diagram of the structure of an electronic device according to an embodiment of the present invention. The electronic device includes a processor and a memory. The memory is used to store a computer-executable program. When the computer program is executed by the processor, the processor executes a graphical programming code judgment method according to an embodiment.

[0069] like Figure 2 As shown, the electronic device is embodied in the form of a general-purpose computing device. There can be one or more processors working collaboratively. This invention also does not preclude distributed processing, meaning that processors can be distributed across different physical devices. The electronic device of this invention is not limited to a single entity, but can also be the sum of multiple physical devices.

[0070] The memory stores a computer-executable program, typically machine-readable code. The computer-readable program can be executed by the processor to enable the electronic device to perform the method of the present invention, or at least some steps of the method.

[0071] The memory includes volatile memory, such as random access memory (RAM) and / or cache memory, and may also be non-volatile memory, such as read-only memory (ROM).

[0072] Optionally, in this embodiment, the electronic device further includes an I / O interface for exchanging data with external devices. The I / O interface can represent one or more of several bus structures, including a memory cell bus or memory cell controller, a peripheral bus, a graphics acceleration port, a processing unit, or a local bus using any of the various bus structures.

[0073] It should be understood that Figure 2 The electronic device shown is merely one example of the present invention, and the electronic device of the present invention may also include elements or components not shown in the above examples. For example, some electronic devices also include display units such as displays, and some electronic devices also include human-computer interaction elements such as buttons and keyboards. Any electronic device capable of executing a computer-readable program in memory to implement the method of the present invention or at least some steps of the method can be considered as an electronic device covered by the present invention.

[0074] Figure 3 This is a schematic diagram of a computer-readable recording medium according to an embodiment of the present invention. Figure 3 As shown, a computer-readable recording medium stores a computer-executable program. When executed, the computer-executable program implements a graphical programming code judgment method according to an embodiment of the present invention. The computer-readable recording medium may include data signals propagated in baseband or as part of a carrier wave, carrying readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. The readable recording medium may also be any readable medium other than a readable recording medium, which can send, propagate, or transmit programs for use by or in conjunction with an instruction execution system, apparatus, or device. The program code contained on the readable recording medium can be transmitted using any suitable medium, including but not limited to wireless, wired, optical fiber, RF, etc., or any suitable combination thereof.

[0075] Program code for performing the operations of this invention can be written in any combination of one or more programming languages, including object-oriented programming languages ​​such as Java and C++, and conventional procedural programming languages ​​such as C or similar languages. The program code can execute entirely on the user's computing device, partially on the user's device, as a standalone software package, partially on the user's computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving remote computing devices, the remote computing device can be connected to the user's computing device via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computing device (e.g., via the Internet using an Internet service provider).

[0076] From the above description of the embodiments, those skilled in the art will readily understand that the present invention can be implemented by hardware capable of executing specific computer programs, such as the system of the present invention, and the electronic processing unit, server, client, mobile phone, control unit, processor, etc. included in the system. The present invention can also be implemented by computer software executing the methods of the present invention, for example, by control software executed by a microprocessor, electronic control unit, client, server, etc. However, it should be noted that the computer software executing the methods of the present invention is not limited to execution in one or a specific set of hardware entities; it can also be implemented in a distributed manner by unspecified hardware. For computer software, the software product can be stored on a computer-readable recording medium (such as a CD-ROM, USB flash drive, portable hard disk, etc.) or distributed across a network, as long as it enables electronic devices to execute the methods according to the present invention.

[0077] The above embodiments are only used to illustrate the present invention and are not intended to limit the technical solutions described herein. Although the present invention has been described in detail with reference to the above embodiments, the present invention is not limited to the specific embodiments described above. Therefore, any modifications or equivalent substitutions to the present invention, as well as all technical solutions and improvements that do not depart from the spirit and scope of the invention, are covered within the scope of the claims of the present invention.

Claims

1. A method for judging graphical programming code, characterized in that, include: Receive graphical programming code files submitted by users; The graphical programming code file is parsed to extract code block information and parameters, and code structure analysis is performed. Based on the code structure analysis results, the results are matched with the preset judgment conditions, and a judgment conclusion is given based on the matching results.

2. The method for judging graphical programming code according to claim 1, characterized in that, Parsing the graphical programming code file, extracting code block information and parameters, and performing code structure analysis includes: Parse the JSON structure of the graphical programming code file to locate the list of code blocks; Traverse each code block node, extract its opcode, input parameters, parent node identifier, and child node identifier, and reconstruct the logical connection relationship of the code block.

3. The method for judging graphical programming code according to claim 2, characterized in that, The logical connection relationships of the reconstructed code blocks include: Directed graph model for constructing code blocks G=(V, E) ,in, V It is a set of vertices, representing various code blocks; E yes An edge set represents the logical connection relationship between code blocks; by analyzing the topology of the directed graph model, the control flow structure and nesting hierarchy of the code are identified.

4. The method for judging graphical programming code according to claim 3, characterized in that, Analysis of the above The topology of a directed graph model includes: calculating the out-degree and in-degree of key code block nodes, where, Valid in-degree of event-type code blocks deg- ( v event)=0; This controls the out-degree of the code block. deg +( v control)≥1; The legality of the code block connection and the integrity of the logical structure are determined by the out-degree and in-degree information.

5. The method for judging graphical programming code according to claim 1, characterized in that, According to the code The structural analysis results are matched with the preset judgment conditions. Based on the matching results, the judgment conclusions are given, including: The preset judging criteria include at least one magic block combination pattern; The code block sequence obtained from the code structure analysis is matched with the magic block combination pattern. If the code block sequence contains the magic block combination pattern, the match is considered successful and the result is "pass". Otherwise, the match is considered unsuccessful and the result is "fail".

6. The method for judging graphical programming code according to claim 5, characterized in that, The subsequence matching between the code block sequence obtained from code structure analysis and the magic block combination pattern employs a sequence similarity algorithm based on dynamic time warping. Calculate the sequence of user code blocks S =( s 1, s 2, ..., sm ) and standard magic block sequence T =( t 1, t 2, ..., tn Regularized paths and similarities between them; Define the cumulative cost matrix. D Its elements D ( i , j ) represents a subsequence S (1: i )and T (1: j The minimum cumulative distance between () is recursively calculated using the following formula: ; Among them, dist( si , tj Let be the distance function between two code blocks on their opcodes and arguments; the final similarity is... When Sim≥ θ During match, θ `match` is a preset similarity threshold; if a match is deemed successful, the conclusion is "passed".

7. The method for judging graphical programming code according to claim 1, characterized in that, According to the code The structural analysis results are matched with the preset judgment conditions. Based on the matching results, the judgment conclusions are given, including: The preset judgment conditions are defined by a set of logical predicate rules; The code structure analysis results are mapped to a series of factual propositions, which are then substituted into the logical predicate rules for logical reasoning. The logical predicate rule takes the following form: ; in, P 1, P 2, ..., Pk The conditional predicate is constructed based on the opcode, parameters, and nesting relationships of the code block. If all conditional predicates are true, then the judgment is true, and the conclusion is passed.

8. The method for judging graphical programming code according to claim 1, characterized in that, include: Preset multiple judging conditions and their corresponding weights wi ; Based on the code structure analysis results, calculate the matching score for each judgment condition. si ∈[0,1]; The total score of the judgment results Score Calculated using the following formula: ; like Score ≥ θ If the condition is "pass", the conclusion is "passed"; otherwise, the conclusion is "failed". θ `pass` is the preset pass threshold.

9. A graphical programming code judging device, characterized in that, include: The programming code file receiving module receives graphical programming code files submitted by users; The code structure parsing module parses the graphical programming code file, extracts code block information and parameters, and performs code structure analysis. The code evaluation module matches the code structure analysis results with preset evaluation conditions and gives a evaluation conclusion based on the matching results.

10. A computer-readable recording medium storing a computer-executable program, characterized in that, When the computer executable program is executed, it implements a graphical programming code judgment method as described in any one of claims 1-8.