| Welcome, Guest |
You have to register before you can post on our site.
|
| Forum Statistics |
» Members: 7,727
» Latest member: Samuelo
» Forum threads: 9,426
» Forum posts: 62,203
Full Statistics
|
| Online Users |
There are currently 1955 online users. » 0 Member(s) | 1951 Guest(s) Applebot, Baidu, Bing, Google
|
|
|
| Mega Mech |
|
Posted by: austin.payne - 08-07-2015, 05:27 AM - Forum: Scripting and Bash
- Replies (4)
|
 |
Here is a little game I made in Python. It is quite glitchy, and it is entirely text based, but it is still a little fun. It should also be really easy to mod.
Code: import math
import random
board = []
class Weapon(object):
def __init__(self, Range, Damage, Ammo, Name):
self.Range = Range
self.Damage = Damage
self.Ammo = Ammo
self.Name = Name
def __repr__(self):
return str(self.Range) + " " + str(self.Damage) + " " + str(self.Ammo)
class Armor(object):
def __init__(self, HP, Name):
self.Name = Name
self.HP = HP
def __repr__(self):
return str(self.HP)
class Enemy(object):
def __init__(self, Weapons, Armor, Movement, x, y, Number):
self.Weapons = Weapons
self.Armor = Armor
self.Movement = Movement
self.x = x
self.y = y
self.Number = Number
def __repr__(self):
return str(self.Weapons) + " " + str(self.Armor) + " " + str(self.Movement)
class Character(object):
def __init__(self, Weapons, Armor, Movement, x, y, Money, CampaignLevel, Level, XP):
self.Weapons = Weapons
self.Armor = Armor
self.Movement = Movement
self.x = x
self.y = y
self.Money = Money
self.CampaignLevel = CampaignLevel
self.XP = XP
self.Level = Level
def __repr__(self):
return str(self.Weapons) + " " + str(self.Armor) + " " + str(self.Movement)
MyCharacter = Character([], [], 0, 0, 0, 1000, 1, 0, 0)
def Shop():
print("You have $" + str(MyCharacter.Money))
print("Your Level is " + str(MyCharacter.Level))
print("~~~~~~~~~~~~~~~~~~Shop~~~~~~~~~~~~~~~~~~")
print("~~~~~~~~~~~~~~~~~~Armor~~~~~~~~~~~~~~~~~")
print("Name---------------HP--------------Price")
print("Tin 50 200")
print("Bronze 100 500")
print("~~~~~~~~~~~~~~~~~Weapons~~~~~~~~~~~~~~~~")
print("Name----Damage----Ammo----Range----Price")
print("Sword 5 inf 0 200")
print("Gun 5 10 3 500")
print("~~~~~~~~~~~Personal~Upgrades~~~~~~~~~~~~")
print("Name------------------------------Effect")
print("Walk speed +1")
choice = raw_input("Which one do you want?(Type the name, or say 'Cancel'.) ")
if choice == "Tin" and MyCharacter.Money >= 200 and len(MyCharacter.Armor) + 1 <= float(MyCharacter.Level+1)/3 + 1:
MyCharacter.Money -= 200
MyCharacter.Armor.append(Armor(50, "Tin"))
elif choice == "Bronze" and MyCharacter.Money >= 500 and len(MyCharacter.Armor) + 1 <= float(MyCharacter.Level+1)/3 + 1:
MyCharacter.Money -= 500
MyCharacter.Armor.append(Armor(100, "Bronze"))
elif choice == "Sword" and MyCharacter.Money >= 200 and len(MyCharacter.Weapons) + 1 <= float(MyCharacter.Level+1)/3 + 1:
MyCharacter.Money -= 200
MyCharacter.Weapons.append(Weapon(0, 5, float('inf'), "Sword"))
elif choice == "Gun" and MyCharacter.Money >= 500 and len(MyCharacter.Weapons) + 1 <= float(MyCharacter.Level+1)/3 + 1:
MyCharacter.Money -= 500
MyCharacter.Weapons.append(Weapon(3, 5, 10, "Gun"))
elif choice == "Walk speed" and MyCharacter.Money >= 200:
MyCharacter.Money -= 200
MyCharacter.Movement = MyCharacter.Movement + 1
elif choice == "Cancel":
Selling = raw_input("Sell or next level? ")
if Selling == "Sell":
sell()
return
elif choice != "Cancel":
print("Sorry I didn't catch that.")
Shop()
return
def Mores():
More = raw_input("Would you like to buy more?(Yes/No) ")
if More == "Yes":
Shop()
elif More == "No":
Selling = raw_input("Sell or next level? ")
if Selling == "Sell":
sell()
return
elif Selling != "next level":
print("Sorry I dodn't catch that.")
Mores()
else:
print("Sorry I didn't catch that. ")
Mores()
Mores()
def sell():
for Armor in MyCharacter.Armor:
print(Armor.Name)
for Weapon in MyCharacter.Weapons:
print(Weapon.Name)
print("Walk speed (" + str(MyCharacter.Movement) + ")")
Choice = raw_input("Which one do you want to sell?(Name of item) ")
NewList = []
AOW = len(MyCharacter.Weapons)
AOA = len(MyCharacter.Armor)
WS = MyCharacter.Movement
Number = 1
for Armor in range(len(MyCharacter.Armor)):
if Choice == MyCharacter.Armor[Armor].Name and Number == 1:
Number = 2
if Choice == "Tin":
MyCharacter.Money += 200
print("Tin")
elif MyCharacter.Armor[Armor].Name == "Bronze":
MyCharacter.Money += 500
print("Bronze")
else:
print("Glitch")
else:
NewList.append(MyCharacter.Armor[Armor])
MyCharacter.Armor = NewList
NewList = []
for Weapon in range(len(MyCharacter.Weapons)):
if Choice == MyCharacter.Weapons[Weapon].Name and Number == 1:
Number = 2
if Choice == "Sword":
MyCharacter.Money += 200
elif Choice == "Gun":
MyCharacter.Money += 500
else:
NewList.append(MyCharacter.Weapons[Weapon])
MyCharacter.Weapons = NewList
if Choice == "Walk speed" and MyCharacter.Movement > 0:
MyCharacter.Movement -= 1
MyCharacter.Money += 200
if AOW != len(MyCharacter.Weapons) or AOA != len(MyCharacter.Armor) or WS != MyCharacter.Movement:
Answere = raw_input("Do you want to sell more?(Yes/No)")
if Answere == "Yes":
sell()
else:
Answere2 = raw_input("Shop or next level? ")
if Answere2 == "Shop":
Shop()
return
elif not Sold:
print("I didn't quite catch that")
sell()
def Shopping():
choice = raw_input("Shop, Sell, or next level? ")
if choice == "Shop":
Shop()
elif choice == "Sell":
Sell()
elif choice != "next level":
print("Sorry I didn't catch that.")
Shopping()
Shopping()
return
Shop()
def IsInt(s):
try:
int(s)
return True
except ValueError:
return False
def Move_Enemy(Enemy):
board[int(Enemy.y)][int(Enemy.x)] = "-"
distancex = int(MyCharacter.x) - int(Enemy.x)
if distancex < 0:
distancex = distancex * -1
distancey = int(MyCharacter.y) - int(Enemy.y)
if distancey < 0:
distancey = distancey * -1
distance = distancex
if distance < distancey:
distance = distancey
if distance <= Enemy.Movement:
Enemy.y = MyCharacter.y
Enemy.x = MyCharacter.x
else:
if int(MyCharacter.x) > int(Enemy.x):
Enemy.x = Enemy.x + Enemy.Movement
if int(MyCharacter.y) > int(Enemy.y):
Enemy.y = Enemy.y + Enemy.Movement
if int(MyCharacter.x) < int(Enemy.x):
Enemy.x = Enemy.x - Enemy.Movement
if int(MyCharacter.y) < int(Enemy.y):
Enemy.y = Enemy.y - Enemy.Movement
def print_board(board):
for row in board:
print(" ".join(row))
for x in range(10):
board.append(["-"] * 10)
def Level(Enemies, Money, XP1):
for x in board:
for y in x:
y = "-"
MyCharacter.x = 0
MyCharacter.y = 0
print("Your Level is " + str(MyCharacter.Level))
for Enemy in Enemies:
board[Enemy.y][Enemy.x] = str(Enemies[Enemy.Number].Number)
board[int(MyCharacter.y)][int(MyCharacter.x)] = "X"
print_board(board)
print("")
EnemiesDestroyed = 0
def attack(EnemiesDestroyed):
NumberOfEnemies = len(Enemies)
answere = raw_input("Would you like to attack?(Yes/No) ")
if answere == "Yes":
print("Choose your weapon. ")
for Weapon in MyCharacter.Weapons:
print(Weapon.Name)
Weapon = raw_input("(Weapon name) ")
print("Choose an enemy.")
for Enemy in Enemies:
if Enemy.Armor[len(Enemy.Armor) - 1]:
print(Enemy.Number)
Enemy = raw_input("(Name of enemy)" )
if IsInt(Enemy) and int(Enemy) <= len(Enemies)-1:
Enemy = Enemies[int(Enemy)]
else:
print("Sorry I didn't catcth that")
attack(EnemiesDestroyed)
return EnemiesDestroyed
distancex = int(MyCharacter.x) - int(Enemy.x)
if distancex < 0:
distancex = distancex * -1
distancey = int(MyCharacter.y) - int(Enemy.y)
if distancey < 0:
distancey = distancey * -1
distance = distancex
if distance < distancey:
distance = distancey
Number = 1
for Thing in MyCharacter.Weapons:
if Thing.Name == Weapon:
if Thing.Range >= distance and Thing.Ammo >= 1:
print("Test")
for Armor in Enemy.Armor:
print("Test2")
if Armor.HP > 0:
print("Test3")
ArmorUsing = Armor
break
else:
print("That enemy is already dead.")
attack(EnemiesDestroyed)
return EnemiesDestroyed
Damage = float(Thing.Damage) * float(random.randint(9, 11))/float(10) * (float(MyCharacter.Level)/float(10) + float(1))
ArmorUsing.HP = float(ArmorUsing.HP) - float(Damage)
print("You did " + str(Damage) + " damage.")
Thing.Ammo -= 1
if ArmorUsing.HP <= 0:
for Armor in Enemy.Armor:
if Armor.HP > 0:
Armor.HP = Armor.HP + ArmorUsing.HP
ArmorUsing.HP = 0
break
else:
EnemiesDestroyed += 1
print("EnemiesDestroyed: " + str(EnemiesDestroyed))
if EnemiesDestroyed == NumberOfEnemies:
return "Game Over"
elif Number == len(MyCharacter.Weapons):
print("Sorry I didn't catch that.")
attack(EnemiesDestroyed)
Number += 1
elif answere != "No":
print("Sorry I didn't catch that")
attack(EnemiesDestroyed)
return EnemiesDestroyed
def Inputs():
board[int(MyCharacter.y)][int(MyCharacter.x)] = "-"
x = raw_input("X: ")
y = raw_input("Y: ")
if IsInt(x) and IsInt(y):
distancex = int(MyCharacter.x) - (int(x) - 1)
else:
print("Sorry I didn't quite catch that.")
Inputs()
return
if distancex - 1 < 0:
distancex = (distancex * -1)
distancey = int(MyCharacter.y) - (int(y) - 1)
if distancey - 1 < 0:
distancey = distancey * -1
distance = distancex
if distance < distancey:
distance = distancey
if distance <= MyCharacter.Movement:
MyCharacter.x = str(int(x) - 1)
MyCharacter.y = str(int(y) - 1)
else:
print("Sorry that's to far away.")
Inputs()
def AIAttack(Enemy):
PosWeps = []
WeaponToBeUsed = ""
distancex = int(MyCharacter.x) - int(Enemy.x)
if distancex < 0:
distancex = distancex * -1
distancey = int(MyCharacter.y) - int(Enemy.y)
if distancey < 0:
distancey = distancey * -1
distance = distancex
if distance < distancey:
distance = distancey
for Weapon in Enemy.Weapons:
if Weapon.Range >= distance and Weapon.Ammo >= 1:
PosWeps.append(Weapon)
HighestDamage = 0
for Weapon in PosWeps:
if Weapon.Damage > HighestDamage:
WeaponToBeUsed = Weapon
HighestDamage = Weapon.Damage
if WeaponToBeUsed != "":
for Armor in MyCharacter.Armor:
if Armor.HP > 0:
WeaponToBeUsed.Ammo -= 1
ArmorUsing = Armor
ArmorUsing.HP = ArmorUsing.HP - WeaponToBeUsed.Damage * float(random.randint(9, 11))/10/(float(MyCharacter.Level)/10 + 1)
TotalHP = 0
for Armor in MyCharacter.Armor:
TotalHP += Armor.HP
print("My health: " + str(TotalHP))
break
while True:
for x in range(10):
for y in range(10):
board[y][x] = "-"
if MyCharacter.Armor[len(MyCharacter.Armor) - 1].HP <= 0:
print("You Loose.")
MyCharacter.Money = 1000
MyCharacter.CampaignLevel = 1
MyCharacter.Armor = []
MyCharacter.Weapons = []
MyCharacter.Movement = 0
Shop()
return
Inputs()
attacking = attack(int(EnemiesDestroyed))
if attacking == "Game Over":
print("You win!")
MyCharacter.XP += XP1
if MyCharacter.XP >= 100 * (MyCharacter.Level + 1):
MyCharacter.XP -= 100 * (MyCharacter.Level + 1)
MyCharacter.Level += 1
MyCharacter.Money += Money
MyCharacter.CampaignLevel += 1
break
else:
EnemiesDestroyed = attacking
for Enemy in Enemies:
for Armor in Enemy.Armor:
if Armor.HP > 0:
ArmorUsing = Armor
Move_Enemy(Enemy)
AI = AIAttack(Enemy)
board[int(Enemy.y)][int(Enemy.x)] = str(Enemies[int(Enemy.Number)].Number)
break
if MyCharacter.Armor[len(MyCharacter.Armor) - 1].HP <= 0:
print("You Loose.")
MyCharacter.Money = 1000
MyCharacter.CampaignLevel = 1
MyCharacter.Armor = []
MyCharacter.Weapons = []
MyCharacter.Movement = 0
Shop()
return
board[int(MyCharacter.y)][int(MyCharacter.x)] = "X"
print_board(board)
print("")
MyCharacter.x = 0
MyCharacter.y = 0
for Armor in MyCharacter.Armor:
if Armor.Name == "Tin":
Armor.HP = 50
elif Armor.Name == "Bronze":
Armor.HP = 100
def Shopping():
choice = raw_input("Shop, Sell, or next level? ")
if choice == "Shop":
Shop()
elif choice == "Sell":
sell()
elif choice != "next level":
print("Sorry I didn't catch that.")
Shopping()
Shopping()
while True:
if MyCharacter.CampaignLevel == 1:
Level([Enemy([Weapon(0, 5, float('inf'), "Sword")], [Armor(50, "Tin")], 1, 9, 9, 0)], 100, 100)
elif MyCharacter.CampaignLevel == 2:
Level([Enemy([Weapon(0, 5, float('inf'), "Sword")], [Armor(50, "Tin")], 1, 9, 0, 0), Enemy([Weapon(0, 5, float('inf'), "Sword")], [Armor(50, "Tin")], 1, 0, 9, 1)], 300, 300)
elif MyCharacter.CampaignLevel == 3:
Level([Enemy([Weapon(0, 5, float('inf'), "Sword")], [Armor(50, "Tin")], 1, 9, 0, 0), Enemy([Weapon(0, 5, float('inf'), "Sword")], [Armor(50, "Tin")], 1, 0, 9, 1), Enemy([Weapon(0, 5, float('inf'), "Sword"), Weapon(3, 5, 10, "Gun")], [Armor(100, "Bronze")], 2, 9, 9, 2)], 500, 500)
elif MyCharacter.CampaignLevel == 4:
Level([Enemy([Weapon(0, 5, float('inf'), "Sword"), Weapon(3, 5, 10, "Gun")], [Armor(100, "Bronze"), Armor(100, "Bronze")], 2, 9, 9, 0)], 700, 700)
else:
print("YOU JUST WON THE GAME!!!!")
break
|
|
|
| Difference between "nvidia" vs "nvidia-updates" drivers? |
|
Posted by: Zead - 08-07-2015, 03:00 AM - Forum: Video Cards
- Replies (3)
|
 |
