MTAT Systems Modelling. Regular Exam 10 January 2017

Similar documents
YourTurnMyTurn.com: pente rules. Jacob Jan Paulus (Paulus) Copyright 2018 YourTurnMyTurn.com

YourTurnMyTurn.com: Go-moku rules. Sjoerd Hemminga (sjoerdje) Copyright 2019 YourTurnMyTurn.com

a b c d e f g h 1 a b c d e f g h C A B B A C C X X C C X X C C A B B A C Diagram 1-2 Square names

The 2013 British Informatics Olympiad

BRITISH GO ASSOCIATION. Tournament rules of play 31/03/2009

a) List HW and SW components of the device, and briefly discuss how those components are exploited in the embedded systems

CMPT 310 Assignment 1

The first player to construct his or her obelisk is the winner, and if a player has no legal moves, he or she immediately loses the game.

YourTurnMyTurn.com: chess rules. Jan Willem Schoonhoven Copyright 2018 YourTurnMyTurn.com

The 2017 British Informatics Olympiad

Game Playing in Prolog

Dice Activities for Algebraic Thinking

Introduction to Spring 2009 Artificial Intelligence Final Exam

Lecture 19 November 6, 2014

Tekken 7. General Rules

2018 NASSC RULES INTRODUCTION

select the 4 times tables and then all the number tiles used would be 4 x something

Training a Back-Propagation Network with Temporal Difference Learning and a database for the board game Pente

CSC 110 Lab 4 Algorithms using Functions. Names:

CS221 Project Final Report Gomoku Game Agent

UNIT 13A AI: Games & Search Strategies. Announcements

Basic Introduction to Breakthrough

Lesson 8 Tic-Tac-Toe (Noughts and Crosses)

Rivals Championship Series Rules

CMPT 310 Assignment 1

Lecture 6: Basics of Game Theory

Figure 1: A Checker-Stacks Position

The game of Paco Ŝako

Underleague Game Rules

Senior Math Circles February 10, 2010 Game Theory II

Maybe once you've beaten back the roundheels in the one-off brawls you can go on to fight in the bigger tournaments...

Assignment 6 Play A Game: Minesweeper or Battleship!!! Due: Sunday, December 3rd, :59pm

Grade 6 Math Circles Combinatorial Games - Solutions November 3/4, 2015

CODINCA. Print & Play. Contained in this document are the files needed to print out and make the following game components:

Ageneralized family of -in-a-row games, named Connect

Rules. Author: Dorsonczky József Mind Fitness Games, 2013

The 2015 British Informatics Olympiad

The Product Game: Playing the Product Game

Project Connect Four (Version 1.1)

3 0 S E C O N D Q U I C K S T A R T To start playing right away, read this page.

The Mathematics of Playing Tic Tac Toe

CS 32 Puzzles, Games & Algorithms Fall 2013

CPSC 217 Assignment 3 Due Date: Friday March 30, 2018 at 11:59pm

Royal Battles. A Tactical Game using playing cards and chess pieces. by Jeff Moore

STAT 430/510 Probability

Checkpoint Questions Due Monday, October 7 at 2:15 PM Remaining Questions Due Friday, October 11 at 2:15 PM

Software user guide. Contents. Introduction. The software. Counter 1. Play Train 4. Minimax 6

Introduction to Computing 2014 Assignment 4 (Preliminary Version) Simple Checkers Game

Chickenfoot Dominoes Game Rules

STAT 430/510 Probability Lecture 1: Counting-1

Battle. Table of Contents. James W. Gray Introduction

G51PGP: Software Paradigms. Object Oriented Coursework 4

DIVISION I (Grades K-1) Common Rules

Comp th February Due: 11:59pm, 25th February 2014

1.5 How Often Do Head and Tail Occur Equally Often?

BMT 2018 Combinatorics Test Solutions March 18, 2018

1 Modified Othello. Assignment 2. Total marks: 100. Out: February 10 Due: March 5 at 14:30

Your Guide to becoming a Master Spy

EXPLORING TIC-TAC-TOE VARIANTS

CS103 Handout 25 Spring 2017 May 5, 2017 Problem Set 5

: Principles of Automated Reasoning and Decision Making Midterm

WORMHOLES. a game of starship tactics for the piecepack. The Story. Summary. Setup

Taffy Tangle. cpsc 231 assignment #5. Due Dates

Joshua Nuernberger DESMA 157A Eddo Stern Fall Marathon Running Game The Road Based on the Novel by Cormac McCarthy

Computer Science and Software Engineering University of Wisconsin - Platteville. 4. Game Play. CS 3030 Lecture Notes Yan Shi UW-Platteville

2 Textual Input Language. 1.1 Notation. Project #2 2

Examples for Ikeda Territory I Scoring - Part 3

Exploring Concepts with Cubes. A resource book

MFM1P Exam Review Questions

UMBC 671 Midterm Exam 19 October 2009

Problem A. Jumbled Compass

