Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 23

INTRODUCTION TO COMPUTERS AND

PROGRAMMING
(CSC116)

THOR ODINSON AND THE LOST TREASURE

PREPARED BY:
ALIF HEZREEL BIN JALDEEN
(2021624562)
M3CS1101D
CS110
DIPLOMA IN COMPUTER SCIENCE
FACULTY OF COMPUTER AND MATHEMATICAL SCIENCES

PREPARED FOR:
ALIAS BIN DERAMAN

DATE OF SUBMISSION:
4th February 2022

Page 1 of 23
TABLE OF CONTENTS

TOPIC PAGES

Cover Page 1

1.0 Objects And 3


Properties
2.0 Scenario Description 4

3.0 Storyboard 5-8

4.0 Pseudocode 9-12

5.0 Flowchart 13-14

6.0 Procedures 15

7.0 Main Program 16-18

8.0 Program Testing 19-22

Page 2 of 23
1.0 OBJECTS AND PROPERTIES

1. King Shark
- Role : Main Antagonist
- Opacity : 1.0
- Width : 2.13
- Height : 4.05
- Depth : 9.30

2. Thor Odinson
- Role : Main Protagonist
- Opacity : 1.0
- Width : 0.99
- Height : 1.88
- Depth : 0.48

Page 3 of 23
2.0 SCENARIO DESCRIPTION

Title: Thor Odinson And The Lost Treasure


Synopsis:
When Thor heard rumours of a long-forgotten treasure hidden in the depths of the ocean, he
ventures out underwater in search for it. To his surprise, as he reached the treasure’s last
resting place, he is met with King Shark who is guarding the treasure. King Shark agrees to
give the treasure to Thor but on one condition, “For every backflip you can do underwater, I
will give you 100,000 doubloons. However, if you fail to do even ONE backflip, I will hunt
you down myself.” said King Shark. Now Thor is faced with a life and death situation, should
he get the treasure and risk losing his life to King Shark?

Problem Statement:
Should Thor do a backflip and get the treasure but risk dying, or should he play it safe and
return to the surface without the treasure?

Characters:
 Thor - Thor is a man who comes from a faraway land called Asgard. He is a person
who values his life above all and will not take any unnecessary risks.

 King Shark – King Shark is the ferocious ruler of the seven seas. However, as time
passed, the aged King Shark now finds amusement in playing tricks and games with
travelers who come and go through his lair.

Scenarios:
1. Thor leaves with the treasure
- Thor descends from the surface and is met with King Shark. Thor agrees with
King Shark’s offer and does the backflips depending on the user input. The
number of doubloons received is then calculated based on the number of backflips
done. Thor then leaves King Shark’s lair with the treasure.

2. Thor leaves without the treasure


- Thor descends from the surface and is met with King Shark. Thor declines King
Shark’s offer and King Shark gets mad. King Shark chases down Thor but is
stopped by him when he proposed an offer. Thor offers his hammer, Mjolnir in
exchange for King Shark sparing his life. King Shark agrees and Thor leaves
without the treasure.

Page 4 of 23
3.0 STORYBOARD

SCENARIO 1: THOR LEAVES WITH THE TREASURE


SCENE 1
Thor descends from the surface and meets King Shark.

SCENE 2
Thor does the backflips depending on user input

Page 5 of 23
SCENE 3
Thor celebrates as he does the backflips successfully

SCENE 4
Thor goes back to the surface with the treasure

Page 6 of 23
SCENARIO 2: THOR LEAVES WITHOUT THE TREASURE
SCENE 1
Thor descends from the surface and meets King Shark

SCENE 2
Thor rejects King Shark’s offer as it puts his life at risk

Page 7 of 23
SCENE 3
King Shark gets mad and chases down Thor

SCENE 4
Thor offers his hammer, Mjolnir in exchange for his life. King Shark agrees and Thor returns
to the surface without the treasure.

Page 8 of 23
4.0 PSEUDOCODE

