Skip to content
This repository was archived by the owner on Dec 22, 2023. It is now read-only.

Added 'FLAMES-game' folder to Scripts/Miscellaneous which implement the 'FLAMES' game using python script #54

Merged
merged 29 commits into from
Oct 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions Scripts/Miscellaneous/FLAMES-game/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# FLAMES game
A simple Python script to implement the FLAMES game we all might have played in our childhood.

### Prerequisites
Python 2 / Python 3

### How to run the script
First move to the `FLAMES-game` directory to access the files
Run the following command once you are in the `FLAMES-game` directory:

```cd Scripts/Miscellaneous/FLAMES-game```

Now, to run the scripts, use the following commands:

For Python 3: ```python3 flames_game.py``` <br>
For Python 2: ```python flames_game.py```

### Screenshot/GIF showing the sample use of the script
![Screenshot1](screenshot1.png)
![Screenshot2](screenshot2.png)

## *Author Name*
Saujanya Pandey
63 changes: 63 additions & 0 deletions Scripts/Miscellaneous/FLAMES-game/flames_game.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import time

print("-------F.L.A.M.E.S.-------")

# display output format
print("\nOutput format:")
print(" ['F']: 'Friends', ['L']: 'Love', ['A']: 'Acquaintance', ")
print(" ['M']: 'Marriage', ['E']: 'Enemies', ['S']: 'Siblings', ")

# input two names
name1 = input('\nEnter first name: ')
name2 = input('Enter second name: ')

# convert to uppercase
name1List = list(name1.upper())
name2List = list(name2.upper())

# convert 'FLAMES' into a list
flames = list('FLAMES')

for letter in name1List:
if letter in name2List:
# check for common letters
print('\nChecking '+ letter + '...')
print('Letter '+ letter + ' found')

# find & replace the letter to show it has been striked out
index1 = name1List.index(letter)
name1List[index1] = '_'
index2 = name2List.index(letter)
name2List[index2] = '_'
print('Replaced '+ letter)

print(name1List)
print(name2List)

names = name1List + name2List
count = 0

for letter in names:
# count all characters other than replaced/spaces
if(letter != '_' and letter != ' '):
count+=1

index = 0

while len(flames) > 1:
for i in range(count):
index += 1
if index > len(flames):
# if index crosses length of 'flame' then reset it to 1
index = 1

flames.remove(flames[index-1])
index -= 1

print('\nYour result is: ', flames)

# wait before exiting
time.sleep(5)
print('Exiting!')
time.sleep(2)
exit()
Binary file added Scripts/Miscellaneous/FLAMES-game/screenshot1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Scripts/Miscellaneous/FLAMES-game/screenshot2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.