You are on page 1of 61

the_code.ipynb game_explanation.

ipynb

1
2
3
4
5
Spy ‘Game’ {
6
7
8
[IT in Finance]
9
10
By Muzammil Babar
11
12
13
14 }
# Presented to Professor Bruschi & Professor Rana
the_code.ipynb game_explanation.ipynb

1 Rules Of The Game; {


2
3
4 Players Rounds
5 < 7 players > < 5 rounds in total >
6 < 2 spies > < 5 Players submit one card per
< 5 civilians > round >
7
8
9
10 Voting Objective
11
12 < After each round, players vote < Spies win if they secure 3
out a suspected individual > out of 5 rounds >
13
14 }
the_code.ipynb game_explanation.ipynb

1
2
3
Variable Initialization; {
4
5
6 num_of_players = 7
7 num_spies = 2
8 num_civilians = num_of_players - num_spies
rounds = 5
9
num_of_outputs = 1000
10
11
12
13
14
}
the_code.ipynb game_explanation.ipynb

1
2
3
The First Attempt; {
4
5 def random_strategy(num_of_players, num_spies, rounds):
6
players = ["Player " + str(i + 1) for i in range(num_of_players)]
7 spies = random.sample(players, num_spies)
8
9 spies_wins = 0 civilians_wins = 0
10 voted_out = []
11
12
13
14
}
the_code.ipynb game_explanation.ipynb

1
2 Loop for Rounds; {
3
4
5 for round in range(1, rounds + 1):
if round <= 2:
6
num_players = 3
7 else:
8 if round <= 4:
9 num_players = 4
else:
10
num_players = 5
11
12
13
14
}
the_code.ipynb game_explanation.ipynb

1
2
3
Player Selection + Card Submission; {
4
5 playing_players = random.sample(players, num_players)
6
submitted_cards = [
7 "Picture" if ((player in spies) and (random.random() <
8 0.5)) else "Number"
9 for player in playing_players
]
10
11
12
13
14
}
the_code.ipynb game_explanation.ipynb

1
2
3
Outcome Determination; {
4
5 if "Picture" in submitted_cards:
spies_wins += 1
6
suspect = random.choice(playing_players)
7 players.remove(suspect)
8 voted_out.append(suspect)
9 else:
civilians_wins += 1
10
11
12
13
14
}
the_code.ipynb game_explanation.ipynb

1
2
3
Results {
4
5
6
Percentage of Spy wins: 39.40%
7
8 Percentage of Civilian wins: 60.60%
9
10
11
12
13
14
}
the_code.ipynb game_explanation.ipynb

1
2
3
Recording Information in history; {
4
5 history = []
6
history.append(
7 {
8 'round': round,
9 'players': playing_players,
'cards': submitted_cards
10
}
11 )
12
13
14
}
the_code.ipynb game_explanation.ipynb

1
2
3
Identifying And Eliminating Suspects; {
4
5 intersection_of_spywin_rounds = list(set(player for
history_round in history if "Picture" in history_round['cards'] for
6
player in history_round['players']).intersection(playing_players))
7
8 if intersection_of_spywin_rounds:
9 suspect = random.choice(intersection_of_spywin_rounds)
players.remove(suspect)
10
voted_out.append(suspect)
11
12
13
14
}
the_code.ipynb game_explanation.ipynb

1
2
3
Results {
4
5
6
Percentage of Spy wins: 38.85%
7
8 Percentage of Civilian wins: 61.15%
9
10
11
12
13
14
}
the_code.ipynb game_explanation.ipynb

1
2
Voting Mechanism; {
3 votes = []
for player in players:
4
vote_choices = list(round_playing_players)
5
6 # spies will not vote themselves as suspects
7 if player in vote_choices:
8 vote_choices.remove(player)
9 # spies will not vote out the other spies
10 if player in spies:
11 vote_choices = [x for x in vote_choices if x not in spies]
12
votes.append(random.choice(vote_choices))
13
14 }
the_code.ipynb game_explanation.ipynb

1
2 Counting Votes; {
3 count_dict = {}
4
5 for vote in votes:
6 if vote in count_dict:
count_dict[vote] += 1
7 else:
8 count_dict[vote] = 1
9
10 max_count_vote = max(count_dict, key=count_dict.get)
11 return max_count_vote
12
13
14 }
the_code.ipynb game_explanation.ipynb

