120 likes | 234 Views
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.
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