I've looked on the internet, even asked on Ubuntu forums, no one knows.
I thought "nvidia-updates" will auto-update to new driver, but normal "nvidia" driver did that too, so...
I have installed "nvidia-331" driver, the tested, recommended one. Then like 2 days ago, updater came with update, it wanted to update the driver to UNTESTED version 340.76 for some reason, which is a legacy driver (according to NVIDIA site). So I have purged the driver and installed the new tested one manually (346.87 or something like that)
It has GT520M GPU. And why would the Ubuntu updater wanted to update non-legacy TESTED driver to legacy NON-TESTED driver...?
Makes the whole NVIDIA update process kinda useless. I guess it's better to just completely uninstall the old one, and manually install the new one.
|
|
|
| Need help with downloading new programs, "stuck in Itunes" |
|
Posted by: rabar51 - 08-06-2015, 06:46 PM - Forum: Installing Software
- Replies (9)
|
 |
I am unable to continue downloading programs. I still need Dropbox and Itunes. I get an Error Message and the following while I was installing Itunes yesterday:
E: dpkg was interrupted, you must manually run 'dpkg --configure -a' to correct the problem.
E: _cache->open() failed, please report.
What can I do to stop this process and continue with installations. It appears that I will not be able to install Itunes. I am not understanding how to install new applications on my Linux OS.
|
|
|
| Error message received when trying to update the software on this PC. |
|
Posted by: beerbunny - 08-06-2015, 02:50 PM - Forum: Other
- Replies (3)
|
 |