1
2
3
Results {
4
5
6
Percentage of Spy wins: 46.32%
7
8 Percentage of Civilian wins: 53.68%
9
10
11
12
13
14
}
forbeginners.html workshop.css

1 Win % with Each Method


2
70.00%
3
4 60.00%
5
6 50.00%

7 Civilians
40.00%
8 Spies

9 30.00%
10
11 20.00%

12
10.00%
13
14 0.00%
Random Voting Voting by History Voting Mechanism

Programming Language
forbeginners.html workshop.css

1
2
Introduction; {
3
4
5 ‘Here you can give a brief description of the topic you want to talk about’
6
<p For example, if you want to talk about Mercury, you can say that
7
it’s the smallest planet in the entire Solar System >
8
9
10
11
12 </p>
13
14 }
Programming Language
forbeginners.html workshop.css

9h 55m 23s {
1
2
3
4
< Is Jupiter's rotation period >
5
6
7
333,000.000
8 < Earths fit in the Sun’s mass >
9
10
11
386,000 km
12 < Distance between the Moon and the Earth >
13
14 }
Programming Language
forbeginners.html workshop.css

1
2
Table Of ‘Contents’ {
3
4 01 Theory Lesson
5 < You can enter a subtitle here if you
6 need it >
7
8 02 Features of the Topic
9 < You can enter a subtitle here if you
need it >
10
11
12
03 Practical Exercise
< You can enter a subtitle here if you
13 need it >
14 }
Programming Language
the_code.ipynb game_explanation.ipynb

1
2
Let’s Talk About‘The Game’;
3
4 Here’s what you’ll find in this Slidesgo template:
∗ A slide structure based on a Workshop presentation, which you can easily adapt to your needs. For more info on how to edit
5 the template, please visit Slidesgo School or read our FAQs.
∗ An assortment of graphic resources that are suitable for use in the presentation can be found in the
6 alternative resources slide.
∗ A thanks slide, which you must keep so that proper credits for our design are given.
7 ∗ A resources slide, where you’ll find links to all the elements used in the template.
8 ∗ Instructions for use.
∗ Final slides with:
9 ∗ The fonts and colors used in the template.
∗ A selection of illustrations. You can also customize and animate them as you wish with the online editor. Visit
10 Storyset to find more.
∗ More infographic resources, whose size and color can be edited.
11 ∗ Sets of customizable icons of the following themes: general, business, avatar, creative process, education, help &
12 support, medical, nature, performing arts, SEO & marketing, and teamwork.
You can delete this slide when you’re done editing the presentation.
13
14

Programming Language
the_code.ipynb game_explanation.ipynb

1
2
Features of ‘the Topic’ {
3 Mercury is the closest planet to the Sun and the
4 Step 01 smallest one
5
6
Step 02 Saturn is a gas giant and has several rings
7
8
9 Step 03 The Earth is the only planet that harbors life
10
11
Venus has a beautiful name and is the second planet
12 Step 04 from the Sun
13
14 }
Programming Language
forbeginners.html workshop.css

1
2
Table Of ‘Contents’ {
3
4 01 Theory Lesson
5 < You can enter a subtitle here if you
6 need it >
7
8 02 Features of the Topic
9 < You can enter a subtitle here if you
need it >
10
11
12
03 Practical Exercise
< You can enter a subtitle here if you
13 need it >
14 }
Programming Language
forbeginners.html workshop.css

1
2
Concepts < /1 > {
3 < Mercury is the closest planet to the Sun and the smallest one in the
4 Solar System—it’s only a bit larger than the Moon >
5
6
7
}
8
9 Concepts < /2 > {
10
11 < Venus has a beautiful name and is the second planet from the Sun.
It’s hot and has a poisonous atmosphere >
12
13
14 }
Programming Language
forbeginners.html workshop.css

1
2
Introduction; {
3
4
5 ‘Here you can give a brief description of the topic you want to talk about’
6
<p For example, if you want to talk about Mercury, you can say that
7
it’s the smallest planet in the entire Solar System >
8
9
10
11
12 </p>
13
14 }
Programming Language
forbeginners.html workshop.css

1
2
3 01 {
4
5
6 [Theory Lesson]
7
8 < You can enter a subtitle here if you
9 need it >
10
11

}
12
13
14

Programming Language
forbeginners.html workshop.css

