Battle For Throne by Pattarapong Rojanasthien Present to Dr. Kepuska Software/Hardware Integration ECE 2552.

Slides:



Advertisements
Similar presentations
While loops.
Advertisements

12 Pontoon1May Pontoon program CE : Fundamental Programming Techniques.
Mouse Movement Biometrics, Pace University, Fall'20071 Mouse Movement Biometrics Fall 2007 Capstone -Team Members Rafael Diaz Michael Lampe Nkem Ajufor.
Computer Science 1620 Programming & Problem Solving.
Loops For loop for n = [ ] code end While loop while a ~= 3 code end.
Chapter 7: Working with Arrays
1 Lab Session-7 CSIT-121 Fall Introducing Structured Choice 4 The do~While Loop 4 Lab Exercises.
Cambodia-India Entrepreneurship Development Centre - : :.... :-:-
Software Development, Programming, Testing & Implementation.
Fundamentals of Python: From First Programs Through Data Structures
Systems Life Cycle A summary of what needs to be done.
Chapter 8: String Manipulation
Programming with Microsoft Visual Basic th Edition
Platforms for Learning in Computer Science July 28, 2005.
Week 4-5 Java Programming. Loops What is a loop? Loop is code that repeats itself a certain number of times There are two types of loops: For loop Used.
Web forms in PHP Forms Recap  Way of allowing user interaction  Allows users to input data that can then be processed by a program / stored in a back-end.
Programming Logic Program Design. Objectives Steps in program development Algorithms and Pseudocode Data Activity: Alice program.
CPSC 171 Introduction to Computer Science 3 Levels of Understanding Algorithms More Algorithm Discovery and Design.
Loop Exercise 1 Suppose that you want to take out a loan for $10,000, with 18% APR, and you're willing to make payments of $1,200/month. How long will.
Lecture 9 Polymorphism Richard Gesick.
EGR 2261 Unit 5 Control Structures II: Repetition  Read Malik, Chapter 5.  Homework #5 and Lab #5 due next week.  Quiz next week.
Chapter 8: Writing Graphical User Interfaces
MOM! Phineas and Ferb are … Aims:
Visual Basic Games: Prepare for Hangman
In this chapter we introduce the idea of what it means for something to be truly random. We also investigate techniques for simulating randomness.
Computer Security and Penetration Testing
© The McGraw-Hill Companies, 2006 Chapter 4 Implementing methods.
For games. 1. Control  Controllers for robotic applications.  Robot’s sensory system provides inputs and output sends the responses to the robot’s motor.
Chapter 13: Regression Testing Omar Meqdadi SE 3860 Lecture 13 Department of Computer Science and Software Engineering University of Wisconsin-Platteville.
What does C store? >>A = [1 2 3] >>B = [1 1] >>[C,D]=meshgrid(A,B) c) a) d) b)
© Glenn Rowe AC Lab 3 An adventure game.
Practical Programming COMP153-08S Week 5 Lecture 1: Screen Design Subroutines and Functions.
SD1230 Unit 6 Desktop Applications. Course Objectives During this unit, we will cover the following course objectives: – Identify the characteristics.
Lecture 26: Reusable Methods: Enviable Sloth. Creating Function M-files User defined functions are stored as M- files To use them, they must be in the.
M1G Introduction to Programming 2 5. Completing the program.
Designing While Loops CSIS 1595: Fundamentals of Programming and Problem Solving 1.
More Python!. Lists, Variables with more than one value Variables can point to more than one value at a time. The simplest way to do this is with a List.
2016 N5 Prelim Revision. HTML Absolute/Relative addressing in HTML.
Presented by Yisheng Tang. Introduction  Wargus is a Warcraft2 Mod that allows you to play Warcraft2 under GNU/Linux and other operating systems not.
Computer Science I: Understand how to evaluate expressions with DIV and MOD Random Numbers Reading random code Writing random code Odds/evens/…
The Development Process Compilation. Compilation - Dr. Craig A. Struble 2 Programming Process Problem Solving Phase We will spend significant time on.
While loops. Iteration We’ve seen many places where repetition is necessary in a problem. We’ve been using the for loop for that purpose For loops are.
An Introduction to Programming with C++ Sixth Edition Chapter 5 The Selection Structure.
General Condition Loop A general condition loop just loops while some condition remains true. Note that the body of the loop should (eventually) change.
XuanTung Hoang 1 Something to discuss Feedbacks on Midterm Exam Final exam and term project  Final exam requires solid knowledge/skills in Java  Be more.
Functions. What is a Function?  We have already used a few functions. Can you give some examples?  Some functions take a comma-separated list of arguments.
Introduction to Programming
SE-1021 Software Engineering II
GAMEPLAY The strategies required to reach specific end points within computer gaming are collectively termed gameplay. However, gameplay is only one element.
Data Types Variables are used in programs to store items of data e.g a name, a high score, an exam mark. The data stored in a variable is entered from.
In-situ Visualization using VisIt
The Selection Structure
Chapter 13 & 14 Software Testing Strategies and Techniques
Selected Topics From Chapter 6 Iteration
Lecture 23 Polymorphism Richard Gesick.
MATLAB Programs Chapter 6 Attaway MATLAB 4E.
Python I/O.
Supply Unit 3, Part 2 Chapter 5.
CIS16 Application Development and Programming using Visual Basic.net
CIS 487 LeRoy Eberly & Zev Lopez
CIS 16 Application Development Programming with Visual Basic
Selection Statements.
Test Case Test case Describes an input Description and an expected output Description. Test case ID Section 1: Before execution Section 2: After execution.
Using Script Files and Managing Data
Basic Concepts of Algorithm
Chopin’s Nocturne.
Lecture 13 Teamwork Bryan Burlingame 1 May 2019.
MATLAB Programs Chapter 6 Attaway MATLAB 5E.
Dry Run Fix it Write a program
Chapter 13 & 14 Software Testing Strategies and Techniques 1 Software Engineering: A Practitioner’s Approach, 6th edition by Roger S. Pressman.
Presentation transcript:

