120 likes | 243 Vues
This innovative approach to learning C++ focuses on engaging students through practical programming projects, specifically by developing a game called "Critical Mass." With a critical mass infrastructure, students are motivated to program and can test their implementations online. The project integrates C++ for the game’s core logic and Java for the graphical interface. Students learn vital programming skills while enjoying the challenge of game development, which promotes excitement and competition in the classroom.
E N D
Learning C++ the Fun Way Taesoo Kim Dr. Ramon Lawrence Computer Science
About C++ • Widely known • Introduced 2nd year of college • Difficult task to learn • Taught by doing programming projects • Making a game in C++ is a fun assignment
Goals of the project • Construct infrastructure for teaching C++ • Critical Mass • Motivate students to program • Allow students to play over the internet • Test student’s game implementations
Components of Infrastructure • The applet is written in Java • CriticalMass.java • Displays the game • Applet runs in internet browsers • The core of the game is written in C++ • CM.h • AI of the game • What students write and upload • Linkage between Java file and C++ file • CriticalMass.cxx • MySQL database contains C++ code and user information
How the graphical aspect of the game works • Applet initializes 5 x 6 matrix • Matrix contains square information • Applet draws the board • Grid • Bombs
Sample design of the core • The Move Generator • Goes through every square and tries to insert a bomb • If it can’t moves to the next square • The Board Evaluator • Point system • 6 - corner, 5 - sides, 4 - interior • add the points. Better boards will have a higher sum • reason for specific point value • Who has the most bombs in the best position
Continued... • The Game Tree • built by recursion • makes every valid move and creates the board corresponding that move • makes an opponent move in response • makes another move in response • evaluates using the board evaluator and picks the best • assumes that each player will make the best move
Conclusion • Attract students to program often • Encourage competition among students • Motivate students to improve their work