World of Wokcraft The very best in Single pan cooking themed fantasy gaming!

Slides:



Advertisements
Similar presentations
Chapter 7: User-Defined Functions II
Advertisements

Chapter 7: User-Defined Functions II Instructor: Mohammad Mojaddam.
Programming with Alice Computing Institute for K-12 Teachers Summer 2011 Workshop.
CSE 1301 Lecture 6B More Repetition Figures from Lewis, “C# Software Solutions”, Addison Wesley Briana B. Morrison.
ITERATIVE CONSTRUCTS: DOLIST Dolist is an iterative construct (a loop statement) consisting of a variable declaration and a body The body states what happens.
Program design example Task: Develop an algorithm expressed in pseudocode for a specified problem specified problem.
Algorithms. Introduction Before writing a program: –Have a thorough understanding of the problem –Carefully plan an approach for solving it While writing.
A452 – Programming project – Mark Scheme
Chapter 3 Planning Your Solution
Fundamentals of Python: From First Programs Through Data Structures
Object Oriented Software Development
Fundamentals of Python: First Programs
Chapter 6: User-Defined Functions I Instructor: Mohammad Mojaddam
Simple Program Design Third Edition A Step-by-Step Approach
General Programming Introduction to Computing Science and Programming I.
ECS 10 10/8. Outline Announcements Homework 2 questions Boolean expressions If/else statements State variables and avoiding sys.exit(…) Example: Coin.
© The McGraw-Hill Companies, 2006 Chapter 4 Implementing methods.
08/10/ Iteration Loops For … To … Next. 208/10/2015 Learning Objectives Define a program loop. State when a loop will end. State when the For.
While Loops Indefinite Iteration. Last lesson we looked at definite loops using the ‘For’ statement. The while loop keeps going while some condition is.
Bug Session Four. Session description Objectives Session activities summary Resources Prior knowledge of sequencing instructions using Bug Bug website.
The Software Development Life Cycle. Software Development SDLC The Software Development Life-Cycle Sometimes called the program development lifecycle.
Chapter 3 Developing an algorithm. Objectives To introduce methods of analysing a problem and developing a solution To develop simple algorithms using.
C++ Programming: From Problem Analysis to Program Design, Fifth Edition, Fifth Edition Chapter 7: User-Defined Functions II.
Describe the Program Development Cycle. Program Development Cycle The program development cycle is a series of steps programmers use to build computer.
By the end of this session you should be able to...
Programming for Beginners Martin Nelson Elizabeth FitzGerald Lecture 5: Software Design & Testing; Revision Session.
© 2011 Pearson Addison-Wesley. All rights reserved. Addison Wesley is an imprint of Stewart Venit ~ Elizabeth Drake Developing a Program.
Developing an Algorithm
Python Programming Using Variables and input. Objectives We’re learning to build functions and to use inputs and outputs. Outcomes Build a function Use.
CPS120: Introduction to Computer Science Decision Making in Programs.
Coding Design Tools Rachel Gauci. What are Coding Design Tools? IPO charts (Input Process Output) Input- Make a list of what data is required (this generally.
30/10/ Iteration Loops Do While (condition is true) … Loop.
Making Decisions uCode: October Review What are the differences between: o BlueJ o Java Computer objects represent some thing or idea in the real.
Visual Basic Programming
Coding Design Tools Rachel Gauci. Task: Counting On Create a program that will print out a sequence of numbers from "1" to a "number entered”. Decision’s.
For loops in programming Assumes you have seen assignment statements and print statements.
Module 3: Steering&Arrays #1 2000/01Scientific Computing in OOCourse code 3C59 Module 3: Algorithm steering elements If, elseif, else Switch and enumerated.
1 CS161 Introduction to Computer Science Topic #9.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 2: Methods and Data Programming with Alice and Java First Edition.
More about Strings. String Formatting  So far we have used comma separators to print messages  This is fine until our messages become quite complex:
1 Printing in Python Every program needs to do some output This is usually to the screen (shell window) Later we’ll see graphics windows and external files.
M1G Introduction to Programming 2 3. Creating Classes: Room and Item.
More Sequences. Review: String Sequences  Strings are sequences of characters so we can: Use an index to refer to an individual character: Use slices.
More about Java Classes Writing your own Java Classes More about constructors and creating objects.
Introduction to Computer Programming - Project 2 Intro to Digital Technology.
Lecture 7: Menus and getting input. switch Multiple-selection Statement switch Useful when a variable or expression is tested for all the values it can.
GCSE Computing#BristolMet Session Objectives #23 MUST understand what is meant by the programming term iteration SHOULD describe methods of looping used.
Object Orientated Programming in Perl Simulated Models of Termites.
 Problem Analysis  Coding  Debugging  Testing.
26/06/ Iteration Loops For … To … Next. 226/06/2016 Learning Objectives Define a program loop. State when a loop will end. State when the For.
World of Wokcraft The very best in Single pan cooking themed fantasy gaming!
Introduction to Computing Science and Programming I
3.1 Fundamentals of algorithms
Chapter 7: User-Defined Functions II
Lecture 2 Introduction to Programming
Diamond Hunt Mock Programming Project.
Lecture 07 More Repetition Richard Gesick.
User-Defined Functions
Lecture 4B More Repetition Richard Gesick
Subroutines Idea: useful code can be saved and re-used, with different data values Example: Our function to find the largest element of an array might.
Conditions and Ifs BIS1523 – Lecture 8.
Structured Program
Lesson Objectives Aims You should be able to:
Do While (condition is true) … Loop
Text Analyzer BIS1523 – Lecture 14.
Flowcharts and Pseudo Code
WJEC GCSE Computer Science
Good programming practices
While Loops in Python.
Presentation transcript:

World of Wokcraft The very best in Single pan cooking themed fantasy gaming!

Characters Ninja Skills & Features

Characters Yakuza Skills & Features

Characters Butcher Skills & Features

Characters Cleaver Skills & Features

Characters Dragon Skills & Features

Stage 1 – some basics. Let’s look at some of the key ideas and structures needed.

Program structure. The program will consist of a main loop that controls everything that goes on. This is a very common structure so you should get to know how it works. The main loop makes some key decisions about what is supposed to be happening, and calls an appropriate function to carry out the work needed. This means that the main loop is not very complicated. Each specific task will be carried out by a function. Each of the characters in the game will be represented by a list. The list for each character will contain a name, character type and skill level.

Main Loop The main loop will be a loop that asks the user to input a choice. This will be one of; Name Skill Type Print Combat Stop Depending on the input, the loop will Then ask for either a name, skill level, or character number and then call the appropriate function with the appropriate data. The loop will be a continuous loop and will constantly ask the user for the next input until the word ‘stop’ is typed, at which point the loop will exit & the program will stop.

List structure (phase 1) The list for each character will contain; Position 0 Name Position 1Character Type Position 2Skill level

Game functions. This game initially will be able to do the following things; Set / change the name for each character Set / change the skill level for each character Set / change the character type for each character. Print the details of a specified character. (stage 2 of game will set characters as elements in a list, with corresponding entries in lists for types, skill levels etc …. Could also be a list within a list)

Game functions #2 Apart from the Combat function, each function will have to ask the user to specify which character it is supposed to be working on – e.g. If the Name option has been specified in the loop, then the NameCharacter function is called, which will then ask the user to specify whether it is Character 1 or Character 2 that they are naming. The appropriate character name will then be changed.

Stage 2 – Build the code to create the players.. First task is to create the players.

Step 1 – Basic structure. Create a new program. Call it WorldofWokcraft Create some comment lines to describe the first few sections of the code; Declare variables Create functions Main Loop Save the code as WorldofWokcraft_001

Name Character Define a function called NameCharacter, which has a single parameter as its input. This will be a string to contain the name of the character. For now all the code does is print the name given to it. Save the code as WorldofWokcraft_002

SetTypeCharacter Define a function called SettypeCharacter, which has a single parameter as its input. This will be a string to contain the type of the character. For now all the code does is print the name given to it. Save the code as WorldofWokcraft_002b

Set Skill Character Define a function called Setskillcharacter, which has a single parameter as its input. This will be an integer to contain the skill level of the character. For now all the code does is print the number given to it. Save the code as WorldofWokcraft_003

Print Character Define a function called PrintCharacter, which has no parameters as its input. For now all the code does is print “Print Character ”. Save the code as WorldofWokcraft_004

Combat Define a function called Combat. As yet this function has not been designed. For now all it does is print the word “Combat”. Save the code as WorldofWokcraft_005

Step 2 – Main Loop. Note – you will be creating variables as you go through this – make sure that when you need / use a variable, you add it to the variable declaration section at the beginning of the program. Give every variable a default value. Use comments to explain what is happening in the code – you can do this before you add code to give you an ‘english’ explanation of the logic. This kind of design is called ‘Pseudo Code’.

Main Loop #2 Create a loop that repeats until a value of ‘stop’ is typed. Ask the user for input each time round the loop. Depending on the value given, ask the user for the value of appropriate piece of data that is to be set; e.g. if Name has been given, then ask the user for the name to be used. call the appropriate function that you have already coded passing the value across. Test your program. Save the code as WorldofWokcraft_006

Step 3 – Functions – add logic.

NameCharacter. In the NameCharacter function; Ask the user for the character they want to set (1 or 2). Set Item 0 (Name) of the appropriate character list to the name specified as the parameter to the function. Print a summary of what has just happened Save the code as WorldofWokcraft_007

Set Skill Character. In the SetskillCharacter function; Ask the user for the character they want to set (1 or 2). Set Item 2 (Skill) of the appropriate character list to the number specified as the parameter to the function. Print a summary of what has just happened Save the code as WorldofWokcraft_008

Print Character. In the PrintCharacter function; Ask the user for the character they want to set (1 or 2). Use a loop to cycle through the list for that character printing out a summary of the character – make sure appropriate titles are printed along side the data. Save the code as WorlofWokcraft_010

Stage 3. Where are we now? You should now have ; All functions defined, that do nothing. A main code loop that accepts input & calls the appropriate function using the appropriate variable input from the user. Basically a shell that takes in ‘choices’ and calls empty functions. Lets add something useful ….

Step 4 - Characters There are two characters who will fight in this game. Create a LIST for each, containing each data item in it’s appropriate place. Call your lists Character1 & Character2. Character 1 position 0 Name Character 1 position 1Type Character 1 position 2Skill When setting it up initially, use a set of ‘first time’ initial values; Name = “” Type = “” Skill = 0

Using Characters In each of your functions, add some code that will actually SET the values of the appropriate list when changing details of the characters. E.g. Add code to your Changename function so that if the user requests Character1, the code changes item 0 of the Character1 list to the name given by the user.

Step 5 - Validation You now need to add code that prevents the user from inputting incorrect data. This as called VALIDATION. The validation rules are; Character nameAnything Character typeNinja,Yakuza,butcher,cleaver,dragon Skill 0-10 Main loop choiceName,Skill,Type,Print,Combat,Stop You will need to add some code that checks the data input by the user & gets them to re-try if it’s incorrect.

This is an undefined function that you will have to specify and write yourselves. Alternatively, you could use the following algorithm; Step 6 – Combat.

Combat Overview A loop is needed to simulate things happening. In each cycle of the loop, both characters make an attack. Each attack results in damage to the other character. The damage gets lower as the characters skill level gets higher. Random numbers will be used to determine the strength of the attack. The attack strength of the attacker will be used along with the skill level of the defender to determine the damage done. Damage done will be measured by a new attribute for each character – HEALTH Random numbers will be used to include some interventions – additional health boosts, and additional things that impact on health.

Suggested algorithms Create health boost on each combat cycle for each character – Random number between 1 & 3 Create an attack value on each combat cycle for each character – Random number between 1 & 20 Calculate the damage on each combat cycle for each character – Damage to character 1 = character 2 attack value divided by character 1 skill level Calculate the impact on health on each combat cycle for each character – Character 1 health = character 1 health – damage + health boost Print out a summary of what has happened Print out who is winning Print the overall winner when one contestant reaches 0 health.