Programming Assignment

COUNT ON US SECONDARY CHALLENGE STUDENT WORKBOOK GET ENGAGED IN MATHS!

Welcome to the Brain Games Chess Help File.

The tenure game. The tenure game. Winning strategies for the tenure game. Winning condition for the tenure game

GAMES COMPUTERS PLAY

Pencil and Paper Games

Here is a step-by-step guide to playing a basic SCRABBLE game including rules, recommendations and examples of frequently asked questions.

Movement of the pieces

Games of Skill Lesson 1 of 9, work in pairs

50 Graded Trax Problems with solutions. Collected and annotated by Martin Møller Skarbiniks Pedersen

The 2009 British Informatics Olympiad

NEVADA GOOD SAMS GAME RULES Revised September 2015

Name. Part 2. Part 2 Swimming 55 minutes

2013 CORE RULEBOOK WELCOME TO HEROCLIX!

Math 152: Applicable Mathematics and Computing

Tic-tac-toe. Lars-Henrik Eriksson. Functional Programming 1. Original presentation by Tjark Weber. Lars-Henrik Eriksson (UU) Tic-tac-toe 1 / 23

Unit 12: Artificial Intelligence CS 101, Fall 2018

Notes for Recitation 3

Solutions to Exercise problems

UNIT 13A AI: Games & Search Strategies

Economics 101 Spring 2015 Answers to Homework #1 Due Thursday, February 5, 2015

An Intelligent Agent for Connect-6

In the game of Chess a queen can move any number of spaces in any linear direction: horizontally, vertically, or along a diagonal.

COUNT ON US SECONDARY CHALLENGE STUDENT WORKBOOK

PLAY AND STRATEGY GUIDE

Command and State Patterns. Curt Clifton Rose-Hulman Institute of Technology

Figure 1: The Game of Fifteen

Over ===* Three games of strategy and chance Unique solitaire puzzles. For I to 4 players Ages 12 to adult. PassTM

8.3 Probability with Permutations and Combinations

Transcription:

Notes: MTAT.03.083 Systems Modelling Regular Exam 10 January 2017 - The exam is open-book and open-laptop. Web browsing is allowed. - You are not allowed to communicate with anyone during the exam in any way (except with the lecturer). - You may submit your exam on paper or electronically. In the latter case, include all files of your submission in a zip file and submit it using the Submit button in the course Web page. Allowed file formats are: PDF, PNG and mdzip (MagicDraw). - If you find that there is not enough information in the text below and you need to make additional assumptions, please write down your assumptions. Part 1. Pente Pente is a strategy board game created in 1977 by Gary Gabrel, based on the Japanese game ninuki-renju. The game is played on a board with 19 vertical and 19 horizontal lines. The description of the game below is taken from Wikipedia and www.pente.net. How to play: The game starts with the board completely clear of stones. The first player (black) begins the game by playing one stone on the center point. Thereafter the players take turns placing their stones, one at a time, on any empty intersection. The stones are placed on the intersections of the lines (including the very edge of the board), rather than in the squares. Once played, a stone cannot be moved again, except

when removed by a capture. Players alternate turns adding new stones to the board, building up their positions, until one player wins. Captures: Whenever your opponent has two stones (and only two) which are adjacent, those stones are vulnerable to capture. The pair can be captured by bracketing its two ends with your own stones. The captured stones are removed from the board. Captures can be made vertically, horizontally, or diagonally, and multiple captures can occur on a single move. Winning the game: The game ends immediately when one player places five stones in a row or captures five pairs of opponent s stones. The opposing player has no "last chance" to make a final move. When a player obtains an unblocked row of four stones, called a tessera, a win is imminent. Therefore, an unblocked row of three stones, called a tria, is a serious threat that should be blocked unless a stronger offensive move exists. An unblocked row of three stones, if it contains one gap, is still considered a tria. In the example below, black has formed a tria, while white has formed a tessera and will win with the next move. In a Pente game, the player who does the last move is always the winner (we assume that there are no draws)..

Task 1. [8 points] Design a domain model (UML class diagram) to store information regarding Pente tournaments. A tournament is identified by the date and the place where it is held. A tournament consists of a set of played games. Every game has two players one playing whites and the other blacks. A game should contain just enough information to replay the sequence of moves performed by the players during the game. Task 2. [8 points] Write a sequence diagram that describes how the classes in the domain model (and other classes if needed) interact in order to get the number of opponent s stones captured by the winner of a certain game. Hint: to count the number of stones it may be useful to replay the moves of the game and track how many stones are captured after each move. To do this, it is possible to add a class to keep the game state after every move as a distribution of stones. In the game state the total number of white stones captured and the total number of black stones captured can be stored. A method (that you can suppose to be a black-box) should update collection of stones after every move and return if the current move was a capture or not. Task 3. [5 points] Suppose to have drawn a sequence diagram to get the number of opponent s stones captured by the winner of a certain game (the one described in task 2). Write a sequence diagram to get the number of opponent s stones captured by a player in the entire tournament whenever he or she is the winner of a game of the tournament. Task 4. [4 points] Design an application model for the above scenario(s) (the application must contain only operations derived from the sequence diagram(s) and the additional application classes (outside the domain) that are needed to implement the application). Part 2. Coffee machine Task 5. [10 points] Specify the controller of a coffee machine as a statechart diagram.

