Giter VIP home page Giter VIP logo

git's People

Watchers

 avatar  avatar

git's Issues

rename tool

import os
import csv



path = "D:\\01\\"

filelist = os.listdir(path)
rolename = raw_input("please input character name\n")
t_cnt = 0
t_cnt2 = 0
t_cnt3 = 0
t_cnt4 = 0
output = []
for files in filelist:
	output.append(files)
	print files
#with open("d:\\01\\output.csv","wb") as f:
#	writer = csv.writer(f,dialect="excel")
#	for x in output:
#		writer.writerow([x])
	olddir = os.path.join(path,files)
	if os.path.isdir(olddir):
		continue
	oriname = files.split(".")
	front = oriname[0]
	back = oriname[1]
	for x in range(1,13):
		comname = rolename + "0" + str(x)
		comname2 = rolename + str(x)
		if comname == front:
			newname = os.path.join(path,"vo_"+rolename+"_home0"+str(x)+"."+back)
			os.rename(olddir,newname)
		if comname2 == front:
			newname = os.path.join(path,"vo_"+rolename+"_home"+str(x)+"."+back)
			os.rename(olddir,newname)
	for x in range(13,27):
		comname = rolename + str(x)
		timelist = ['morning01','morning02','noon01','noon02','dusk01','dusk02','night01','night02','midnight01','midnight02','maxlv01','maxlv02','maxlv03','maxlv04']
		if comname == front:
			newname = os.path.join(path,'vo_' + rolename + '_' + timelist[t_cnt3]+'.'+back)
			t_cnt3 += 1
			print newname
			os.rename(olddir,newname)	
	for x in range(27,38):
		comname = rolename + str(x)
		emotionlist = ['normal','sure','negative','question','impatience','joy','decline','sorrow','angry','unhappy','shock']
		if comname == front:
			newname = os.path.join(path,'vo_'+rolename+'_scenario_'+emotionlist[t_cnt]+'.'+back)
			t_cnt += 1
			print newname
			os.rename(olddir,newname)
	for x in range(48,56):
		comname = rolename + str(x)
		actionlist = ['attack01','attack02','damage01','fever01','victory01','victory02','failure01','continue01']
		if comname == front:
			newname = os.path.join(path,'vo_'+rolename+'_'+actionlist[t_cnt2]+ '.' +back)
			print newname
			t_cnt2 += 1
			os.rename(olddir,newname)
	for x in range(56,59):
		comname = rolename + str(x)
		alllist = ['title','login01','birthday01']
		if comname == front:
			newname = os.path.join(path,'vo_'+rolename+'_'+alllist[t_cnt4]+ '.' +back)
			print newname
			t_cnt4 += 1
			os.rename(olddir,newname)

Easy battle similator

import math
import random

p_atk = float(input("Please input player's attack\n"))
p_hp = float(input("Please input player's hp\n"))
e_atk = float(input("Please input enemy's attack\n"))
e_hp = float(input("Please input enemy's hp\n"))
sim_times = input("Please input simulat times\n")
round = 0
result = []
def getbuff(x):
x *= 1.20

def battle(c):
for x in range(0,c):
pp_hp = p_hp
ee_hp = e_hp
while pp_hp > 0 and ee_hp > 0:
line = random.randint(3,12)
# print "\nline is:" + str(line)
atkbuffdice = random.randint(1,100)
if buffdice >= 60:
atkbuff = 5
else:
atkbuff = 1
ee_hp -= p_atkatkbuffline
# print "enemy's hp is:" + str(ee_hp)
pp_hp -= e_atk
# print "player's hp is:" + str(pp_hp) +"\n"
global round
round += 1
if pp_hp > 0:
print "battle is end"
print " WIN!::: cost " + str(round) + "turn\n"
result.append(str(round))
else:
print "battle is end"
print " lose!::: cost " + str(round) + "turn\n"
result.append("lose")
round = 0

battle(sim_times)

print result
myset = set(result)
for i in myset:
print("%s : %s" %(i,result.count(i)))

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.