1
2
What Is this ‘Topic About ?’ {
3
Languages
4
5 Html 60% Css 40%
6
7 < Mercury is the smallest planet in < The Earth is the only one that
the entire Solar System > harbors life in the Solar System >
8
9
10 Create a web page
11
Venus has a nice Mars is a cold Jupiter is a gas
12 name place giant
13
14 }
Programming Language
forbeginners.html workshop.css

1
2
Features of ‘the Topic’ {
3 Mercury is the closest planet to the Sun and the
4 Step 01 smallest one
5
6
Step 02 Saturn is a gas giant and has several rings
7
8
9 Step 03 The Earth is the only planet that harbors life
10
11
Venus has a beautiful name and is the second planet
12 Step 04 from the Sun
13
14 }
Programming Language
forbeginners.html workshop.css

1
2
Recommendations; {
3
4
Mercury
5 < Mercury is the closest planet to the Sun and the smallest one in
the Solar System >
6
7
Saturn
8
9 < It was named after the Roman god of wealth and agriculture >
10
11 Jupiter
12
< Jupiter is a gas giant and the biggest planet in the Solar System >
13
14 }
Programming Language
forbeginners.html workshop.css

1
2
Examples About ‘The Topic’{
3
4 Mercury Jupiter
5 < Mercury is the closest < Jupiter is a gas giant and
6 planet to the Sun > the biggest planet >
7
8
9
10 Saturn Venus
11
< Saturn is a gas giant and < Venus has a nice name and
12 has several rings > high temperatures >
13
14 }
Programming Language
forbeginners.html workshop.css

1
2
Practical Exercise {
3
< Saturn is the fourth-largest object by diameter in the Solar System >
4
5
6
7 ∗ Mercury is the smallest planet
8 < /1 > ∗ The Earth is the planet we live on
∗ Saturn is made of oxygen and helium
9
10 ∗ Jupiter is a gas giant
11 < /2 > ∗ Venus has high temperatures
12 ∗ Neptune is very far away from the Sun
13
14 }
Programming Language
forbeginners.html workshop.css

9h 55m 23s {
1
2
3
4
< Is Jupiter's rotation period >
5
6
7
333,000.000
8 < Earths fit in the Sun’s mass >
9
10
11
386,000 km
12 < Distance between the Moon and the Earth >
13
14 }
Programming Language
A ‘Picture’ Is { Worth a
Thousand Words

}
forbeginners.html workshop.css

1
2

Awesome
3
4
5
6
7
8
9
{ Words;
10
11
12
13
14
}
Programming Language
forbeginners.html workshop.css

1
2
Did You Know ‘This ?’ {
3
4
Mercury is the smallest planet of the Solar
5 36.00
System
6
7 Venus has a beautiful name and high
25.00
8 temperatures
9
Despite being red, Mars is actually a cold
10 12.00
place
11
12
13
14 } Follow the link in the graph to modify its data and then paste the new one here. For more info, click here

Programming Language
forbeginners.html workshop.css

1
2
3
4 A ‘Picture’ Always
5
6 Reinforces The Concept {
7
8
9 < Images reveal large amounts of data, so
10 remember: use an image instead of a long text.
11 Your audience will appreciate it >
12
13
14 }
Programming Language
forbeginners.html workshop.css

1
2
3

150,005,630 {
4
5
6
7
8 < Big numbers catch your audience’s attention >
9
10

}
11
12
13
14

Programming Language
forbeginners.html workshop.css

1
2
3
4
5
6 < “This is a quote, words full of wisdom that someone
7
important said and can make the reader get inspired.” >
8
9
10 — Someone ‘Famous’
11
12
13
14

Programming Language
forbeginners.html workshop.css

1
2
Review ‘Concepts’ {
3
4
5
< Mercury is the closest
6 planet to the Sun and the
7 smallest one in the Solar
8 System >
9
10 Venus Ceres Saturn
11
12
13
14 }
Programming Language
forbeginners.html workshop.css

1
2
Planning of ‘September’{
3
M T W T F S S
4
5 01 02 03 04 05 Mercury is the smallest planet
6
06 07 08 09 10 11 12 Venus has a beautiful name
7
8 13 14 15 16 17 18 19
The Earth is the third planet
9 20 21 22 23 24 25 26
10 Mars is actually a cold place
11 27 28 29 30
Jupiter is a gas giant
12
13
14 }
Programming Language
forbeginners.html workshop.css