The key components of the coffee machine are: 1. A single power on/off button, 2. A water reservoir with level sensor (with capacity of up to 2 litters), 3. A warming plate with a weight sensor and a presence sensor (to detect if the carafe is placed on it and the weight inside the carafe), 4. An ergonomic glass carafe with capacity of 1500 ml, and 5. A programmable auto-off timer (for the sake of brevity, we will assume that the function auto-off timer programming is specified elsewhere and not by you. Therefore, we will assume that the auto-off timer is set to 2 hours). The operation of the coffee machine is as follows. The coffee machine starts operating when the user presses the power button. If the water reservoir is not empty and the carafe is on the warming plate, the coffee machine starts making coffee (i.e. warming up the water in the reservoir). The coffee machine stops making coffee whenever one of the following happens: 1. The carafe contains approx. 1500 ml of coffee, as sensed by the weight sensor (we assume that the weight sensor reports the weight in millilitres based on an approximate conversion from grams to millilitres). 2. the water reservoir is empty (sensed by the level sensor), or 3. the carafe is removed from the warming plate (sensed by the presence sensor). The warming plate will operate as long as the carafe is on it. However, for safety reasons the warming plate must be turned off when: 1) the water reservoir is empty (sensed by the level sensor), 2) the carafe contains less than 100 ml (sensed by the weight sensor), or 3) the carafe is removed from the warming plate (sensed by the presence sensor). When the user returns the carafe to the warming plate, the coffee machine resumes its operation in the state it was before removing the carafe (e.g. either coffee making or

warming-only). Since the status of the components of the coffee machine might have been changed while the carafe was out of the warming plate (e.g. the carafe is empty when it is put back into the warming plate), it is important to periodically monitor the state of the components of the coffee machine (e.g. amount of water in the reservoir, amount of water in the carafe, etc.) The coffee machine is automatically turned off after 2 hours of operation or when the carafe has been removed from the warming plate for more than 5 minutes. Finally, the user can manually turn the coffee machine off by keeping pressed the power button for at least 2 seconds. (Hint: you can consider that the power button generates two events: buttonpressed and buttonreleased). Use the following statechart as the starting point for your solution: for Teaching Only elopment is strictly Prohibited Off on On [ReservoirIsEmpty] [not ReservoirIsEmpty] StandBy Operating Academic Version for Teaching Only Commercial Development is strictly after (2h) For this task, you should submit a statechart diagram (on PDF, PNG or MagicDraw format). Part 3. Petri nets We consider a segment of a factory with two conveyor belts, two machines, one robot and one buffer (see Figure 3). Raw parts arrive through a first conveyor belt, called the raw line. The robot moves each part from the raw line into machine M1, then into the buffer, then into machine M2 and finally to the second conveyor belt (called the finished line). If machine M2 is free, the robot is also allowed to move a part directly from M1 to M2. M1 can hold at most one part at a time, and the same applies for M2. The robot can only move one part a time. The buffer can hold at most 7 parts. The conveyor belts can hold any number of parts. The following figure shows the case where the raw line holds 2 parts, M1 and M2 hold one part each, the buffer holds two parts, and the finished line holds one part.

Finished parts Machine 2 buffer Robot Raw parts Machine 1 Figure 2: Factory Line Structure This system (in its initial state) is modelled as a Petri net in Figure 3. Figure 1. Petri net of the factory line Task 6. [2 points] In the Petri net in Figure 1, if machine M2 is empty, the robot can move a part from machine M1 to machine M2 directly, but it can also choose to move the part from machine M1 to the buffer (even if M2 is empty). Modify the above Petri net so that if the robot can move a part from M1 directly to M2, it will do so (it will not move that part to the buffer). Task 7. [5 points] Modify the Petri net in Figure 1 so that a new part can be added to the raw conveyor belt if and only if at least one of the following conditions is true: Machine M1 is empty Machine M2 is empty The buffer is not full

Note: Tasks 5 and 6 can be submitted as a single Petri net integrating both modifications. They can be submitted in PDF, PNG or PNML format. Task 8 [8 points] We consider the following Petri net. There is no reachable marking, in which both s3 and s7 contain a token. Explain in your own words how the place s4 and the transitions t2, t3, t5 and t6 make sure, that this cannot happen. Modify the Petri net in such a way, that a marking in which both s2 and s6 contain a token is also not reachable. Submit your answer to this question in PDF, PNG or PNML format. Acknowledgment: Exercise originally written by Prof. Barbara König, University of Duisburg-Essen