1 / 29

A Semantic Analyzer for Simple Games Source Codes to Programming Learning

A Semantic Analyzer for Simple Games Source Codes to Programming Learning. Elanne Cristina O. dos Santos (elannecristina.santos@ifpi.edu.br) Gleison Brito Batista Victor Hugo Vieira de Sousa Esteban Clua. It is formed by a set of java classes!

joshwa
Download Presentation

A Semantic Analyzer for Simple Games Source Codes to Programming Learning

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. A Semantic Analyzer for Simple Games Source Codes to Programming Learning Elanne Cristina O. dos Santos (elannecristina.santos@ifpi.edu.br) Gleison Brito Batista Victor Hugo Vieira de Sousa Esteban Clua

  2. It is formed by a set of java classes! It is using JPlay, this means the execution of the program is concentrated on JPlay classes! Student Program JPlay Motivation Many studies point to difficulties of teaching and learning the algorithms and programming. JPlay was developed in UFF university. It is a framework used for teaching programming and it provides teaching of algorithmic logic through the game development. Context

  3. Problem • The student mayhavedifficulty to undertand some erros thathappenduring the buildingprocess of a program. • Goal • To compare two programs (student program and model program); • To make suggestions about the behaviors differences found in the student program. • The teacher adds and edits the suggestions using comments in the source code of the model. Errors Compilation Results Student Program JPlay

  4. Summary Introduction An Heuristic based on Behaviors Comparison of Programs JPlay Standardization model Classes Pairs Classification Variables Pairs Classification And Comparison of Behavior Trees Results Conclusion

  5. Introduction Our proposal is the development of a analyzer. The analyzerhas a functionofinterpreting a Java program developedthat uses the JPlayandreturnresults of this examination to thestudent. The process is anheuristicand it consistson: transformingalljava classes of thestudentprogramto XML files andtransformingalljava classes ofthemodelprogram to XML files. Comparing the two programs and after it combines the pairs of similar classes. checking standardization in the student program. findingsequencial patterns of Jplay in thestudentprogram. 5. comparingbehaviors of thestudentprogramandbehaviors of the model program.

  6. An Heuristic based on Behaviors Comparison of Programs

  7. What is a JPlaySequentialPattern? main() { GameLoopobject = newGameLoop(); } public class GameLoop { ..... while(true) { } } A sequencepattern of JPlayis a codesequence in the program thatmustalwayshappen. JPlay follows a typical code sequence pattern: A main method must be defined in the initialization of the program. Example: In the body of the main method objects are declared, one of these objects must contain a game loop (infinite loop). Example: C. In the class that contains the game loop (infinite loop) objects are declared, then at this point it is possible to check the behavior of these objects.

  8. What is a behavior? The behaviors are foundwhen it happensanassigment, loop orconditional in the program class. In the XML file this is representedby a <behavior> tag. Example:

  9. Classes Pairs Classification There are specific rules to find the first and second pair. In order to classify the first pair of similar classes we establish as a single rule that the class contains the “main” method. After, in order to classify the second pair of similar classes we establish only one rule: if the class contains the game loop. After the analyzer will take the rest of the classes of the program to be processed.

  10. public class Ball extends Sprite { int x, j; boolean m,n; String a,b,c; } public class MyBall extends Sprite { int a, b, c; boolean d,f; } 1 0 3 Weight = 4 Classification Rule from the third pair of similar classes on • The analyzer will search pair of classes that extend from the same super class. For example: • The list of variables will be analyzed.

  11. Standardization model In order to standardizethe student program in accordance to the model program, weproposetheusageofspecificmarkers for eachclassatthemodelprogram. A marker defines the keyword that the analyzer can find the source code. For example: @moveX = true Themarkers are definedbyteacherand it is mustbedeclaredatthebeginningofeachclass in themodelprogram. Just belowof a markerfollows a commentexplainingthe behavior associated. For example: @moveX= true @comment= “The class must has a method to move the object in the x-axis”

  12. Markers Inheritance: Identifies the super class. Constructor: The constructor of the class must be declared. MoveX: A method to move the object on the x axis must be declared. MoveY: A method to move the object on the y axis must be declared. Keyboard:Identifiesthe use ofthe keyboard in thisclass. Mouse: Identifies the use ofthe mouse in thisclass. General Comment:thefirstcommentidentifiesthe general behavior oftheclass. SpecificsComments:Theotherscomments are specificand are associatedwitheachmarker. Just belowof a markerfollows a commentexplainingthe behavior associated. Thecomments are used to informthestudentaboutthebehaviorsoftheclass.

  13. Example Ball Class - Standardization model

  14. Example Bar Class - Standardization model

  15. 0 1 15 Weight = 1 Variables Pairs Classification After defining all pairs of similar classes, variables of the same type in each of the classes pair should be compared; The variables are compare according to their behaviors. The algorithm compares the variables of the same type using a list of behaviors and then the pair containing the smallest weight is rated as the most similar pair of variables. For example:

  16. Comparison of Behavior Trees Afterthat, similar pairsofvariables are definedandthenanalyzed. In order to compare thesevariables, weproposea treestructure, calledbehavior tree. Thebehaviorstreesofboththevariables are comparedandwhenbehaviorsdifferencesoccur it is possiblethatthestudentprogramhasanerror. For example:

  17. Comment in the program model The comment is defined by teacher in the code of the model program. The comment is inserted immediately after the behavior. For example:

  18. Results In this paper we propose a novel heuristic that checks a JAVA code and guide a student for a specific game development. We developed a validation scenario in a classroom with 10 students of the integrated high school of the Informatics course. The students were proposed to develop a “BrickBreak” game, using JPlay framework. We analyzed the “Ball” and “Bar” classes of the 10 codes developed, based on the model program developed by the teacher.

  19. Results – BrickBreak Game The results analysis presented here are related with two levels of analysis: Checking for standardization between programs and Comparison of the behavior trees. The Ball class has two basic specifications: it must move in the x and y axis and collide with objects. The Bar class also has two specifications: -it should move through the keyboard control, for both right and the left sides; -collide with the Ball.

  20. Results In case of the standardization model the results were marked as: • positive when the analyzer does not detect differences between the student program and the standardization model; • negative when the analyzer detects differences between them.

  21. Results For the behavior trees, we evaluated the results as: • false-positive when the analyzer does not detected differences, but the behavior of the object is not correct. • false-negative when the analyzer detects differences but the behavior of the object is correct. • negative when the analyzer detects differences that really it exists. • positive when the analyzer does not detect differences and the behavior of object is correct.

  22. Students 1 and 4 used one method more than requested in the standardization of model. Suggestion for the student: “You probably defined more methods than the necessary.” In case the student 10 the different is associated to marker “movex”, this means that the class don’t implemented the movement in the x axis. Suggestion for the student: “Theclassmusthas a method to move theball in thex-axis”

  23. In case ofthestudent 10, theprogram istotallyincorrect: Theprogram is notaccording to thestandardizationand it is notpossible compare variables, formpairofvariablesand compare thebehaviorstrees!!! Thusallthecommentsrelating to behaviorsofthe “Ball” class are suggested to thestudent.

  24. Evaluation for the Ball class - Comparison of behavior trees Allthecommentsassociated to assignmentbehaviorsofthe “left” and “up” variables are suggested to thestudent!! In case the student 1:

  25. Thedifferences in these classes are associatedwithmarker “Keyboard”, thismeansthatthe analyzer don’t find the key words “Keyboard” and “keydown” in the code of the classes. The sugestion is: “Please, check if you defined the movement of the bar through the keyboard control.”

  26. In this case, thedifferences are false-negativesbecausethestudentsimplementedthe keyboard control in other classes. Thenthedifferencesdon´tchangethe general behaviorprogram. Thedifferences are negativesbecausethe bar is notreallymovingproperly in theprogram. Allthecommentsassociatedwiththismovement are suggested.

  27. Conclusion This paper presents a novel heuristic strategybased in a analyzer that, interpreting semantically a JPlay code, guide a student for a specific game development process. Our implementations and tests are related to JPlay framework, but the proposal can easily be adapted to other program patterns.

  28. Conclusion The results of the comparison of behavior trees show that the analyzer is not able to be totally accurate, but is able to make a suggestion closer to the truth to the student. The results of analysis according with the standardization between programs are most accurate, how much more standardized the student program, will be found less inaccuracy on comparison of the behavior trees. As future work we intend to improve the efficiency of the algorithm and obtain more results comparisons.

  29. Thank you! elannecristina.santos@ifpi.edu.br

More Related