Lab Instructor: Salem Othman

Slides:



Advertisements
Similar presentations
Microsoft® Small Basic
Advertisements

CS0004: Introduction to Programming Repetition – Do Loops.
Representing a Game Board In a game, we represent the action taking place using an array – In a very simple game, we use individual variables to represent.
Outline IS400: Development of Business Applications on the Internet Fall 2004 Instructor: Dr. Boris Jukic JavaScript: Functions Part I.
1.2 – Open Sentences and Graphs
Excel Battleship.
Once the opposing player has scored a hit on all of the space for a particular ship, you must call out, “Hit…you sunk my ___________”. Once a player has.
Variables, operators, canvas, and multimedia Dr. José M. Reyes Álamo.
 Classes in c++ Presentation Topic  A collection of objects with same properties and functions is known as class. A class is used to define the characteristics.
1 Topics Recursion sections 8.1 – Recursion A recursively defined sequence –First, certain initial values are specified –Later terms of the sequence.
EGR 115 Introduction to Computing for Engineers Designing The Battleship Game in MATLAB Monday 22 Sept 2014 EGR 115 Introduction to Computing for Engineers.
Physics Vector Battleship Activity (Also known as the ClassCraft Activity: “Conquest of the Seven Seas”)
Warship C++: An entity of Battleship
Warm Up—Literary Terms Write the definition for at least TWO literary terms in your own words WITHOUT flashcards.
Battleship Microsoft Excel. Objective & Performance Outcome Students will follow a series of instructions presented by the teacher. You will need to take.
6.2 Classes “ A class is basically a structure with member functions as well as member data. Classes are central to the programming methodology known as.
Array Size Arrays use static allocation of space. That is, when the array is created, we must specify the size of the array, e.g., int[] grades = new int[100];
Ivan Li.  #Max = 9  Mean (attempted) =
Battleships. You need to know How to draw two 11 x 11 grids How to read off names of squares.
Definition Function: A function is a relation that assigns exactly one value of the range to each of the values in the domain. *Each x value must be associated.
Map Symbol Homework. Yr 7 Map Skills Battleships.
USING ALPHA-NUMERIC GRID SYSTEMS
Multiplication Find the missing value x __ = 32.
How to play battle ships…
TK1924 Program Design & Problem Solving Session 2011/2012
Battleship.
Lab Instructor: Salem Othman
Confirmation and Feed Logs July 2017 Tips and Tricks
Day 10- The Need for Addressing
Arrays and Array Visualization
The students learn to use game coordinates, like 3B.
Home Screen Aircraft Carrier A B C D E F G H
Agenda Warmup AP Exam Review: Litvin A2
FIGURE 4-10 Function Return Statements
with and without equipment
Programmer-Defined Functions, Call-by-Value, Multiple Files Lab 5
Using local variable without initialization is an error.
Writing Functions( ) (Part 5)
Lesson Plan Title: Sea Battle (Paper-pencil Game) Level: Middle
Polar Battleship (Game 1)
4-2 Functions in C In C, the idea of top–down design is done using functions. A C program is made of one or more functions, one and only one of which.
Introduction to Programming
Confirmation and Feed Logs July 2017 Tips and Tricks
More about the Learning Algorithm More about the Class being learned
Web Systems Development (CSC-215)
Coding Concepts (Sub- Programs)
Battleship
Structures putting data together.
Topics discussed in this section:
Let’s all Repeat Together
Topics Introduction to Value-returning Functions: Generating Random Numbers Writing Your Own Value-Returning Functions The math Module Storing Functions.
ICT Gaming Lesson 3.
The Need for Addressing
Arrays ICS2O.
Lesson 3 Chapter 10.
A Homemade PowerPoint Game by Sarah Grabowski University of Georgia
Lets Play with arrays Singh Tripty
Dr. Sampath Jayarathna Cal Poly Pomona
Functions continued.
Suggested self-checks: Section 7.11 #1-11
CIS 199 Final Review.
We are coming! Can your Star Cruisers stop us? Get ready for the
Lecture 03 & 04 Method and Arrays Jaeki Song.
Time.
Agenda Warmup Lesson 2.8 (Overloading constructors, etc)
EECE.2160 ECE Application Programming
Battleship.
Linear Graphs – Gradient-Intercept Method – Worksheet C
Battleship Directions
Simplify Your Sales Process
Presentation transcript:

Lab Instructor: Salem Othman Structures Lab 8 Lab Instructor: Salem Othman

Review Go to Dr. Mikhail Nesterenko website and read the topic: structures You need to understand: Structure Definitions Structure Variables Assigning Values to Structure Variables Passing Structures as Parameters, Returning Structures Complex Structures Structures and Arrays

Battleship Game Description 1 2 3 4 5 The field (ocean) is a square 5x5 grid. One of the coordinates of the grid is a number (from 1 to 5) And the other -- a letter (from 'a' to 'e').

Battleship Game Description: Deploy 1 2 3 4 5 Randomly place a fleet of five ships in the ocean 2,a 2,b 3,d 4,c 5,b Each ship takes up exactly one location in the ocean Multiple ships cannot be placed in the same location The ships, however, can be placed in adjacent locations.

Battleship Game Description: Fire 1 2 3 4 5 The user fires on the ships by specifying the coordinates of the shot 4,c 5,e The program reports whether each shot was a hit or a miss If the shot was a hit, the ship is sunk. The game continues until all ships are sunk. The program does not keep track of the locations of the previously fired shots.

Data structures: Location and Ship 1 x a y location mySpot; mySpot.x =1; mySpot.y=‘a’; ship loc sunk 1 x a y True

Data structures: Fleet myFleet myFleet [0] myFleet [1] myFleet [2] myFleet [3]

Functions Initialization functions that place the fleet of battleships in the ocean. Functions that display the location of the fleet. Battle functions that control the game play.