For about a week now, I've been getting the following message when trying to update the software;
E: Encountered a section with no Package: header
E: Problem with MergeList /var/lib/apt/lists/repo.steampowered.com_steam_dists_precise_steam_i18n_Translation-en
E: The package lists or status file could not be parsed or opened.
I've got no idea what to do about it. I've tried updating using 'apt-get' in a terminal, but I get the same result.
Any suggestions gratefully received.
Thanks,
John Jones
|
|
|
| Dell Photosmart 924 All in One Printer won't print |
|
Posted by: rabar51 - 08-06-2015, 01:40 PM - Forum: Printing and Scanning
- Replies (6)
|
 |
I recently installed Linux. What a marvelous OS! Unfortunately my printer won't actually print, even though the computer appears to be printing on the monitor. It tells me that my doc has printed even though the printer never went through the process. Any help is appreciated.
Otherwise, I need recommendations for purchasing a new printer that works with both my Dell Dimension 310, Linux 2.4 OS, and my Ipad mini. Would like a wifi system. Can my Dell/Linux OS work with wifi vs hardwire USB connection?
Alot of questions.... thnx, rabar Please email me at [email protected] if you are replying to this post as I don't monitor the forum that closely. Thanx
|
|
|
| Howdy |
|
Posted by: OldGuy - 08-05-2015, 07:06 PM - Forum: Introductions
- Replies (5)
|
 |
Been using LL for nearly a year on multiple computers so I figured it's time I said howdy. It just works on the varied hardware I have ranging from old to new and Intel and AMD. I was a C programmer for many years, then an Accountant, now I'm retired and just enjoying life...
|
|
|
| Stuttering whenever any sound is played.... |
|
Posted by: Toxicode - 08-05-2015, 01:49 PM - Forum: Sound
- Replies (14)
|
 |
Hello I am having stuttering problems whenever any sound is played on my computer. I have an asus z97i-plus motherboard I am not sure where to even begin with diagnosing this problem. Any help would be appreciated.
Toxicode
|
|
|
| regarding vpn connection |
|
Posted by: katME - 08-04-2015, 02:49 AM - Forum: Network
- Replies (1)
|
 |
GREETING!!
I am just wondering whats this VPN all about and if its possible, how to connect into it?
what do u think is the advange and disadvantage of having this VPN connection? do u think
its advisable for me to make and have a VPN connection? i am just doubt and curious
of what this is all about..., i appreciate any concern!!
thanks in advance.... muaaaaah
|
|
|
|