Do in order
Crown set vehicle to King Shark
Mjolnir set vehicle to Thor
Thor moves down by 7.0 in 3.0 seconds
Thor turn to face King Shark
King Shark turn to face Thor
King Shark say, “Tell me mortal... On what purpose are you invading my territory?”
Thor say, “Greetings, it is I, Thor Odinson and I’m in search of a long-lost treasure.”
Thor say, “Legend says it can be found right here at this very place...”
King Shark say, “Well your legend speaks true mortal. For your treasure is right here
beside me!”
Thor turn to face Treasure Chest
Thor say, “By the heavens! So the legends are true!!”
Do together
Thor turn to face King Shark
Thor say, “So... is it possible for me to take this treasure?”
End of Do together
King Shark say, “Sure...But on one condition...MUAHAHAHAHA”
Thor say, “Wh-what is it?”
King Shark say, “I'll give you 100,000 doubloons for every backflip you can do
underwater.”
King Shark say, “But if you fail to do even ONE backflip, I will hunt you down
myself…”
Thor turn to face Camera
Thor think, “Should I do the backflips? I can get very rich if I do them but if I fail, I
might get killed!”
User inputs an integer into a variable named <<backflipAnswer>>
If <<backflipAnswer>> == 1
User inputs an integer into a variable named <<backflipAmount>>

Page 9 of 23
Count up to <<backflipAmount>>
Thor move up by 1.5 in 0.5 seconds
Thor move backward by 1.0 in 1.0 seconds
Thor move down by 1.5 in 0.5 seconds
End of Count up to
Do together
Thor celebrate
Thor say, “I DID IT! YAHOOO!!”
End of Do together
Do together
King Shark say, “Okay, as promised... your treasure”
Thor turn to face King Shark
End of Do together
Set int doubloonsAmount = 100000 * <<backflipAmount>>
King Shark say, “In total you’ve earned” <<doubloonsAmount>>
“doubloons”
King Shark say, “I've prepared them in this chest. Take it with you back to the
surface.”
Thor say, “You have my gratitude King Shark. I shall be taking my leave
now,”
Thor move toward Treasure Chest by 8.0 in 3.0 seconds
Treasure Chest set vehicle to Thor
Thor move up by 10.0 in 2.0 seconds
King Shark turn to face Camera
King Shark say, “I can't believe i just gave away free treasure...”
Do together
Camera move backward by 10.0 in 5.0 seconds
Text Model set opacity to 1.0
End of Do together
End If

Page 10 of 23
If <<backflipAnswer>> == 2
Thor turn to face King Shark
Thor say, “I shall return to the surface now. Apologies for wasting your time.”
King Shark say, “YOU DARE REJECT MY OFFER MORTAL!!?”
Thor say, “N-no I didn't mean it that way I ju-”
King Shark say, “THEN YOU SHALL PERISH!!”
Thor think, “I should probably run before it's too late.”
kingSharkChasesThor
Thor say, “Spare me and I will give you the greatest weapon of all mankind...”
Thor say, “My Hammer, Mjolnir!”
King Shark say, “…”
King Shark say, “Give it to me…”
Do together
Thor getLeftShoulder turn right by 0.25
Thor getLeftHand turn backward by 0.125
End of Do together
Do together
Mjolnir move toward King Shark by 3.0
Mjolnir move up by 0.5
Mjolnir move backward by 0.2
Mjolnir set vehicle to King Shark
End of Do together
Camera turn left by 0.125 as seen by Thor
Thor say, “I shall be taking my leave now. Thank you King Shark.”
Thor turn to face Camera
Thor move up by 10.0
King Shark turn right by 0.06
King Shark say, “I wasn't actually going to kill him you know...”

Do together

Page 11 of 23
Camera move backward by 10.0 in 5.0 seconds
Text Model 2 set opacity to 1.0
End of Do together
End If
End of Do in order

Page 12 of 23
5.0 FLOWCHART

Page 13 of 23
Page 14 of 23
6.0 PROCEDURES

PRIMITIVE PROCEDURES
1. setVehicle
2. move
3. turnToFace
4. say
5. think
6. turn
7. moveToward
8. setOpacity
9. getLeftShoulder
10. getLeftHand

USER DEFINED PROCEDURES


1. celebrate

2. kingSharkChasesThor

Page 15 of 23
7.0 MAIN PROGRAM

Page 16 of 23
Page 17 of 23
Page 18 of 23
8.0 PROGRAM TESTING

1. Thor descends from the surface

2. Thor and King Shark have a conversation

Page 19 of 23
Page 20 of 23
3. Thor does the backflips

4. Thor leaves with the treasure

Page 21 of 23
5. King Shark chases Thor

6. Thor gives his hammer, Mjolnir to King Shark

Page 22 of 23
7. Thor leaves without the treasure

8. Ending scene

Page 23 of 23

You might also like