Introduction to Computing and Games Designing


by Sarfraz Raza

Pre-requisite of :

PF/OOP: https://sites.google.com/view/pf-ucp-2018/

DSA: https://sites.google.com/view/dsa-ucp2017/home

DM: https://sites.google.com/view/ds-ucp-2017/home

Algo: https://sites.google.com/view/algo-ucp-2017/home

Lecture 1: The quest of finding "The quest of THE ALGORITHM"

          • What is Computer?

          • What is Computation?

          • What is Algorithm?

          • Guessing Game

            • Introduction to Logarithm

          • Finding Heaviest ball problem

          • Sarim-Jamila Proposal story (the introduction to Cryptography)

          • Parallelism (Counting problem)

            • Introduction to Exponential functions.

(Video Lecture: Youtube-Playlist): Lecture 1-Playlist

Reading Material: Chapter 1 - Computational Thinking

Assignment # 1 (Logical and Computational Thinking)

Lecture 2: Analytical Problem Solving and Some more computational problem

          • Measuring Water Using Cans.

          • Counting Handshakes in class.

            • Gauss's proof of Arithmetic Series

          • Log_3 N: Generalization of searching the Heaviest Ball.

          • Calendar formation of a month using Two cubes

          • Logical reasoning (Given 5 white beans And 10 Black Beans And a drawing criteria which will be the last ball in the pot.

          • Prune and search technique

            • Geometric Series.

            • Finding the trustworthy person out of trustworthies and untrustworthies

(Video Lecture: Youtube-Playlist): Lecture 2-Playlist

Assignment # 1 (Logical and Computational Thinking)

Lecture 3-4: Scratch (Games)

          • Making of a Rectangular Spiral.

          • Making Circular Spiral.

          • Idea of making Calculator

          • Playing with Angles and creating flowers and spirals

          • Projects

          • Scratch tutorials

(Video Lecture: Youtube-Playlist):

Chapter 2

Assignment # 2 - Scratch CHALLENGES

Lecture 5: Introduction to C++ (Table Printing)

          • Why we need C++

          • "Hello World" program...!

          • Using cout

            • String Messages printing/Maths expression printing

          • Printing a Table with all fixed values

          • Introduction to variable

          • Why generic coding is important

          • Introduction to Iteration

            • While loop and generalized Table Printing

          • Lecture 5 Part B

              • Factorial

              • Arithmetic

              • Bank Transaction

              • Grader

              • Finding Game Winner

(Video Lecture: Youtube-Playlist)

Assignment # 3 (Table Printing and Shapes)

Chapter 3 - Notes

Lecture 6A: Control Structure

          • Data Type Integers and operators (+, -, / , * , %)

            • Digits summation problem

          • If Statement

            • Block statements

          • If else Statement

          • if else if .... else

            • Checking divisibility (Using Modulus % operator)

          • Compound Statement ( AND: && and OR: ||)

            • Finding Maximum out of the three numbers

              • Why (N1<N2<N3) is a wrong statement

            • The Problem of repeating the same structure again and again (The Need of function)

          • Character Data-Type

            • ASCII values

            • Capital or Small letter

(Video Lecture: Youtube-Playlist): Lecture 6A-Playlist

Assignment # 4 - Conditional Statements

Lecture 6B: Control Structure

(Rock/Paper/Scissor Game, Calculator )

          • Rock/Paper and Scissor Game

            1. Reading the Error-Log

            2. Using getch function and printing '****' in password style for the two players

          • Calculator

            • Using integers and character together

          • How input stream (cin works)

            • Finding the section with highest aggregate

            • Finding the students who has the highest aggregate marks in total

            • Digit by Digit printing

          • Switch Statement

            • Given 4 points are these the points of a (Rectangle, Square, Parallelogram, Rhombus or Just a Quadrilateral)

(Video Lecture: Youtube-Playlist): Lecture 6B-Playlist

Assignment # 4 - Conditional Statements

Lecture 7: Control Structure (The point inside or outside rectangle)

          • Finding the Section of the course which wins as total aggregate

          • Finding the Students who got the highest %age in the semester result.

          • Digits by Digits printing

          • Switch Statement

          • Given 4 points are these the points of a Rectangle and a point P find if P lies inside the rectangle.

          • Ceiling/Flooring a floating a value.

          • The Idea of Functions

(Video Lecture: Youtube-Playlist): Lecture 07-Playlist

Assignment # 4 - Conditional Statements

Lecture 8: Introduction to Functions again

          • What is function?

            • Many examples of proto-type of functions

              • Factorial

              • Distance

              • Integers Distance Square

              • Power

              • Sqrt

              • MinOfTheThreeNumbers/MaxOfTheThreeNumbers/MiddleOfTheThreeNumbers

              • Multiple of Each Other

              • IsCapital/IsSmall

              • CapitalSmallOrNon

          • ROCK-Paper-Scissor using functions

            • Functional Representation of the constructs.

          • Digit to Words conversion.

          • STOP watch and Age Calculator (repeat).

(Video Lecture: Youtube-Playlist): Lecture 8-Playlist

Assignment # 5 - IFs Assignment Revisited

Lecture 9: Functions and Making Menu based programs, Stop Watch, and Age Calculator

          • Converting all the problems of IF's assignment into Menu-based programs.

          • STOP-watch

            • A small animations based on a small delay and printing a Timer in Milli-Second, Seconds, Mins and hours in the following format

HH:MM:SS:MMM

          • Age Calculator

            • Given two dates validate them as Date of Birth and Data of Death or Current Data and calculate the age in years, months and days.

(Video Lecture: Youtube-Playlist): Lecture 9-Playlist

Reading - Chapter 4

Lecture 10A: Age Calculator and Functions with Loops

          • Age Calculator

            • Given two dates validate them as Date of Birth and Data of Death or Current Data and calculate the age in years, months and days. In case of Invalid entry ask again/Just like menu based.

          • Factorial and relatives

            • Factorial

            • NPR

            • NCR

          • Range-Summation based on division

(Video Lecture: Youtube-Playlist): Lecture 10A-Playlist

Lecture 10B: MID-Review (of Chapter 1-2-3 of Schaum Series Book 1)

          • Chapter 1: Elementary C++ Programming

          • Chapter 2: Fundamental Types

                • NUMERIC DATA TYPES, THE BOOLEAN TYPE, CHARACTER TYPES, INTEGER TYPES

                • ARITHMETIC OPERATORS, THE INCREMENT AND DECREMENT OPERATORS

          • Chapter 3: Selection

                • THE if STATEMENT, THE if..else STATEMENT, COMPARISON OPERATORS

                • STATEMENT BLOCKS

                • COMPOUND CONDITIONS

                • SHORT-CIRCUITING

                • BOOLEAN EXPRESSIONS

                • NESTED SELECTION STATEMENTS

                • THE else if CONSTRUCT

                • THE switch STATEMENT

                • THE CONDITIONAL EXPRESSION OPERATOR

(Video Lecture: Youtube-Playlist): Lecture 10B-Playlist

Lecture 11: Functions and Loops I

          • Loops(while loop) and Functions

            • Even and Odds frequency.

            • Finding Max of the streaming numbers (until user enters -1).

            • Finding Min and Max together.

          • Loops(for loop and do while and while) and functions

          • Nested looping and functions

            • Finding GCD of two numbers

            • Finding LCM

            • Finding Reduced Fraction

            • Finding GCD of N numbers

(Video Lecture: Youtube-Playlist): Lecture 11-Playlist

Lecture 12: Functions and Loops II

            • IsPerfectSquare

              • IntegerSquare

            • IsPrimeNumber

              • Various Implementation

            • PrimeFactorization using while loop

            • PrimeFactorization Using For loop

            • Reverse of a number

            • Decimal to Binary conversion

(Video Lecture: Youtube-Playlist): Lecture 12-Playlist

Lecture 13: Functions and Loops III (Shapes printing)

            • Printing different Types of Shapes (Triangles, Diamonds, Pajamas and many more)

              • Divide and Conquer and re-usability

              • Shapes Printing + PrintACharacterKTimes

              • Implementation of PrintACharacterKTimes

              • Right angled right Diagonal Triangle

              • Right angled left Diagonal Triangle

              • Isosceles triangle

              • Printing Pajamas

            • How Divide and conquer and reusability makes life very easy

            • Shapes Nested loop implementation and its comparison with functional implementation

(Video Lecture: Youtube-Playlist): Lecture 13- Playlist

Lecture 14: ANIMATION BEGIN (Rectangular Spirals)

            • Divide and Conquer and Rectangular Spiral Printing

              • Left to right (symbol writer)

              • Top to Bottom (symbol writer)

              • Left to Right (Symbol writer)

              • Bottom to top (Symbol writer)

            • Using the above 4 functions to design rectangular spirals

            • Erasing Rectangular Spiral

            • Uusing kbhit() function

              • MAKING ANIMATION as screen saver

(Video Lecture: Youtube-Playlist): Lecture 14-Playlist

Code for Using Mouse and GotoRowCol Function

Lecture 15: ANIMATION BEGIN (Circles, Smiley Face, Fan, StoneThrowing)

              • Circle Drawing using Polar Equation

              • Circles Drawing-Expanding and multiples

              • Multiple Circles Drawing with Different centers

              • SmileyFace and Fan printing

              • Fan Printing + Stone Throwing

              • Circular Spiral

(Video Lecture: Youtube-Playlist): Lecture 15-Playlist

Lecture 16: ANIMATION BEGIN (Fan Printing, Playing with delay, Multiple Stone Throwing)

              • Fan printing

                • Playing with delay

                • Speeding Up Fan and the slowing down.

              • Stone Throwing

(Video Lecture: Youtube-Playlist): Lecture 16-Playlist

Lecture 17: Reference and Arrays

              • References

                • Its applications Variable Aliasing and multiple values returning through them

              • Introduction to Arrays (The need of arrays through Sorting) and initializing the arrays

              • Pictorial representation of arrays and how indexing works and The early computer virus

              • Initializing Random values and Bubble Sort

              • Debugging and step by step execution of Sorting

(Video Lecture: Youtube-Playlist): Lecture 17-Playlist

Lecture 18: Tutorial (of Arrays Assignment)

              • Init (Initializing Prime numbers to array)

              • Finding Min Value Index from an array

              • Range Minimum and Selection Sorting

              • Get Extreme Values

(Video Lecture: Youtube-Playlist): Lecture 18-Playlist

Lecture 19A: Generalized Tic Tac Toe

              • TicTacToe- Main Flow I

                • Memory usage of the game

                • Step by Step division of the game's flow

              • Divide and Conquer

                • Internal Implementation Details of UNIT-STEPs

                • Annotating the validity of the move of the player

                • Discussion on the implementation of How the Game will be over Draw and Win Cases?

(Video Lecture: Youtube-Playlist): Lecture 19A-Playlist

Lecture 19B: Generalized TicTacToe II (Revision)

            • Main Flow

              • Init step and Printing

            • "ifstream" based Filing

              • Save/Load STEP in the game

            • Draw

            • WINNING CONDITIONS

              • DiagonalWin

              • Vertical and Horizontal Winning conditions

(Video Lecture: Youtube-Playlist): Lecture 19B-Playlist

Lecture 20: Review (Arrays revision of Deitel's Book)

              • Chapter 6 of Deitel's Book

                • Introduction to Arrays and its pictorial implementation

                • Arrays

                • Declaring Arrays

                • Examples Using Arrays

                • Passing Arrays to Functions

                • Sorting Arrays

                • Case Study: Computing Mean, Median and Mode Using Arrays

                • Searching Arrays: Linear Search and Binary Search

(Video Lecture: Youtube-Playlist): Lecture 20-Playlist

Lecture 21: Prison Break (Filing, 2 dimensional arrays manipulation)

                • Reading the Map from file

                • Finding the Left corner of the prisoner Room I

                • PrisonBreak I(Checking Freedom)

(Video Lecture: Youtube-Playlist): Lecture 21-Playlist

Lecture 22: Making NOKIA Snake Game and Old Tetris game of blocks

                • Snake Game Main Flow

                  • Its Memory requirement

                  • Its step by step division

                • Implementation level details

                  • Initialization

                  • Moving Snake

                  • Adding directions

                  • Adding food

                  • Capturing Food

                  • Generating Food

                  • Adding GameOver situation

                • Designing GAME OF Tetris

(Video Lecture: Youtube-Playlist): Lecture 22-Playlist

Lecture 23: Designing Snakes and Ladders I

                • GRID PRINTING

                  • Box Printing

                  • Printing Box Number

                  • Printing in Box

                  • Box Printing and Calculation of boundaries of the Box "Rows and Columns"

                  • MAIN FLOW

                  • Discussion on Main flow and its details.

(Video Lecture: Youtube-Playlist): Lecture 23-Playlist

Lecture 24: Designing Snakes and Ladders II

                • File Reading (and reading the Snakes and Ladders from the file)

                • Printing Snakes and Ladders on the GRID

                • Dice Rolling I

                • Changing the position

                • Printing the players

                • Snakes bites

                • Ladders climb

                • Game Finishing

(Video Lecture: Youtube-Playlist): Lecture 24-Playlist

Lecture 25: Designing Chess (Phase 0)

                • Discussing MAINFLOW

                  • Memory Requirement

                  • Discovering the ways HOW TO STORE THE PIECES IN THE BACKGROUND (as alphabets and showing the pieces in a different fashion)

                  • Initializing the Board

                  • Displaying the Board in the form of a grid (8x8 grid)

                  • Taking input coordinates by the player

                  • BASIC Validating (whether the selected piece is the piece of the player) and where the player placed is a legal destination (regardless of checking the move of the piece) i.e. either it is a space character or opponent piece.

                  • Updating memory

                  • Turn changing

(Video Lecture: Youtube-Playlist): CHESS-Project-Phase 0

Lecture 26: Designing Chess (Phase 1)

          • Updating MAINFLOW with MOVEMENT LEGALITY

          • Designing Six Utility functions

            • IsHorizontalMove

            • IsVerticalMove

            • IsDiagonalMove

            • IsHorizontalPathClear

            • IsVerticalPathClear

            • IsDiagonalPathClear

          • Designing the pieces' legal Moves under the abstraction of the Six utility functions

              • IsRookLegalMove

              • IsBishopLegalMove

              • IsQueenLegalMove

              • IsKingLegalMove

              • IsHorseMove

              • IsPawnLegalMove (including its special Move)

                • Incorporating these legal steps into one LEGALITYCHECK function which should supervise the possible move to be considered or not

(Video Lecture: Youtube-Playlist): CHESS-Project-Phase 1

Lecture 27: Designing Chess (Phase 2)

                • Pawn promotion

                • Saving each and every move

                • Save and Exit

                • Undoing a move

                • Replay of the game

                • Replay and start from where I press enter

                • Restart of the Game without saving

                • Check

                  • Castling

                  • Checkmate

                  • Stalemate

                  • Illegal Moves: Like any move which results in a check or a move within check which isn’t able to remove check is an illegal move

(Video Lecture: Youtube-Playlist): CHESS-Project-Phase 2