Battle For Throne by Pattarapong Rojanasthien Present to Dr. Kepuska Software/Hardware Integration ECE 2552

Battle for Throne Text-based strategy game There are two faction: Player and Computer 100 years to obtain the throne (100 turns to defeat or be defeated)

Resource Gold –Upgrade Castle and Temple Population –Convert to troops or vice versa –Collect tax (based on amount of population) Farm –Upgradeable –Suppose to affect troop’s morale (ran out of time to implement)

Resource cont’d Divine favor –Effect the chances of disaster occur Troops –Use for war purpose –Die less than normal population if disaster occur

Computer AI Currently there is only one For each ten years, its troop size and castle level will increase Only attack player when the player has less than one-tenth of its troop size No suffering from disaster nor troop train

War formation Standard Wedge Circle Beat Standard beat Circle Circle beat Wedge Wedge beat Standard Winner gain 25% attack bonus Same formation: no bonus

War formation cont’d Example output

How game ends Game ends at 100 years War –Retreat –Defeat enemy –Defeated by enemy

What I applied from lecture Classes –5 Difference classes Inheritance –All inherited to class Command Composition –Class Enemy uses composition from class Stasts

Classes Stats Disaster War Enemy Command

Class Hierarchy Disaster Command Status Enemy War Inherited to

Class Disaster Top based class Calculate the possibility that disasters will occur Consists of –Earthquake: Reduce the level of castle and temple –Disease: Reduce amount of troops and population –Insect: Reduce the size of farm land

Class Disaster cont’d Example Earthquake –Function randomEarthquake Random the number that will be use for function fireEarthquake –Function fireEarthquake Receive number from randomEarthqauke, then decide whether the event will occur

Class Stats Store all the status of the game (eg. Gold, Population, Castle Size). Contains get and set functions for the status

Class Stats cont’d Member functions –Set and get function Receive and send data between functions from base and derived class

Class War Receive all values from class Command via set functions. Send back the results to class Command and end the game. Contain all war command

Class war cont’d Example –Set and get function –War commands

Class Enemy Derived from class Stats Store data for the enemy (computer) Provide progression for computer

Class Command The bottom of inheritance. Contain the command prompt for user to decide what to do. Send data to class War when player want to attack or get attacked by the computer

Class command cont’d –Member functions Check function –Check if event will occur Command function –Receive the command from player and invoke another function

Class command cont’d Example: –checkDisaster() Invoke all functions in class Disaster that determine whether the disaster will occur. –checkEarthquake Receive value from fireEarthquake in boolean. Damage castle and temple level

Class command cont’d –commandTroops() Subcommand Manage troop –Draft –Release –Train

Driver file Main.cpp Check the condition and events –Taxation from the population –Disaster –Enemy’s progress. Perform the loop to run function enterCommand();

Driver file cont’d

Problems Unable to get data from the derived class back to the base class –Rearrange the inheritances –Use set and get functions

Problems cont’d Return to main menu without start a new turn Infinite loop when player enters invalid command (e.g. Alphabet, numbers not command list) –Set the command choice into string. The program will return to loop if the input is not valid.

Problem cont’d Bug –Go thru the code and fix it Example: suppose the computer will check the player has less than one-tenth of its army to decide to attack. The war start while the variables haven’t sent to class War

Problem cont’d –Fix it by running to the close and found out that the bracket for if function is not included. Here are the culprits

Further Improvements Dynamic Computer AI –Develop itself rather than change for every 10 years –Make their own decision to wage war Tweak the factor in game –% of disaster event occur –% proportion of investment –War: deeper strategy Graphics!

Further Improvements cont’d Make the game able to Save/Load Increase the numbers of faction (more computers) Introduce alliance system. Implement effects from food and farm size (ran out of time)

That’s it! This develop the program under visual c++ 6 Thanks Dr. Kepuska for good lecture And Daewon for helping me out in the lab