Building a game of Tetris #1 the generation and the rotation of the Tetris parts

Similar documents
A casual approach to numerical modeling

<excelunusual.com> Easy Zoom -Chart axis Scaling Using VBA - by George Lungu. < 1. Introduction: Chart naming: by George Lungu

Technology Assignment: Scatter Plots

<excelunusual.com> Creating, Sizing, Translating and Rotating 2D Shapes in Excel by George Lungu. < 1

Projectile Motion Tutorial #2 - animating the

Microsoft Excel 2010 Training. Excel 2010 Basics

Microsoft Office Word 2013 Intermediate. Course 01 Working with Tables and Charts

Chemistry 30 Tips for Creating Graphs using Microsoft Excel

If you finish the work for the day go to QUIA and review any objective you feel you need help with.

Getting Started With Excel

Tutorial 9. Review. Data Tables and Scenario Management. Data Validation. Protecting Worksheet. Range Names. Macros

Unit 9: Excel Page( )

Introduction to Microsoft Excel

PARTS OF A WORKSHEET. Rows Run horizontally across a worksheet and are labeled with numbers.

A Basic Flight Simulator in Excel #3 calculating the

EXAM Microsoft Excel 2013 Expert Part 1. Buy Full Product.

B.V. Patel Institute of Business Management, Computer & Information Technology, Uka Tarsadia University : Advanced Applications of MS-Office

Task 2 Guidance (P2, P3, P4, M1, M2)

3. (1.0 point) To quickly switch to the Visual Basic Editor, press on your keyboard. a. Esc + F1 b. Ctrl + F7 c. Alt + F11 d.

EXAM Microsoft Excel 2010 Expert. Buy Full Product.

Section 33: Advanced Charts

Models for Nurses: Quadratic Model ( ) Linear Model Dx ( ) x Models for Doctors:

Better Histograms Using Excel. Michael R. Middleton School of Business and Management, University of San Francisco

Microsoft Excel 2010 Level 1

Abdulbasit H. Mhdi Assistant lecturer Chemical engineering/ Tikrit University

Finite Differencing Using Excel Learning how to use Surface Charts T 1 T 4 T 2 T 3

The For Next and For Each Loops Explained for VBA & Excel

Select the Points You ll Use. Tech Assignment: Find a Quadratic Function for College Costs

Microsoft Excel 2013: Excel Basics June 2014

Microsoft Excel 2007 Creating a XY Scatter Chart

Testpassport.

Gloucester County Library System EXCEL 2007

Scientific Graphing in Excel 2007

Pre-Lab Excel Problem

BASIC EXCEL SYLLABUS Section 1: Getting Started Section 2: Working with Worksheet Section 3: Administration Section 4: Data Handling & Manipulation

Manual Data Validation Excel 2010 List From Another Workbook

Understand and plan a chart Create a chart Move and resize charts and chart objects Apply chart layouts and styles

Introduction to CS graphs and plots in Excel Jacek Wiślicki, Laurent Babout,

Years after US Student to Teacher Ratio

Excel Basics Tips & Techniques

Microsoft Office Excel

Arkansas Curriculum Framework for Computer Applications II

Excel 2016 Intermediate for Windows

Free Microsoft Office 2010 training from MedCerts. Course Outline

Chapter 3: Rate Laws Excel Tutorial on Fitting logarithmic data

Basic Excel 2010 Workshop 101

Excel 2016 Advanced. Course Objectives

Introduction to Microsoft Excel

Three-Dimensional (Surface) Plots

Creating a Spreadsheet by Using Excel

Excel 2010: Basics Learning Guide

Technology for Merchandise Planning and Control

SAS (Statistical Analysis Software/System)

SAS (Statistical Analysis Software/System)

Instruction How To Use Excel 2007 Pivot Table Example Data Source

Download the files from you will use these files to finish the following exercises.

Excel Core Certification

Creating and Using an Excel Table

Excel 2010 Charts and Graphs

