update
This commit is contained in:
parent
2992f4f408
commit
4f46de8d00
3330 changed files with 394553 additions and 76939 deletions
12
.config/Code/User/History/-4c5a7b2f/02Qq.py
Normal file
12
.config/Code/User/History/-4c5a7b2f/02Qq.py
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
class Player:
|
||||
def __init__(self, name) -> None:
|
||||
self.name = name
|
||||
self.score = 0
|
||||
self.health = 100
|
||||
self.x = 0
|
||||
self.y = 0
|
||||
|
||||
|
||||
class DungeonGame:
|
||||
def __init__(self) -> None:
|
||||
self.player = Player()
|
||||
61
.config/Code/User/History/-4c5a7b2f/0h80.py
Normal file
61
.config/Code/User/History/-4c5a7b2f/0h80.py
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
import random
|
||||
|
||||
class Player:
|
||||
def __init__(self, name: str) -> None:
|
||||
self.name = name
|
||||
self.score = 0
|
||||
self.health = 100
|
||||
self.x = 0
|
||||
self.y = 0
|
||||
|
||||
def move_player(self, direction: str) -> None:
|
||||
if direction == 'l':
|
||||
if self.x > 0:
|
||||
self.x -= 1
|
||||
elif direction == 'r':
|
||||
if self.x < 5:
|
||||
self.x += 1
|
||||
elif direction == 'u':
|
||||
if self.y > 0:
|
||||
self.y += 1
|
||||
elif direction == 'd':
|
||||
if self.y < 5:
|
||||
self.y -= 1
|
||||
|
||||
class DungeonGame:
|
||||
def __init__(self, name: str) -> None:
|
||||
self.player = Player(name)
|
||||
self.grid = [[],[],[],[],[]]
|
||||
self.grid_init()
|
||||
|
||||
def grid_init(self) -> None:
|
||||
for row in self.grid:
|
||||
for i in range(5):
|
||||
row.append(random.choice(['T', 'H', 'E']))
|
||||
self.grid[self.player.x][self.player.y] = '@'
|
||||
|
||||
# def display(self):
|
||||
# for row in self.grid:
|
||||
# for col in row:
|
||||
# print(col, end=' ')
|
||||
# print()
|
||||
|
||||
def check_cell(self, x: int, y: int) -> None:
|
||||
if self.grid[x][y] == 'T':
|
||||
self.player.health -= 20
|
||||
print('the player hit a trap, ouuuch!!')
|
||||
elif self.grid[x][y] == 'H':
|
||||
self.player.health += 10
|
||||
print('the player got a health potion, nom nom')
|
||||
elif self.grid[x][y] == 'E':
|
||||
print('ooo nothing here')
|
||||
|
||||
def play_turn(self):
|
||||
a = input('enter a character to move the player(l, r, u, d): ')
|
||||
self.player.move_player(a)
|
||||
self.check_cell(self.player.x, self.player.y)
|
||||
|
||||
game = DungeonGame('rafay')
|
||||
|
||||
while not game_over:
|
||||
game.play_turn()
|
||||
22
.config/Code/User/History/-4c5a7b2f/1EiM.py
Normal file
22
.config/Code/User/History/-4c5a7b2f/1EiM.py
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
import random
|
||||
|
||||
class Player:
|
||||
def __init__(self, name) -> None:
|
||||
self.name = name
|
||||
self.score = 0
|
||||
self.health = 100
|
||||
self.x = 0
|
||||
self.y = 0
|
||||
|
||||
|
||||
class DungeonGame:
|
||||
def __init__(self) -> None:
|
||||
self.player = Player()
|
||||
self.grid = [[],[],[],[],[]]
|
||||
|
||||
def grid_init(self):
|
||||
for row in self.grid:
|
||||
for col in row:
|
||||
pass
|
||||
|
||||
pass
|
||||
66
.config/Code/User/History/-4c5a7b2f/1P6H.py
Normal file
66
.config/Code/User/History/-4c5a7b2f/1P6H.py
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
import random
|
||||
|
||||
class Player:
|
||||
def __init__(self, name: str) -> None:
|
||||
self.name = name
|
||||
self.score = 0
|
||||
self.health = 100
|
||||
self.x = 0
|
||||
self.y = 0
|
||||
|
||||
def move_player(self, direction: str) -> None:
|
||||
if direction == 'l':
|
||||
if self.x > 0:
|
||||
self.x -= 1
|
||||
elif direction == 'r':
|
||||
if self.x < 5:
|
||||
self.x += 1
|
||||
elif direction == 'u':
|
||||
if self.y > 0:
|
||||
self.y += 1
|
||||
elif direction == 'd':
|
||||
if self.y < 5:
|
||||
self.y -= 1
|
||||
|
||||
class DungeonGame:
|
||||
def __init__(self, name: str) -> None:
|
||||
self.player = Player(name)
|
||||
self.grid = [[],[],[],[],[]]
|
||||
self.game_over = False
|
||||
self.grid_init()
|
||||
|
||||
def grid_init(self) -> None:
|
||||
for row in self.grid:
|
||||
for i in range(5):
|
||||
row.append(random.choice(['T', 'H', 'E']))
|
||||
self.grid[self.player.x][self.player.y] = '@'
|
||||
|
||||
# def display(self):
|
||||
# for row in self.grid:
|
||||
# for col in row:
|
||||
# print(col, end=' ')
|
||||
# print()
|
||||
|
||||
def check_cell(self, x: int, y: int) -> None:
|
||||
if self.grid[x][y] == 'T':
|
||||
self.player.health -= 20
|
||||
print('the player hit a trap, ouuuch!!')
|
||||
if self.player.health <= 0:
|
||||
self.game_over = True
|
||||
print('aaaaa my health, i die -- game over')
|
||||
elif self.grid[x][y] == 'H':
|
||||
if self.player.health < 100:
|
||||
self.player.health += 10
|
||||
print('the player got a health potion, nom nom')
|
||||
elif self.grid[x][y] == 'E':
|
||||
print('ooo nothing here')
|
||||
|
||||
def play_turn(self):
|
||||
a = input('enter a character to move the player(l, r, u, d): ')
|
||||
self.player.move_player(a)
|
||||
self.check_cell(self.player.x, self.player.y)
|
||||
|
||||
game = DungeonGame('rafay')
|
||||
|
||||
while not game.game_over:
|
||||
game.play_turn()
|
||||
30
.config/Code/User/History/-4c5a7b2f/5ckz.py
Normal file
30
.config/Code/User/History/-4c5a7b2f/5ckz.py
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
import random
|
||||
|
||||
class Player:
|
||||
def __init__(self, name: str) -> None:
|
||||
self.name = name
|
||||
self.score = 0
|
||||
self.health = 100
|
||||
self.x = 0
|
||||
self.y = 0
|
||||
|
||||
|
||||
class DungeonGame:
|
||||
def __init__(self, name: str) -> None:
|
||||
self.player = Player(name)
|
||||
self.grid = [[],[],[],[],[]]
|
||||
self.grid_init()
|
||||
|
||||
def grid_init(self):
|
||||
for row in self.grid:
|
||||
for i in range(5):
|
||||
row.append(random.choice(['T', 'H', 'E']))
|
||||
|
||||
def display(self):
|
||||
for row in self.grid:
|
||||
for col in row:
|
||||
print(col)
|
||||
print()
|
||||
|
||||
game = DungeonGame('rafay')
|
||||
game.display()
|
||||
67
.config/Code/User/History/-4c5a7b2f/8EzY.py
Normal file
67
.config/Code/User/History/-4c5a7b2f/8EzY.py
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
import random
|
||||
|
||||
class Player:
|
||||
def __init__(self, name: str) -> None:
|
||||
self.name = name
|
||||
self.score = 0
|
||||
self.health = 100
|
||||
self.x = 0
|
||||
self.y = 0
|
||||
|
||||
def move_player(self, direction: str) -> None:
|
||||
if direction == 'l':
|
||||
if self.x > 0:
|
||||
self.x -= 1
|
||||
elif direction == 'r':
|
||||
if self.x < 5:
|
||||
self.x += 1
|
||||
elif direction == 'u':
|
||||
if self.y > 0:
|
||||
self.y += 1
|
||||
elif direction == 'd':
|
||||
if self.y < 5:
|
||||
self.y -= 1
|
||||
|
||||
class DungeonGame:
|
||||
def __init__(self, name: str) -> None:
|
||||
self.player = Player(name)
|
||||
self.grid = [[],[],[],[],[]]
|
||||
self.game_over = False
|
||||
self.grid_init()
|
||||
|
||||
def grid_init(self) -> None:
|
||||
for row in self.grid:
|
||||
for i in range(5):
|
||||
row.append(random.choice(['T', 'H', 'E']))
|
||||
self.grid[self.player.x][self.player.y] = '@'
|
||||
|
||||
# def display(self):
|
||||
# for row in self.grid:
|
||||
# for col in row:
|
||||
# print(col, end=' ')
|
||||
# print()
|
||||
|
||||
def check_cell(self, x: int, y: int) -> None:
|
||||
if self.grid[x][y] == 'T':
|
||||
self.player.health -= 20
|
||||
print('the player hit a trap, ouuuch!!')
|
||||
if self.player.health <= 0:
|
||||
self.game_over = True
|
||||
print('aaaaa my health, i die -- game over')
|
||||
elif self.grid[x][y] == 'H':
|
||||
if self.player.health < 100:
|
||||
self.player.health += 10
|
||||
print('the player got a health potion, nom nom')
|
||||
elif self.grid[x][y] == 'E':
|
||||
print('ooo nothing here')
|
||||
|
||||
def play_turn(self):
|
||||
a = input('enter a character to move the player(l, r, u, d): ')
|
||||
self.player.move_player(a)
|
||||
self.check_cell(self.player.x, self.player.y)
|
||||
print('current player health: ', self.player.health)
|
||||
|
||||
game = DungeonGame('rafay')
|
||||
|
||||
while not game.game_over:
|
||||
game.play_turn()
|
||||
58
.config/Code/User/History/-4c5a7b2f/9zhQ.py
Normal file
58
.config/Code/User/History/-4c5a7b2f/9zhQ.py
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
import random
|
||||
|
||||
class Player:
|
||||
def __init__(self, name: str) -> None:
|
||||
self.name = name
|
||||
self.score = 0
|
||||
self.health = 100
|
||||
self.x = 0
|
||||
self.y = 0
|
||||
|
||||
def move_player(self, direction: str) -> None:
|
||||
if direction == 'l':
|
||||
if self.x > 0:
|
||||
self.x -= 1
|
||||
elif direction == 'r':
|
||||
if self.x < 5:
|
||||
self.x += 1
|
||||
elif direction == 'u':
|
||||
if self.y > 0:
|
||||
self.y += 1
|
||||
elif direction == 'd':
|
||||
if self.y < 5:
|
||||
self.y -= 1
|
||||
|
||||
class DungeonGame:
|
||||
def __init__(self, name: str) -> None:
|
||||
self.player = Player(name)
|
||||
self.grid = [[],[],[],[],[]]
|
||||
self.grid_init()
|
||||
|
||||
def grid_init(self) -> None:
|
||||
for row in self.grid:
|
||||
for i in range(5):
|
||||
row.append(random.choice(['T', 'H', 'E']))
|
||||
self.grid[self.player.x][self.player.y] = '@'
|
||||
|
||||
# def display(self):
|
||||
# for row in self.grid:
|
||||
# for col in row:
|
||||
# print(col, end=' ')
|
||||
# print()
|
||||
|
||||
def check_cell(self, x: int, y: int) -> None:
|
||||
if self.grid[x][y] == 'T':
|
||||
self.player.health -= 20
|
||||
print('the player hit a trap, ouuuch!!')
|
||||
elif self.grid[x][y] == 'H':
|
||||
self.player.health += 10
|
||||
print('the player got a health potion, nom nom')
|
||||
elif self.grid[x][y] == 'E':
|
||||
print('ooo nothing here')
|
||||
|
||||
def play_turn(self):
|
||||
a = input('enter a character to move the player(l, r, u, d): ')
|
||||
self.player.move_player(a)
|
||||
self.check_cell(self.player.x, self.player.y)
|
||||
|
||||
game = DungeonGame('rafay')
|
||||
27
.config/Code/User/History/-4c5a7b2f/A0Jx.py
Normal file
27
.config/Code/User/History/-4c5a7b2f/A0Jx.py
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
import random
|
||||
|
||||
class Player:
|
||||
def __init__(self, name: str) -> None:
|
||||
self.name = name
|
||||
self.score = 0
|
||||
self.health = 100
|
||||
self.x = 0
|
||||
self.y = 0
|
||||
|
||||
|
||||
class DungeonGame:
|
||||
def __init__(self, name: str) -> None:
|
||||
self.player = Player(name)
|
||||
self.grid = [[],[],[],[],[]]
|
||||
self.grid_init()
|
||||
|
||||
def grid_init(self):
|
||||
for row in self.grid:
|
||||
row.append(random.choice(['T', 'H', 'E']))
|
||||
|
||||
def display(self):
|
||||
for row in self.grid:
|
||||
print(row)
|
||||
|
||||
game = DungeonGame('rafay')
|
||||
game.display()
|
||||
13
.config/Code/User/History/-4c5a7b2f/CYj1.py
Normal file
13
.config/Code/User/History/-4c5a7b2f/CYj1.py
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
class Player:
|
||||
def __init__(self, name) -> None:
|
||||
self.name = name
|
||||
self.score = 0
|
||||
self.health = 100
|
||||
self.x = 0
|
||||
self.y = 0
|
||||
|
||||
|
||||
class DungeonGame:
|
||||
def __init__(self) -> None:
|
||||
self.player = Player()
|
||||
self.grid = [[],[],[],[],[]]
|
||||
34
.config/Code/User/History/-4c5a7b2f/EEDz.py
Normal file
34
.config/Code/User/History/-4c5a7b2f/EEDz.py
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
import random
|
||||
|
||||
class Player:
|
||||
def __init__(self, name: str) -> None:
|
||||
self.name = name
|
||||
self.score = 0
|
||||
self.health = 100
|
||||
self.x = 0
|
||||
self.y = 0
|
||||
|
||||
|
||||
class DungeonGame:
|
||||
def __init__(self, name: str) -> None:
|
||||
self.player = Player(name)
|
||||
self.grid = [[],[],[],[],[]]
|
||||
self.grid_init()
|
||||
|
||||
def grid_init(self):
|
||||
for row in self.grid:
|
||||
for i in range(5):
|
||||
row.append(random.choice(['T', 'H', 'E']))
|
||||
self.grid[self.player.x][self.player.y] = '@'
|
||||
|
||||
def display(self):
|
||||
for row in self.grid:
|
||||
for col in row:
|
||||
print(col, end=' ')
|
||||
print()
|
||||
|
||||
game = DungeonGame('rafay')
|
||||
|
||||
while not game_over:
|
||||
game.display()
|
||||
a = input('enter a direction to move the player: ')
|
||||
27
.config/Code/User/History/-4c5a7b2f/HMka.py
Normal file
27
.config/Code/User/History/-4c5a7b2f/HMka.py
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
import random
|
||||
|
||||
class Player:
|
||||
def __init__(self, name) -> None:
|
||||
self.name = name
|
||||
self.score = 0
|
||||
self.health = 100
|
||||
self.x = 0
|
||||
self.y = 0
|
||||
|
||||
|
||||
class DungeonGame:
|
||||
def __init__(self) -> None:
|
||||
self.player = Player()
|
||||
self.grid = [[],[],[],[],[]]
|
||||
|
||||
def grid_init(self):
|
||||
for row in self.grid:
|
||||
for col in row:
|
||||
col = random.choice(['T', 'H', 'E'])
|
||||
|
||||
def display(self):
|
||||
print(self.grid)
|
||||
|
||||
|
||||
game = DungeonGame()
|
||||
game.display()
|
||||
20
.config/Code/User/History/-4c5a7b2f/IZaE.py
Normal file
20
.config/Code/User/History/-4c5a7b2f/IZaE.py
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
import random
|
||||
|
||||
class Player:
|
||||
def __init__(self, name) -> None:
|
||||
self.name = name
|
||||
self.score = 0
|
||||
self.health = 100
|
||||
self.x = 0
|
||||
self.y = 0
|
||||
|
||||
|
||||
class DungeonGame:
|
||||
def __init__(self) -> None:
|
||||
self.player = Player()
|
||||
self.grid = [[],[],[],[],[]]
|
||||
|
||||
def grid_init(self):
|
||||
|
||||
|
||||
pass
|
||||
56
.config/Code/User/History/-4c5a7b2f/IfDX.py
Normal file
56
.config/Code/User/History/-4c5a7b2f/IfDX.py
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
import random
|
||||
|
||||
class Player:
|
||||
def __init__(self, name: str) -> None:
|
||||
self.name = name
|
||||
self.score = 0
|
||||
self.health = 100
|
||||
self.x = 0
|
||||
self.y = 0
|
||||
|
||||
def move_player(self, direction: str) -> None:
|
||||
if direction == 'l':
|
||||
if self.x > 0:
|
||||
self.x -= 1
|
||||
elif direction == 'r':
|
||||
if self.x < 5:
|
||||
self.x += 1
|
||||
elif direction == 'u':
|
||||
if self.y > 0:
|
||||
self.y += 1
|
||||
elif direction == 'd':
|
||||
if self.y < 5:
|
||||
self.y -= 1
|
||||
|
||||
class DungeonGame:
|
||||
def __init__(self, name: str) -> None:
|
||||
self.player = Player(name)
|
||||
self.grid = [[],[],[],[],[]]
|
||||
self.grid_init()
|
||||
|
||||
def grid_init(self) -> None:
|
||||
for row in self.grid:
|
||||
for i in range(5):
|
||||
row.append(random.choice(['T', 'H', 'E']))
|
||||
self.grid[self.player.x][self.player.y] = '@'
|
||||
|
||||
# def display(self):
|
||||
# for row in self.grid:
|
||||
# for col in row:
|
||||
# print(col, end=' ')
|
||||
# print()
|
||||
|
||||
def check_cell(self, x, y):
|
||||
if self.grid[x][y] == 'T':
|
||||
self.player.health -= 20
|
||||
print('the player hit a trap, ouuuch!!')
|
||||
elif self.grid[x][y] == 'H':
|
||||
self.player.health += 10
|
||||
print('the player got a health potion, nom nom')
|
||||
elif self.grid[x][y] == 'E':
|
||||
print('ooo nothing here')
|
||||
|
||||
def play_turn():
|
||||
|
||||
|
||||
game = DungeonGame('rafay')
|
||||
28
.config/Code/User/History/-4c5a7b2f/IkBu.py
Normal file
28
.config/Code/User/History/-4c5a7b2f/IkBu.py
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
import random
|
||||
|
||||
class Player:
|
||||
def __init__(self, name: str) -> None:
|
||||
self.name = name
|
||||
self.score = 0
|
||||
self.health = 100
|
||||
self.x = 0
|
||||
self.y = 0
|
||||
|
||||
|
||||
class DungeonGame:
|
||||
def __init__(self, name: str) -> None:
|
||||
self.player = Player(name)
|
||||
self.grid = [[],[],[],[],[]]
|
||||
self.grid_init()
|
||||
|
||||
def grid_init(self):
|
||||
for row in self.grid:
|
||||
for i in range(5):
|
||||
row.append(random.choice(['T', 'H', 'E']))
|
||||
|
||||
def display(self):
|
||||
for row in self.grid:
|
||||
print(row)
|
||||
|
||||
game = DungeonGame('rafay')
|
||||
game.display()
|
||||
30
.config/Code/User/History/-4c5a7b2f/KHtN.py
Normal file
30
.config/Code/User/History/-4c5a7b2f/KHtN.py
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
import random
|
||||
|
||||
class Player:
|
||||
def __init__(self, name: str) -> None:
|
||||
self.name = name
|
||||
self.score = 0
|
||||
self.health = 100
|
||||
self.x = 0
|
||||
self.y = 0
|
||||
|
||||
|
||||
class DungeonGame:
|
||||
def __init__(self, name: str) -> None:
|
||||
self.player = Player(name)
|
||||
self.grid = [[],[],[],[],[]]
|
||||
self.grid_init()
|
||||
|
||||
def grid_init(self):
|
||||
for row in self.grid:
|
||||
for i in range(5):
|
||||
row.append(random.choice(['T', 'H', 'E']))
|
||||
|
||||
def display(self):
|
||||
for row in self.grid:
|
||||
for col in row:
|
||||
print(col, end=' ')
|
||||
print()
|
||||
|
||||
game = DungeonGame('rafay')
|
||||
game.display()
|
||||
57
.config/Code/User/History/-4c5a7b2f/Lf86.py
Normal file
57
.config/Code/User/History/-4c5a7b2f/Lf86.py
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
import random
|
||||
|
||||
class Player:
|
||||
def __init__(self, name: str) -> None:
|
||||
self.name = name
|
||||
self.score = 0
|
||||
self.health = 100
|
||||
self.x = 0
|
||||
self.y = 0
|
||||
|
||||
def move_player(self, direction: str) -> None:
|
||||
if direction == 'l':
|
||||
if self.x > 0:
|
||||
self.x -= 1
|
||||
elif direction == 'r':
|
||||
if self.x < 5:
|
||||
self.x += 1
|
||||
elif direction == 'u':
|
||||
if self.y > 0:
|
||||
self.y += 1
|
||||
elif direction == 'd':
|
||||
if self.y < 5:
|
||||
self.y -= 1
|
||||
|
||||
class DungeonGame:
|
||||
def __init__(self, name: str) -> None:
|
||||
self.player = Player(name)
|
||||
self.grid = [[],[],[],[],[]]
|
||||
self.grid_init()
|
||||
|
||||
def grid_init(self) -> None:
|
||||
for row in self.grid:
|
||||
for i in range(5):
|
||||
row.append(random.choice(['T', 'H', 'E']))
|
||||
self.grid[self.player.x][self.player.y] = '@'
|
||||
|
||||
# def display(self):
|
||||
# for row in self.grid:
|
||||
# for col in row:
|
||||
# print(col, end=' ')
|
||||
# print()
|
||||
|
||||
def check_cell(self, x: int, y: int) -> None:
|
||||
if self.grid[x][y] == 'T':
|
||||
self.player.health -= 20
|
||||
print('the player hit a trap, ouuuch!!')
|
||||
elif self.grid[x][y] == 'H':
|
||||
self.player.health += 10
|
||||
print('the player got a health potion, nom nom')
|
||||
elif self.grid[x][y] == 'E':
|
||||
print('ooo nothing here')
|
||||
|
||||
def play_turn(self):
|
||||
a = input('enter a character to move the player(l, r, u, d): ')
|
||||
self.player.move_player(a)
|
||||
|
||||
game = DungeonGame('rafay')
|
||||
56
.config/Code/User/History/-4c5a7b2f/Mdp9.py
Normal file
56
.config/Code/User/History/-4c5a7b2f/Mdp9.py
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
import random
|
||||
|
||||
class Player:
|
||||
def __init__(self, name: str) -> None:
|
||||
self.name = name
|
||||
self.score = 0
|
||||
self.health = 100
|
||||
self.x = 0
|
||||
self.y = 0
|
||||
|
||||
def move_player(self, direction: str) -> None:
|
||||
if direction == 'l':
|
||||
if self.x > 0:
|
||||
self.x -= 1
|
||||
elif direction == 'r':
|
||||
if self.x < 5:
|
||||
self.x += 1
|
||||
elif direction == 'u':
|
||||
if self.y > 0:
|
||||
self.y += 1
|
||||
elif direction == 'd':
|
||||
if self.y < 5:
|
||||
self.y -= 1
|
||||
|
||||
class DungeonGame:
|
||||
def __init__(self, name: str) -> None:
|
||||
self.player = Player(name)
|
||||
self.grid = [[],[],[],[],[]]
|
||||
self.grid_init()
|
||||
|
||||
def grid_init(self) -> None:
|
||||
for row in self.grid:
|
||||
for i in range(5):
|
||||
row.append(random.choice(['T', 'H', 'E']))
|
||||
self.grid[self.player.x][self.player.y] = '@'
|
||||
|
||||
# def display(self):
|
||||
# for row in self.grid:
|
||||
# for col in row:
|
||||
# print(col, end=' ')
|
||||
# print()
|
||||
|
||||
def check_cell(self, x: int, y: int) -> None:
|
||||
if self.grid[x][y] == 'T':
|
||||
self.player.health -= 20
|
||||
print('the player hit a trap, ouuuch!!')
|
||||
elif self.grid[x][y] == 'H':
|
||||
self.player.health += 10
|
||||
print('the player got a health potion, nom nom')
|
||||
elif self.grid[x][y] == 'E':
|
||||
print('ooo nothing here')
|
||||
|
||||
def play_turn():
|
||||
|
||||
|
||||
game = DungeonGame('rafay')
|
||||
10
.config/Code/User/History/-4c5a7b2f/Midg.py
Normal file
10
.config/Code/User/History/-4c5a7b2f/Midg.py
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
class Player:
|
||||
def __init__(self) -> None:
|
||||
self.health = 100
|
||||
self.x = 0
|
||||
self.y = 0
|
||||
|
||||
|
||||
class DungeonGame:
|
||||
def __init__(self) -> None:
|
||||
pass
|
||||
43
.config/Code/User/History/-4c5a7b2f/OWFK.py
Normal file
43
.config/Code/User/History/-4c5a7b2f/OWFK.py
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
import random
|
||||
|
||||
class Player:
|
||||
def __init__(self, name: str) -> None:
|
||||
self.name = name
|
||||
self.score = 0
|
||||
self.health = 100
|
||||
self.x = 0
|
||||
self.y = 0
|
||||
|
||||
def move_player(self, direction: str) -> None:
|
||||
if direction == 'l':
|
||||
if self.x > 0:
|
||||
self.x -= 1
|
||||
elif direction == 'r':
|
||||
if self.x < 5:
|
||||
self.x += 1
|
||||
elif direction == 'u':
|
||||
if self.y > 0:
|
||||
self.y += 1
|
||||
elif direction == 'd':
|
||||
if self.y < 5:
|
||||
self.y -= 1
|
||||
|
||||
class DungeonGame:
|
||||
def __init__(self, name: str) -> None:
|
||||
self.player = Player(name)
|
||||
self.grid = [[],[],[],[],[]]
|
||||
self.grid_init()
|
||||
|
||||
def grid_init(self):
|
||||
for row in self.grid:
|
||||
for i in range(5):
|
||||
row.append(random.choice(['T', 'H', 'E']))
|
||||
self.grid[self.player.x][self.player.y] = '@'
|
||||
|
||||
def display(self):
|
||||
for row in self.grid:
|
||||
for col in row:
|
||||
print(col, end=' ')
|
||||
print()
|
||||
|
||||
game = DungeonGame('rafay')
|
||||
46
.config/Code/User/History/-4c5a7b2f/Q6EG.py
Normal file
46
.config/Code/User/History/-4c5a7b2f/Q6EG.py
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
import random
|
||||
|
||||
class Player:
|
||||
def __init__(self, name: str) -> None:
|
||||
self.name = name
|
||||
self.score = 0
|
||||
self.health = 100
|
||||
self.x = 0
|
||||
self.y = 0
|
||||
|
||||
def move_player(self, direction: str) -> None:
|
||||
if direction == 'l':
|
||||
if self.x > 0:
|
||||
self.x -= 1
|
||||
elif direction == 'r':
|
||||
if self.x < 5:
|
||||
self.x += 1
|
||||
elif direction == 'u':
|
||||
if self.y > 0:
|
||||
self.y += 1
|
||||
elif direction == 'd':
|
||||
if self.y < 5:
|
||||
self.y -= 1
|
||||
|
||||
class DungeonGame:
|
||||
def __init__(self, name: str) -> None:
|
||||
self.player = Player(name)
|
||||
self.grid = [[],[],[],[],[]]
|
||||
self.grid_init()
|
||||
|
||||
def grid_init(self):
|
||||
for row in self.grid:
|
||||
for i in range(5):
|
||||
row.append(random.choice(['T', 'H', 'E']))
|
||||
self.grid[self.player.x][self.player.y] = '@'
|
||||
|
||||
def display(self):
|
||||
for row in self.grid:
|
||||
for col in row:
|
||||
print(col, end=' ')
|
||||
print()
|
||||
|
||||
game = DungeonGame('rafay')
|
||||
|
||||
while not game_over:
|
||||
a = input('enter a direction to move the player: ')
|
||||
31
.config/Code/User/History/-4c5a7b2f/TiPK.py
Normal file
31
.config/Code/User/History/-4c5a7b2f/TiPK.py
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
import random
|
||||
|
||||
class Player:
|
||||
def __init__(self, name: str) -> None:
|
||||
self.name = name
|
||||
self.score = 0
|
||||
self.health = 100
|
||||
self.x = 0
|
||||
self.y = 0
|
||||
|
||||
|
||||
class DungeonGame:
|
||||
def __init__(self, name: str) -> None:
|
||||
self.player = Player(name)
|
||||
self.grid = [[],[],[],[],[]]
|
||||
self.grid_init()
|
||||
|
||||
def grid_init(self):
|
||||
for row in self.grid:
|
||||
for i in range(5):
|
||||
row.append(random.choice(['T', 'H', 'E']))
|
||||
self.grid[self.player.x][self.player.y] = '@'
|
||||
|
||||
def display(self):
|
||||
for row in self.grid:
|
||||
for col in row:
|
||||
print(col, end=' ')
|
||||
print()
|
||||
|
||||
game = DungeonGame('rafay')
|
||||
game.display()
|
||||
27
.config/Code/User/History/-4c5a7b2f/UY6X.py
Normal file
27
.config/Code/User/History/-4c5a7b2f/UY6X.py
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
import random
|
||||
|
||||
class Player:
|
||||
def __init__(self, name: str) -> None:
|
||||
self.name = name
|
||||
self.score = 0
|
||||
self.health = 100
|
||||
self.x = 0
|
||||
self.y = 0
|
||||
|
||||
|
||||
class DungeonGame:
|
||||
def __init__(self, name: str) -> None:
|
||||
self.player = Player(name)
|
||||
self.grid = [[],[],[],[],[]]
|
||||
|
||||
def grid_init(self):
|
||||
for row in self.grid:
|
||||
for col in row:
|
||||
col = random.choice(['T', 'H', 'E'])
|
||||
|
||||
def display(self):
|
||||
for row in self.grid:
|
||||
print(row)
|
||||
|
||||
game = DungeonGame('rafay')
|
||||
game.display()
|
||||
57
.config/Code/User/History/-4c5a7b2f/YSe7.py
Normal file
57
.config/Code/User/History/-4c5a7b2f/YSe7.py
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
import random
|
||||
|
||||
class Player:
|
||||
def __init__(self, name: str) -> None:
|
||||
self.name = name
|
||||
self.score = 0
|
||||
self.health = 100
|
||||
self.x = 0
|
||||
self.y = 0
|
||||
|
||||
def move_player(self, direction: str) -> None:
|
||||
if direction == 'l':
|
||||
if self.x > 0:
|
||||
self.x -= 1
|
||||
elif direction == 'r':
|
||||
if self.x < 5:
|
||||
self.x += 1
|
||||
elif direction == 'u':
|
||||
if self.y > 0:
|
||||
self.y += 1
|
||||
elif direction == 'd':
|
||||
if self.y < 5:
|
||||
self.y -= 1
|
||||
|
||||
class DungeonGame:
|
||||
def __init__(self, name: str) -> None:
|
||||
self.player = Player(name)
|
||||
self.grid = [[],[],[],[],[]]
|
||||
self.grid_init()
|
||||
|
||||
def grid_init(self) -> None:
|
||||
for row in self.grid:
|
||||
for i in range(5):
|
||||
row.append(random.choice(['T', 'H', 'E']))
|
||||
self.grid[self.player.x][self.player.y] = '@'
|
||||
|
||||
# def display(self):
|
||||
# for row in self.grid:
|
||||
# for col in row:
|
||||
# print(col, end=' ')
|
||||
# print()
|
||||
|
||||
def check_cell(self, x: int, y: int) -> None:
|
||||
if self.grid[x][y] == 'T':
|
||||
self.player.health -= 20
|
||||
print('the player hit a trap, ouuuch!!')
|
||||
elif self.grid[x][y] == 'H':
|
||||
self.player.health += 10
|
||||
print('the player got a health potion, nom nom')
|
||||
elif self.grid[x][y] == 'E':
|
||||
print('ooo nothing here')
|
||||
|
||||
def play_turn():
|
||||
a = input('enter a character to move the player(l, r, u, d): ')
|
||||
|
||||
|
||||
game = DungeonGame('rafay')
|
||||
27
.config/Code/User/History/-4c5a7b2f/afar.py
Normal file
27
.config/Code/User/History/-4c5a7b2f/afar.py
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
import random
|
||||
|
||||
class Player:
|
||||
def __init__(self, name: str) -> None:
|
||||
self.name = name
|
||||
self.score = 0
|
||||
self.health = 100
|
||||
self.x = 0
|
||||
self.y = 0
|
||||
|
||||
|
||||
class DungeonGame:
|
||||
def __init__(self) -> None:
|
||||
self.player = Player()
|
||||
self.grid = [[],[],[],[],[]]
|
||||
|
||||
def grid_init(self):
|
||||
for row in self.grid:
|
||||
for col in row:
|
||||
col = random.choice(['T', 'H', 'E'])
|
||||
|
||||
def display(self):
|
||||
print(self.grid)
|
||||
|
||||
|
||||
game = DungeonGame('rafay')
|
||||
game.display()
|
||||
27
.config/Code/User/History/-4c5a7b2f/b6pR.py
Normal file
27
.config/Code/User/History/-4c5a7b2f/b6pR.py
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
import random
|
||||
|
||||
class Player:
|
||||
def __init__(self, name: str) -> None:
|
||||
self.name = name
|
||||
self.score = 0
|
||||
self.health = 100
|
||||
self.x = 0
|
||||
self.y = 0
|
||||
|
||||
|
||||
class DungeonGame:
|
||||
def __init__(self) -> None:
|
||||
self.player = Player()
|
||||
self.grid = [[],[],[],[],[]]
|
||||
|
||||
def grid_init(self):
|
||||
for row in self.grid:
|
||||
for col in row:
|
||||
col = random.choice(['T', 'H', 'E'])
|
||||
|
||||
def display(self):
|
||||
print(self.grid)
|
||||
|
||||
|
||||
game = DungeonGame()
|
||||
game.display()
|
||||
0
.config/Code/User/History/-4c5a7b2f/bhmF.py
Normal file
0
.config/Code/User/History/-4c5a7b2f/bhmF.py
Normal file
54
.config/Code/User/History/-4c5a7b2f/brK9.py
Normal file
54
.config/Code/User/History/-4c5a7b2f/brK9.py
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
import random
|
||||
|
||||
class Player:
|
||||
def __init__(self, name: str) -> None:
|
||||
self.name = name
|
||||
self.score = 0
|
||||
self.health = 100
|
||||
self.x = 0
|
||||
self.y = 0
|
||||
|
||||
def move_player(self, direction: str) -> None:
|
||||
if direction == 'l':
|
||||
if self.x > 0:
|
||||
self.x -= 1
|
||||
elif direction == 'r':
|
||||
if self.x < 5:
|
||||
self.x += 1
|
||||
elif direction == 'u':
|
||||
if self.y > 0:
|
||||
self.y += 1
|
||||
elif direction == 'd':
|
||||
if self.y < 5:
|
||||
self.y -= 1
|
||||
|
||||
class DungeonGame:
|
||||
def __init__(self, name: str) -> None:
|
||||
self.player = Player(name)
|
||||
self.grid = [[],[],[],[],[]]
|
||||
self.grid_init()
|
||||
|
||||
def grid_init(self):
|
||||
for row in self.grid:
|
||||
for i in range(5):
|
||||
row.append(random.choice(['T', 'H', 'E']))
|
||||
self.grid[self.player.x][self.player.y] = '@'
|
||||
|
||||
def display(self):
|
||||
for row in self.grid:
|
||||
for col in row:
|
||||
print(col, end=' ')
|
||||
print()
|
||||
|
||||
def check_cell(self, x, y):
|
||||
if self.grid[x][y] == 'T':
|
||||
self.player.health -= 20
|
||||
print('the player hit a trap, ouuuch!!')
|
||||
elif self.grid[x][y] == 'H':
|
||||
self.player.health += 10
|
||||
print('the player got a health potion, nom nom')
|
||||
elif self.grid[x][y] == 'E':
|
||||
print('ooo nothing here')
|
||||
|
||||
|
||||
game = DungeonGame('rafay')
|
||||
53
.config/Code/User/History/-4c5a7b2f/ehJ4.py
Normal file
53
.config/Code/User/History/-4c5a7b2f/ehJ4.py
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
import random
|
||||
|
||||
class Player:
|
||||
def __init__(self, name: str) -> None:
|
||||
self.name = name
|
||||
self.score = 0
|
||||
self.health = 100
|
||||
self.x = 0
|
||||
self.y = 0
|
||||
|
||||
def move_player(self, direction: str) -> None:
|
||||
if direction == 'l':
|
||||
if self.x > 0:
|
||||
self.x -= 1
|
||||
elif direction == 'r':
|
||||
if self.x < 5:
|
||||
self.x += 1
|
||||
elif direction == 'u':
|
||||
if self.y > 0:
|
||||
self.y += 1
|
||||
elif direction == 'd':
|
||||
if self.y < 5:
|
||||
self.y -= 1
|
||||
|
||||
class DungeonGame:
|
||||
def __init__(self, name: str) -> None:
|
||||
self.player = Player(name)
|
||||
self.grid = [[],[],[],[],[]]
|
||||
self.grid_init()
|
||||
|
||||
def grid_init(self):
|
||||
for row in self.grid:
|
||||
for i in range(5):
|
||||
row.append(random.choice(['T', 'H', 'E']))
|
||||
self.grid[self.player.x][self.player.y] = '@'
|
||||
|
||||
def display(self):
|
||||
for row in self.grid:
|
||||
for col in row:
|
||||
print(col, end=' ')
|
||||
print()
|
||||
|
||||
def check_cell(self, x, y):
|
||||
if self.grid[x][y] == 'T':
|
||||
self.player.health -= 20
|
||||
print('the player hit a trap, ouuuch!!')
|
||||
elif self.grid[x][y] == 'H':
|
||||
self.player.health += 10
|
||||
print('the player got a health potion, nom nom')
|
||||
elif self.grid[x][y] == 'E':
|
||||
|
||||
|
||||
game = DungeonGame('rafay')
|
||||
1
.config/Code/User/History/-4c5a7b2f/entries.json
Normal file
1
.config/Code/User/History/-4c5a7b2f/entries.json
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":1,"resource":"file:///home/rafayahmad/Stuff/Coding/Python/IDS/Assg1/q4.py","entries":[{"id":"bhmF.py","source":"Create q4.py","timestamp":1725426932684},{"id":"sgko.py","timestamp":1725426949738},{"id":"Midg.py","timestamp":1725442035597},{"id":"grLX.py","timestamp":1725442055573},{"id":"02Qq.py","timestamp":1725445229868},{"id":"CYj1.py","timestamp":1725445303836},{"id":"IZaE.py","timestamp":1725445344068},{"id":"1EiM.py","timestamp":1725445366694},{"id":"gRyE.py","timestamp":1725445420356},{"id":"HMka.py","timestamp":1725445544145},{"id":"vyCf.py","timestamp":1725445571818},{"id":"afar.py","timestamp":1725445610024},{"id":"b6pR.py","timestamp":1725445623990},{"id":"kvT0.py","timestamp":1725445655966},{"id":"UY6X.py","timestamp":1725445673758},{"id":"siGO.py","timestamp":1725445689738},{"id":"A0Jx.py","timestamp":1725445777219},{"id":"IkBu.py","timestamp":1725445796468},{"id":"5ckz.py","timestamp":1725445821504},{"id":"KHtN.py","timestamp":1725445872829},{"id":"TiPK.py","timestamp":1725445923711},{"id":"EEDz.py","timestamp":1725445988556},{"id":"mm85.py","timestamp":1725446079963},{"id":"gDco.py","timestamp":1725446176957},{"id":"Q6EG.py","timestamp":1725446250212},{"id":"OWFK.py","timestamp":1725446293388},{"id":"ehJ4.py","timestamp":1725446466690},{"id":"brK9.py","timestamp":1725446479597},{"id":"IfDX.py","timestamp":1725446506908},{"id":"Mdp9.py","timestamp":1725446518002},{"id":"u6RW.py","timestamp":1725446558499},{"id":"YSe7.py","timestamp":1725446582883},{"id":"t9xB.py","timestamp":1725446615504},{"id":"Lf86.py","timestamp":1725446644615},{"id":"9zhQ.py","timestamp":1725453890639},{"id":"0h80.py","timestamp":1725453970462},{"id":"grhQ.py","timestamp":1725453993892},{"id":"obSq.py","timestamp":1725454046382},{"id":"1P6H.py","timestamp":1725454076348},{"id":"8EzY.py","timestamp":1725454122481},{"id":"qf9V.py","timestamp":1725454161854},{"id":"zQMR.py","timestamp":1725454186860}]}
|
||||
41
.config/Code/User/History/-4c5a7b2f/gDco.py
Normal file
41
.config/Code/User/History/-4c5a7b2f/gDco.py
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
import random
|
||||
|
||||
class Player:
|
||||
def __init__(self, name: str) -> None:
|
||||
self.name = name
|
||||
self.score = 0
|
||||
self.health = 100
|
||||
self.x = 0
|
||||
self.y = 0
|
||||
|
||||
def move_player(self, direction: str) -> None:
|
||||
if direction == 'l':
|
||||
if self.x > 0:
|
||||
self.x -= 1
|
||||
elif direction == 'r':
|
||||
if self.x < 5:
|
||||
self.x += 1
|
||||
|
||||
|
||||
class DungeonGame:
|
||||
def __init__(self, name: str) -> None:
|
||||
self.player = Player(name)
|
||||
self.grid = [[],[],[],[],[]]
|
||||
self.grid_init()
|
||||
|
||||
def grid_init(self):
|
||||
for row in self.grid:
|
||||
for i in range(5):
|
||||
row.append(random.choice(['T', 'H', 'E']))
|
||||
self.grid[self.player.x][self.player.y] = '@'
|
||||
|
||||
def display(self):
|
||||
for row in self.grid:
|
||||
for col in row:
|
||||
print(col, end=' ')
|
||||
print()
|
||||
|
||||
game = DungeonGame('rafay')
|
||||
|
||||
while not game_over:
|
||||
a = input('enter a direction to move the player: ')
|
||||
22
.config/Code/User/History/-4c5a7b2f/gRyE.py
Normal file
22
.config/Code/User/History/-4c5a7b2f/gRyE.py
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
import random
|
||||
|
||||
class Player:
|
||||
def __init__(self, name) -> None:
|
||||
self.name = name
|
||||
self.score = 0
|
||||
self.health = 100
|
||||
self.x = 0
|
||||
self.y = 0
|
||||
|
||||
|
||||
class DungeonGame:
|
||||
def __init__(self) -> None:
|
||||
self.player = Player()
|
||||
self.grid = [[],[],[],[],[]]
|
||||
|
||||
def grid_init(self):
|
||||
for row in self.grid:
|
||||
for col in row:
|
||||
col = random.choice(['T', 'H', 'E'])
|
||||
|
||||
|
||||
10
.config/Code/User/History/-4c5a7b2f/grLX.py
Normal file
10
.config/Code/User/History/-4c5a7b2f/grLX.py
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
class Player:
|
||||
def __init__(self) -> None:
|
||||
self.health = 100
|
||||
self.x = 0
|
||||
self.y = 0
|
||||
|
||||
|
||||
class DungeonGame:
|
||||
def __init__(self) -> None:
|
||||
self.player = Player()
|
||||
62
.config/Code/User/History/-4c5a7b2f/grhQ.py
Normal file
62
.config/Code/User/History/-4c5a7b2f/grhQ.py
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
import random
|
||||
|
||||
class Player:
|
||||
def __init__(self, name: str) -> None:
|
||||
self.name = name
|
||||
self.score = 0
|
||||
self.health = 100
|
||||
self.x = 0
|
||||
self.y = 0
|
||||
|
||||
def move_player(self, direction: str) -> None:
|
||||
if direction == 'l':
|
||||
if self.x > 0:
|
||||
self.x -= 1
|
||||
elif direction == 'r':
|
||||
if self.x < 5:
|
||||
self.x += 1
|
||||
elif direction == 'u':
|
||||
if self.y > 0:
|
||||
self.y += 1
|
||||
elif direction == 'd':
|
||||
if self.y < 5:
|
||||
self.y -= 1
|
||||
|
||||
class DungeonGame:
|
||||
def __init__(self, name: str) -> None:
|
||||
self.player = Player(name)
|
||||
self.grid = [[],[],[],[],[]]
|
||||
self.game_over = False
|
||||
self.grid_init()
|
||||
|
||||
def grid_init(self) -> None:
|
||||
for row in self.grid:
|
||||
for i in range(5):
|
||||
row.append(random.choice(['T', 'H', 'E']))
|
||||
self.grid[self.player.x][self.player.y] = '@'
|
||||
|
||||
# def display(self):
|
||||
# for row in self.grid:
|
||||
# for col in row:
|
||||
# print(col, end=' ')
|
||||
# print()
|
||||
|
||||
def check_cell(self, x: int, y: int) -> None:
|
||||
if self.grid[x][y] == 'T':
|
||||
self.player.health -= 20
|
||||
print('the player hit a trap, ouuuch!!')
|
||||
elif self.grid[x][y] == 'H':
|
||||
self.player.health += 10
|
||||
print('the player got a health potion, nom nom')
|
||||
elif self.grid[x][y] == 'E':
|
||||
print('ooo nothing here')
|
||||
|
||||
def play_turn(self):
|
||||
a = input('enter a character to move the player(l, r, u, d): ')
|
||||
self.player.move_player(a)
|
||||
self.check_cell(self.player.x, self.player.y)
|
||||
|
||||
game = DungeonGame('rafay')
|
||||
|
||||
while not game_over:
|
||||
game.play_turn()
|
||||
27
.config/Code/User/History/-4c5a7b2f/kvT0.py
Normal file
27
.config/Code/User/History/-4c5a7b2f/kvT0.py
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
import random
|
||||
|
||||
class Player:
|
||||
def __init__(self, name: str) -> None:
|
||||
self.name = name
|
||||
self.score = 0
|
||||
self.health = 100
|
||||
self.x = 0
|
||||
self.y = 0
|
||||
|
||||
|
||||
class DungeonGame:
|
||||
def __init__(self, name: str) -> None:
|
||||
self.player = Player(name)
|
||||
self.grid = [[],[],[],[],[]]
|
||||
|
||||
def grid_init(self):
|
||||
for row in self.grid:
|
||||
for col in row:
|
||||
col = random.choice(['T', 'H', 'E'])
|
||||
|
||||
def display(self):
|
||||
print(self.grid)
|
||||
|
||||
|
||||
game = DungeonGame('rafay')
|
||||
game.display()
|
||||
33
.config/Code/User/History/-4c5a7b2f/mm85.py
Normal file
33
.config/Code/User/History/-4c5a7b2f/mm85.py
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
import random
|
||||
|
||||
class Player:
|
||||
def __init__(self, name: str) -> None:
|
||||
self.name = name
|
||||
self.score = 0
|
||||
self.health = 100
|
||||
self.x = 0
|
||||
self.y = 0
|
||||
|
||||
|
||||
class DungeonGame:
|
||||
def __init__(self, name: str) -> None:
|
||||
self.player = Player(name)
|
||||
self.grid = [[],[],[],[],[]]
|
||||
self.grid_init()
|
||||
|
||||
def grid_init(self):
|
||||
for row in self.grid:
|
||||
for i in range(5):
|
||||
row.append(random.choice(['T', 'H', 'E']))
|
||||
self.grid[self.player.x][self.player.y] = '@'
|
||||
|
||||
def display(self):
|
||||
for row in self.grid:
|
||||
for col in row:
|
||||
print(col, end=' ')
|
||||
print()
|
||||
|
||||
game = DungeonGame('rafay')
|
||||
|
||||
while not game_over:
|
||||
a = input('enter a direction to move the player: ')
|
||||
65
.config/Code/User/History/-4c5a7b2f/obSq.py
Normal file
65
.config/Code/User/History/-4c5a7b2f/obSq.py
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
import random
|
||||
|
||||
class Player:
|
||||
def __init__(self, name: str) -> None:
|
||||
self.name = name
|
||||
self.score = 0
|
||||
self.health = 100
|
||||
self.x = 0
|
||||
self.y = 0
|
||||
|
||||
def move_player(self, direction: str) -> None:
|
||||
if direction == 'l':
|
||||
if self.x > 0:
|
||||
self.x -= 1
|
||||
elif direction == 'r':
|
||||
if self.x < 5:
|
||||
self.x += 1
|
||||
elif direction == 'u':
|
||||
if self.y > 0:
|
||||
self.y += 1
|
||||
elif direction == 'd':
|
||||
if self.y < 5:
|
||||
self.y -= 1
|
||||
|
||||
class DungeonGame:
|
||||
def __init__(self, name: str) -> None:
|
||||
self.player = Player(name)
|
||||
self.grid = [[],[],[],[],[]]
|
||||
self.game_over = False
|
||||
self.grid_init()
|
||||
|
||||
def grid_init(self) -> None:
|
||||
for row in self.grid:
|
||||
for i in range(5):
|
||||
row.append(random.choice(['T', 'H', 'E']))
|
||||
self.grid[self.player.x][self.player.y] = '@'
|
||||
|
||||
# def display(self):
|
||||
# for row in self.grid:
|
||||
# for col in row:
|
||||
# print(col, end=' ')
|
||||
# print()
|
||||
|
||||
def check_cell(self, x: int, y: int) -> None:
|
||||
if self.grid[x][y] == 'T':
|
||||
self.player.health -= 20
|
||||
print('the player hit a trap, ouuuch!!')
|
||||
if self.player.health <= 0:
|
||||
self.game_over = True
|
||||
print('aaaaa my health, i die -- game over')
|
||||
elif self.grid[x][y] == 'H':
|
||||
self.player.health += 10
|
||||
print('the player got a health potion, nom nom')
|
||||
elif self.grid[x][y] == 'E':
|
||||
print('ooo nothing here')
|
||||
|
||||
def play_turn(self):
|
||||
a = input('enter a character to move the player(l, r, u, d): ')
|
||||
self.player.move_player(a)
|
||||
self.check_cell(self.player.x, self.player.y)
|
||||
|
||||
game = DungeonGame('rafay')
|
||||
|
||||
while not game_over:
|
||||
game.play_turn()
|
||||
67
.config/Code/User/History/-4c5a7b2f/qf9V.py
Normal file
67
.config/Code/User/History/-4c5a7b2f/qf9V.py
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
import random
|
||||
|
||||
class Player:
|
||||
def __init__(self, name: str) -> None:
|
||||
self.name = name
|
||||
self.score = 0
|
||||
self.health = 100
|
||||
self.x = 0
|
||||
self.y = 0
|
||||
|
||||
def move_player(self, direction: str) -> None:
|
||||
if direction == 'l':
|
||||
if self.x > 0:
|
||||
self.x -= 1
|
||||
elif direction == 'r':
|
||||
if self.x < 4:
|
||||
self.x += 1
|
||||
elif direction == 'u':
|
||||
if self.y > 0:
|
||||
self.y += 1
|
||||
elif direction == 'd':
|
||||
if self.y < 4:
|
||||
self.y -= 1
|
||||
|
||||
class DungeonGame:
|
||||
def __init__(self, name: str) -> None:
|
||||
self.player = Player(name)
|
||||
self.grid = [[],[],[],[],[]]
|
||||
self.game_over = False
|
||||
self.grid_init()
|
||||
|
||||
def grid_init(self) -> None:
|
||||
for row in self.grid:
|
||||
for i in range(5):
|
||||
row.append(random.choice(['T', 'H', 'E']))
|
||||
self.grid[self.player.x][self.player.y] = '@'
|
||||
|
||||
# def display(self):
|
||||
# for row in self.grid:
|
||||
# for col in row:
|
||||
# print(col, end=' ')
|
||||
# print()
|
||||
|
||||
def check_cell(self, x: int, y: int) -> None:
|
||||
if self.grid[x][y] == 'T':
|
||||
self.player.health -= 20
|
||||
print('the player hit a trap, ouuuch!!')
|
||||
if self.player.health <= 0:
|
||||
self.game_over = True
|
||||
print('aaaaa my health, i die -- game over')
|
||||
elif self.grid[x][y] == 'H':
|
||||
if self.player.health < 100:
|
||||
self.player.health += 10
|
||||
print('the player got a health potion, nom nom')
|
||||
elif self.grid[x][y] == 'E':
|
||||
print('ooo nothing here')
|
||||
|
||||
def play_turn(self):
|
||||
a = input('enter a character to move the player(l, r, u, d): ')
|
||||
self.player.move_player(a)
|
||||
self.check_cell(self.player.x, self.player.y)
|
||||
print('current player health: ', self.player.health)
|
||||
|
||||
game = DungeonGame('rafay')
|
||||
|
||||
while not game.game_over:
|
||||
game.play_turn()
|
||||
3
.config/Code/User/History/-4c5a7b2f/sgko.py
Normal file
3
.config/Code/User/History/-4c5a7b2f/sgko.py
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
class DungeonGame:
|
||||
def __init__(self) -> None:
|
||||
pass
|
||||
28
.config/Code/User/History/-4c5a7b2f/siGO.py
Normal file
28
.config/Code/User/History/-4c5a7b2f/siGO.py
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
import random
|
||||
|
||||
class Player:
|
||||
def __init__(self, name: str) -> None:
|
||||
self.name = name
|
||||
self.score = 0
|
||||
self.health = 100
|
||||
self.x = 0
|
||||
self.y = 0
|
||||
|
||||
|
||||
class DungeonGame:
|
||||
def __init__(self, name: str) -> None:
|
||||
self.player = Player(name)
|
||||
self.grid = [[],[],[],[],[]]
|
||||
self.grid_init()
|
||||
|
||||
def grid_init(self):
|
||||
for row in self.grid:
|
||||
for col in row:
|
||||
col = random.choice(['T', 'H', 'E'])
|
||||
|
||||
def display(self):
|
||||
for row in self.grid:
|
||||
print(row)
|
||||
|
||||
game = DungeonGame('rafay')
|
||||
game.display()
|
||||
56
.config/Code/User/History/-4c5a7b2f/t9xB.py
Normal file
56
.config/Code/User/History/-4c5a7b2f/t9xB.py
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
import random
|
||||
|
||||
class Player:
|
||||
def __init__(self, name: str) -> None:
|
||||
self.name = name
|
||||
self.score = 0
|
||||
self.health = 100
|
||||
self.x = 0
|
||||
self.y = 0
|
||||
|
||||
def move_player(self, direction: str) -> None:
|
||||
if direction == 'l':
|
||||
if self.x > 0:
|
||||
self.x -= 1
|
||||
elif direction == 'r':
|
||||
if self.x < 5:
|
||||
self.x += 1
|
||||
elif direction == 'u':
|
||||
if self.y > 0:
|
||||
self.y += 1
|
||||
elif direction == 'd':
|
||||
if self.y < 5:
|
||||
self.y -= 1
|
||||
|
||||
class DungeonGame:
|
||||
def __init__(self, name: str) -> None:
|
||||
self.player = Player(name)
|
||||
self.grid = [[],[],[],[],[]]
|
||||
self.grid_init()
|
||||
|
||||
def grid_init(self) -> None:
|
||||
for row in self.grid:
|
||||
for i in range(5):
|
||||
row.append(random.choice(['T', 'H', 'E']))
|
||||
self.grid[self.player.x][self.player.y] = '@'
|
||||
|
||||
# def display(self):
|
||||
# for row in self.grid:
|
||||
# for col in row:
|
||||
# print(col, end=' ')
|
||||
# print()
|
||||
|
||||
def check_cell(self, x: int, y: int) -> None:
|
||||
if self.grid[x][y] == 'T':
|
||||
self.player.health -= 20
|
||||
print('the player hit a trap, ouuuch!!')
|
||||
elif self.grid[x][y] == 'H':
|
||||
self.player.health += 10
|
||||
print('the player got a health potion, nom nom')
|
||||
elif self.grid[x][y] == 'E':
|
||||
print('ooo nothing here')
|
||||
|
||||
def play_turn():
|
||||
a = input('enter a character to move the player(l, r, u, d): ')
|
||||
|
||||
game = DungeonGame('rafay')
|
||||
57
.config/Code/User/History/-4c5a7b2f/u6RW.py
Normal file
57
.config/Code/User/History/-4c5a7b2f/u6RW.py
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
import random
|
||||
|
||||
class Player:
|
||||
def __init__(self, name: str) -> None:
|
||||
self.name = name
|
||||
self.score = 0
|
||||
self.health = 100
|
||||
self.x = 0
|
||||
self.y = 0
|
||||
|
||||
def move_player(self, direction: str) -> None:
|
||||
if direction == 'l':
|
||||
if self.x > 0:
|
||||
self.x -= 1
|
||||
elif direction == 'r':
|
||||
if self.x < 5:
|
||||
self.x += 1
|
||||
elif direction == 'u':
|
||||
if self.y > 0:
|
||||
self.y += 1
|
||||
elif direction == 'd':
|
||||
if self.y < 5:
|
||||
self.y -= 1
|
||||
|
||||
class DungeonGame:
|
||||
def __init__(self, name: str) -> None:
|
||||
self.player = Player(name)
|
||||
self.grid = [[],[],[],[],[]]
|
||||
self.grid_init()
|
||||
|
||||
def grid_init(self) -> None:
|
||||
for row in self.grid:
|
||||
for i in range(5):
|
||||
row.append(random.choice(['T', 'H', 'E']))
|
||||
self.grid[self.player.x][self.player.y] = '@'
|
||||
|
||||
# def display(self):
|
||||
# for row in self.grid:
|
||||
# for col in row:
|
||||
# print(col, end=' ')
|
||||
# print()
|
||||
|
||||
def check_cell(self, x: int, y: int) -> None:
|
||||
if self.grid[x][y] == 'T':
|
||||
self.player.health -= 20
|
||||
print('the player hit a trap, ouuuch!!')
|
||||
elif self.grid[x][y] == 'H':
|
||||
self.player.health += 10
|
||||
print('the player got a health potion, nom nom')
|
||||
elif self.grid[x][y] == 'E':
|
||||
print('ooo nothing here')
|
||||
|
||||
def play_turn():
|
||||
a = input('enter a character to move the player')
|
||||
|
||||
|
||||
game = DungeonGame('rafay')
|
||||
27
.config/Code/User/History/-4c5a7b2f/vyCf.py
Normal file
27
.config/Code/User/History/-4c5a7b2f/vyCf.py
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
import random
|
||||
|
||||
class Player:
|
||||
def __init__(self, name) -> None:
|
||||
self.name = name
|
||||
self.score = 0
|
||||
self.health = 100
|
||||
self.x = 0
|
||||
self.y = 0
|
||||
|
||||
|
||||
class DungeonGame:
|
||||
def __init__(self) -> None:
|
||||
self.player = Player()
|
||||
self.grid = [[],[],[],[],[]]
|
||||
|
||||
def grid_init(self):
|
||||
for row in self.grid:
|
||||
for col in row:
|
||||
col = random.choice(['T', 'H', 'E'])
|
||||
|
||||
def display(self):
|
||||
print(self.grid)
|
||||
|
||||
|
||||
game = DungeonGame('rafay')
|
||||
game.display()
|
||||
67
.config/Code/User/History/-4c5a7b2f/zQMR.py
Normal file
67
.config/Code/User/History/-4c5a7b2f/zQMR.py
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
import random
|
||||
|
||||
class Player:
|
||||
def __init__(self, name: str) -> None:
|
||||
self.name = name
|
||||
self.score = 0
|
||||
self.health = 100
|
||||
self.x = 0
|
||||
self.y = 0
|
||||
|
||||
def move_player(self, direction: str) -> None:
|
||||
if direction == 'l':
|
||||
if self.x > 0:
|
||||
self.x -= 1
|
||||
elif direction == 'r':
|
||||
if self.x < 4:
|
||||
self.x += 1
|
||||
elif direction == 'u':
|
||||
if self.y > 0:
|
||||
self.y += 1
|
||||
elif direction == 'd':
|
||||
if self.y < 4:
|
||||
self.y -= 1
|
||||
|
||||
class DungeonGame:
|
||||
def __init__(self, name: str) -> None:
|
||||
self.player = Player(name)
|
||||
self.grid = [[],[],[],[],[]]
|
||||
self.game_over = False
|
||||
self.grid_init()
|
||||
|
||||
def grid_init(self) -> None:
|
||||
for row in self.grid:
|
||||
for i in range(5):
|
||||
row.append(random.choice(['T', 'H', 'E']))
|
||||
self.grid[self.player.x][self.player.y] = '@'
|
||||
|
||||
# def display(self):
|
||||
# for row in self.grid:
|
||||
# for col in row:
|
||||
# print(col, end=' ')
|
||||
# print()
|
||||
|
||||
def check_cell(self, x: int, y: int) -> None:
|
||||
if self.grid[x][y] == 'T':
|
||||
self.player.health -= 20
|
||||
print('the player hit a trap, ouuuch!!')
|
||||
if self.player.health <= 0:
|
||||
self.game_over = True
|
||||
print('aaaaa my health, i die -- game over')
|
||||
elif self.grid[x][y] == 'H':
|
||||
if self.player.health < 100:
|
||||
self.player.health += 10
|
||||
print('the player got a health potion, nom nom')
|
||||
elif self.grid[x][y] == 'E':
|
||||
print('ooo nothing here')
|
||||
|
||||
def play_turn(self):
|
||||
a = input('enter a character to move the player(l, r, u, d): ')
|
||||
self.player.move_player(a)
|
||||
self.check_cell(self.player.x, self.player.y)
|
||||
print('current player health: ', self.player.health)
|
||||
|
||||
|
||||
game = DungeonGame('rafay')
|
||||
while not game.game_over:
|
||||
game.play_turn()
|
||||
Loading…
Add table
Add a link
Reference in a new issue