1
2
JavaScript For ‘Beginners’ {
3 Mercury Mars
4 Despite being red, Mars is a
5 It is the closest planet to the Sun
cold place
6
7 Jupiter Venus
8 Venus is the second planet from
Jupiter is the biggest planet
9 the Sun
10
11 Saturn Neptune
12 Saturn is a gas giant and has Neptune is very far from the
several rings Earth
13
14 }
Programming Language
forbeginners.html workshop.css

1
2
3
4 Desktop Software
5
6
{
7
8 You can replace the image on the
9 screen with your own work. Just
10 delete this one, add yours and
11 center it properly
12
13
14 }
Programming Language
forbeginners.html workshop.css

1
2
Web ‘Design’
3
4
5
6
7
8
9
10
11
12
13
14

Programming Language
forbeginners.html workshop.css

1
2
Alternative ‘Resources’ {
3 Here’s an assortment of alternative resources whose style fits the one of
4 this template
5
6 Photos:
7
∗ Portrait hacker I
8
∗ Portrait hacker II
9
10
11
12
13
14 }
Programming Language
forbeginners.html workshop.css

1
2
Resources {
3 Did you like the resources on this template? Get them for free at our
4 other websites:
5
6 Photos:
7
∗ Close up hacker
8
∗ Medium shot woman working computer
9
10 Icons:
11
∗ Web design
12
13
14 }
Programming Language
Instructions for use
In order to use this template, you must credit Slidesgo by keeping the Thanks slide.

You are allowed to:


- Modify this template.
- Use it for both personal and commercial projects.

You are not allowed to:


- Sublicense, sell or rent any of Slidesgo Content (or a modified version of Slidesgo Content).
- Distribute Slidesgo Content unless it has been expressly authorized by Slidesgo.
- Include Slidesgo Content in an online or offline database or file.
- Offer Slidesgo templates (or modified versions of Slidesgo templates) for download.
- Acquire the copyright of Slidesgo Content.

For more information about editing slides, please read our FAQs or visit Slidesgo School:
https://slidesgo.com/faqs and https://slidesgo.com/slidesgo-school
Instructions for use (premium users)
As a Premium user, you can use this template without attributing Slidesgo or keeping the "Thanks" slide.

You are allowed to:


● Modify this template.
● Use it for both personal and commercial purposes.
● Hide or delete the “Thanks” slide and the mention to Slidesgo in the credits.
● Share this template in an editable format with people who are not part of your team.

You are not allowed to:


● Sublicense, sell or rent this Slidesgo Template (or a modified version of this Slidesgo Template).
● Distribute this Slidesgo Template (or a modified version of this Slidesgo Template) or include it in a database or in
any other product or service that offers downloadable images, icons or presentations that may be subject to
distribution or resale.
● Use any of the elements that are part of this Slidesgo Template in an isolated and separated way from this
Template.
● Register any of the elements that are part of this template as a trademark or logo, or register it as a work in an
intellectual property registry or similar.

For more information about editing slides, please read our FAQs or visit Slidesgo School:
https://slidesgo.com/faqs and https://slidesgo.com/slidesgo-school
Fonts & colors used

This presentation has been made using the following fonts:

Fira Code
(https://fonts.google.com/specimen/Fira+Code)

#16191f #2e323b #707070 #e7e7e7 #ffffff

#ff5858 #fcc642 #dba0db #72d9f0 #a5cf27


Storyset

Create your Story with our illustrated concepts. Choose the style you like the most, edit its colors, pick
the background and layers you want to show and bring them to life with the animator panel! It will boost
your presentation. Check out How it Works.

Pana Amico Bro Rafiki Cuate


Use our editable graphic resources...

You can easily resize these resources without losing quality. To change the color, just ungroup the resource
and click on the object you want to change. Then, click on the paint bucket and select the color you want.
Group the resource again when you’re done. You can also look for more infographics on Slidesgo.
JANUARY FEBRUARY MARCH APRIL MAY JUNE

PHASE 1

Task 1

Task 2

PHASE 2

Task 1

Task 2

JANUARY FEBRUARY MARCH APRIL

PHASE
1

Task 1

Task 2
...and our sets of editable icons

You can resize these icons without losing quality.


You can change the stroke and fill color; just select the icon and click on the paint bucket/pen.
In Google Slides, you can also use Flaticon’s extension, allowing you to customize and add even more icons.
Educational Icons Medical Icons
Business Icons Teamwork Icons
Help & Support Icons Avatar Icons
Creative Process Icons Performing Arts Icons
Nature Icons
SEO & Marketing Icons

You might also like