lab MS Excel 2010 active cell

A Basic Flight Simulator in Excel #4 creating the initial,

Scientific Graphing in Excel 2013

Chapter 4. Microsoft Excel

Themes & Templates Applying a theme Customizing a theme Creatingfilefromtemplate Creating yourowncustomize Template Using templates Editing templates

for secondary school teachers & administrators

0 Graphical Analysis Use of Excel

The Microsoft Excel Course is divided into 4 levels

Excel 2010 Macro Vba For Loop Through Rows In A Sheet

Optimization in One Variable Using Solver

York Public Schools Subject Area: Technology Grade: 9-12 Course: Information Technology 2 NUMBER OF DAYS ASSESSED TAUGHT DATE

Excel Vba Manually Update Links Automatically On Open File Ignore

Making EXCEL Work for YOU!

EXCEL 2007 GETTING STARTED

MODULE VI: MORE FUNCTIONS

Laboratory 1. Part 1: Introduction to Spreadsheets

Microsoft Excel 2016 Level 1

Spreadsheet Warm Up for SSAC Geology of National Parks Modules, 2: Elementary Spreadsheet Manipulations and Graphing Tasks

What s New in Oracle Crystal Ball? What s New in Version Browse to:

Spreadsheets. With Microsoft Excel as an example

Appendix C. Vernier Tutorial

Displaying Strike and Dip Measurements on Your Map in Surfer

Basic Excel 2018 Manual READ ONLINE

I OFFICE TAB... 1 RIBBONS & GROUPS... 2 OTHER SCREEN PARTS... 4 APPLICATION SPECIFICATIONS... 5 THE BASICS...

Writing numbers as text in excel. Writing numbers as text in excel.zip

Writing Excel Macros: Automating Excel To Work For You By PhD Steven Roman

Microsoft Excel 2007

addition + =5+C2 adds 5 to the value in cell C2 multiplication * =F6*0.12 multiplies the value in cell F6 by 0.12

Basic tasks in Excel 2013

MS Office Basic Courses - Customized Training

Introduction to Form Controls

Microsoft Office Excel 2007: Basic Course 01 - Getting Started

Excel Primer CH141 Fall, 2017

Microsoft Office Excel 2010: Basic. Course Overview. Course Length: 1 Day. Course Overview

Faculty of Engineering. Irrigation & Hydraulics Department Excel Tutorial (1)

Physics 211 E&M and Modern Physics Spring Lab #1 (to be done at home) Plotting with Excel. Good laboratory practices

Appendix III. Installing the Microsoft Excel Add-in For the Freeway Service Patrol Beat Evaluation Model

How to Make Graphs in EXCEL

Working with Charts Stratum.Viewer 6

ECE 102 Engineering Computation

Lecture 4: Transforms. Computer Graphics CMU /15-662, Fall 2016

Transcription:

Building a game of Tetris # the generation and the rotation of the Tetris parts by George Lungu - This tutorial explains the creation of a game of Tetris in Excel using spreadsheet formulas and minimum VBA. It focuses on the principle of game creation rather than on syntax. The procedure used to create this game is original, derived by trial and observation and I don t claim to have the best method. - You will later be able to use the same general principles to implement this or other games using the programming language of your choice. - This first section deals with the creation of the four different pieces or tetrominoes the way they are also called. The parts: - Most people are familiar with Tetris, which was created by a bored Soviet academician in the early 8 s, so no formal introduction is presented here. You can simply Google the word Tetris and a bounty of results will cover the principles and the history of the game. - There are a total of seven parts involved, and they are denoted with the letters: I, J, L, O, S, T and Z. A photograph of the parts is shown below. <www.excelunusual.com>

The parts (tetrominoes) worksheet implementation: - Open a new workbook, save it as Tetris_Tutorial and name the first worksheet Tutorial_. - In the first worksheet, in the range Z:AG9 we will plug in the data for all the seven shapes involved in the game (I, J, L, O, S, T, Z), corresponding to four angles of rotation (, 9, 8, 7). Each shapes has four components and each component has a pair of coordinates (x,y). - Based on the above statement the shape data area will cover 7 X 4 x 4 x = 4 cells. - The game has one active shape whose coordinates we choose to store in range W8:X. The shape is determined randomly by the model out of the seven fixed options ( I, J, L, O, S, T and Z. ). The shape starts from the top of a well then it trickles down with a fixed but adjustable speed, being able to be rotated and moved sideways by the player. - When the shape reaches the pile of old exhausted shapes on the bottom of the well, it will freeze there and a new random shape will automatically be issued by the model. - Let s introduce the shape parameters in the range X:X5. Name cell X Shape, cell X Rotation, cell X4 x_offset and cell X5 y_offset - Let s also insert the active shape defining formulas in the range W8:X: => W8: =OFFSET(Z,4*Shape,*Rotation)+x_offset => X8: =OFFSET(AA,4*Shape,*Rotation)+y_offset - After inserting the two formulas above copy range W8:X8 down to W:X. - The last thing we need to do is filling out the shape table (range Z:AG9) with constant data by trial and error see next page => <www.excelunusual.com>

Filling out the shape data range: - First let s create a D scatter chart based on the data from the Active Shape range (W8:X). - The chart will have both the x and the y axes scaled from - to +. - Since we will fill the data by trial and error we would like to have a button which changes the Shape type and the Rotation parameters with ease within the range,, and. - Since this is an advanced tutorial, the procedure for inserting the D scatter chart, the buttons and the associated macros will not be explained here. - Fill the data area for the first shape. You do this by trial and error trying as much as possible to keep the shape centered in the origin regardless of the rotation. - All the shapes must be aligned to a grid, in our case this means that the coordinate of all of the four components belonging to a tetromino must have integer coordinates. Whenever there is an even dimensionality (in this case there is a line 4-shapes long) there is no choice of centering the shape in the origin. To preserve consistency in this case, we could choose to have the shape slightly biased towards positive coordinates regardless of the rotation setting, but that s not a necessity. - By trial and error I came up with the values to the right corresponding to the first shape ( I or shape #) for all four rotation settings. -The shape in all the possible rotations settings is shown on the following slide =>>> <www.excelunusual.com>

Tetrominoes I and J : Shape Rotation Shape Rotation Shape Rotation Shape Rotation - - - - I - - - - - - - - - - - - - - - - - - - - - The complete charted data for tetrominoes I and J is shown on this page. - The color of the chart markers was adjusted in conformity to the color of each shape in the original game to make the chart look prettier. Shape Rotation Shape Rotation Shape Rotation Shape Rotation - - - - J - - - - - - - - - - - - - - - - - - - - <www.excelunusual.com> 4

Tetrominoes L, O, S and T : - The charted data for tetrominoes L, O, S and T is shown on this slide. - The color of the markers was adjusted in conformity to the color of each shape in the original game to make the chart look prettier. The size of the markers is 5. Shape Rotation - - - - - - Shape Rotation - - - - - Shape Rotation L - - - - - - Shape Rotation O - - - - - Shape Rotation - - - - - - Shape Rotation - - - - - Shape Rotation - - - - - - Shape Rotation - - - - - - A complete tetromino data table is shown in the next page. - Rotation - - - - - Rotation S - - - - - Rotation - - - - - Rotation - - - - - - - - - - - - Rotation Rotation Rotation Rotation - - - - T - - - - - - - - - - - - - - - - - - - - <www.excelunusual.com> 5

Tetromino Z and the full data table: Rotation Rotation Rotation Rotation - The charted data for tetromino Z is shown to the - - - - - - - - - - - - - - - - right. - - - - - The color of the markers - - - - was adjusted in conformity to the color of each shape in the original game to make the chart look prettier. - A complete tetromino data table is shown here. <www.excelunusual.com> to be continued 6