体验了一小把自制战略的乐趣,这一关比较开放;比起前面大多数关卡系统已经给出程序框架,本关完全自己编程制定策略。 简单来说,自己控制英雄在一场团战中胜利。敌方总兵力大于己方兵力,所以要有策略来打败敌人。 我的策略也很简单。首先走到地方的弓箭手的位置,弓箭手攻击力高,防御低,在自动对战中是主要的攻击兵种。打死了弓箭手就可以大幅减少敌方的攻击。所以我用了判断语句: if enemy.type == "archer":,来判断是否攻击。消灭敌方所有弓箭手之后,就是要保证自己英雄存活。我就使用了另一个判断语句:if hero.health > 100:,让英雄的血量小于100时他可以逃走。 ![image.png](https://cdn.steemitimages.com/DQmQNd7zLXK81oxRSF6DwxwTPbZSUWX6Ztc2qTbsE99i3Tb/image.png) ![image.png](https://cdn.steemitimages.com/DQmdRuagcBtCeruAxz2MebUktW5PYR6cQvYddyECCorzpRm/image.png) 代码如下: ~~~ # You'll need good strategy to win this one! # Your clone will have the same equipment you have! # But, they're not very skilled at using special powers. hero.moveXY(83, 86) while hero.pos.y > 45: enemy = hero.findNearestEnemy() if enemy.type == "archer": hero.attack(enemy) else: hero.moveXY(hero.pos.x, hero.pos.y - 5) while True: if hero.health > 100: hero.attack(hero.findNearestEnemy()) else: hero.moveXY(49, 74)
post_id | 86,531,575 |
---|---|
author | shenchensucc |
permlink | code-combat-clash-of-clones |
category | hive-180932 |
json_metadata | {"tags":["cn","cn-programming","jjm","whalepower","zzan","dblog","diamondtoken","marlians","upfundme","actnearn"],"image":["https:\/\/cdn.steemitimages.com\/DQmQNd7zLXK81oxRSF6DwxwTPbZSUWX6Ztc2qTbsE99i3Tb\/image.png","https:\/\/cdn.steemitimages.com\/DQmdRuagcBtCeruAxz2MebUktW5PYR6cQvYddyECCorzpRm\/image.png"],"app":"steemcn\/0.1","format":"markdown"} |
created | 2020-07-01 02:34:30 |
last_update | 2020-07-01 02:34:30 |
depth | 0 |
children | 2 |
net_rshares | 9,461,571,691,348 |
last_payout | 2020-07-08 02:34:30 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 2.916 SBD |
curator_payout_value | 2.793 SBD |
pending_payout_value | 0.000 SBD |
promoted | 0.000 SBD |
body_length | 989 |
author_reputation | 308,239,923,974,515 |
root_title | "Code Combat -- Clash of Clones" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 SBD |
percent_steem_dollars | 10,000 |
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
lemooljiang | 0 | 332,455,589,569 | 58% | ||
skysunny | 0 | 45,720,100 | 58% | ||
cnfund | 0 | 15,446,226,884 | 57.6% | ||
justyy | 0 | 1,262,685,112,445 | 6.14% | ||
happyukgo | 0 | 981,904,607 | 6.14% | ||
nokeh | 0 | 0 | 6.14% | ||
timool | 0 | 590,907,990 | 58% | ||
lucknie | 0 | 9,582,114,634 | 58% | ||
dumping | 0 | 965,557,218 | 58% | ||
nuagnorab | 0 | 237,814,531,500 | 57.6% | ||
wilkinshui | 0 | 94,440,819,633 | 57.6% | ||
aaronli | 0 | 69,850,083,483 | 57.6% | ||
shenchensucc | 0 | 260,651,336,114 | 100% | ||
susanli3769 | 0 | 103,386,161,869 | 57.6% | ||
davidmendel | 0 | 14,454,886,463 | 57.6% | ||
mrpointp | 0 | 71,615,221,197 | 57.6% | ||
robinlee | 0 | 0 | 6.14% | ||
everrich | 0 | 4,134,896,228 | 57.6% | ||
syh7758520 | 0 | 12,935,498,112 | 57.6% | ||
rainyapril | 0 | 0 | 6.14% | ||
kikima | 0 | 0 | 6.14% | ||
geass | 0 | 0 | 6.14% | ||
mrspointm | 0 | 94,791,808,192 | 57.6% | ||
liumei | 0 | 12,602,365,547 | 57.6% | ||
rosatravels | 0 | 355,996,944,301 | 57.6% | ||
pixresteemer | 0 | 7,088,513,558 | 17% | ||
superbing | 0 | 207,513,407 | 6.14% | ||
dailyfortune | 0 | 160,835,264 | 6.14% | ||
dailystats | 0 | 276,841,496 | 6.14% | ||
sunray | 0 | 49,299,617,699 | 57.6% | ||
metten | 0 | 5,133,605,832 | 58% | ||
jianan | 0 | 5,000,326,342 | 6.14% | ||
cn-book | 0 | 513,421,578 | 58% | ||
qifenggan | 0 | 5,310,300,285 | 57.6% | ||
cnbuddy | 0 | 1,674,165,729,731 | 100% | ||
cn-movie | 0 | 36,592,118 | 58% | ||
anxin | 0 | 114,287,059 | 6.14% | ||
angelina6688 | 0 | 25,072,876,083 | 57.6% | ||
vivia | 0 | 1,634,132,067 | 58% | ||
cheva | 0 | 205,692,288,003 | 57.6% | ||
moobear | 0 | 0 | 6.14% | ||
maiyude | 0 | 200,951,569,941 | 57.6% | ||
xiaoli | 0 | 132,418,531 | 58% | ||
nean | 0 | 0 | 6.14% | ||
wilhb81 | 0 | 193,913,074,437 | 57.6% | ||
foodielifestyle | 0 | 0 | 6.14% | ||
emmali | 0 | 2,340,641,696 | 57.6% | ||
woolfe19861008 | 0 | 90,641,234 | 6.14% | ||
youandme | 0 | 1,798,014,692 | 57.6% | ||
kirato | 0 | 195,327,882,107 | 57.6% | ||
dailychina | 0 | 338,635,808 | 6.14% | ||
vincenthan | 0 | 0 | 6.14% | ||
nostalgic1212 | 0 | 47,821,239,016 | 57.6% | ||
yuxuan | 0 | 0 | 6.14% | ||
dongfengman | 0 | 653,284,586 | 6.14% | ||
serenazz | 0 | 23,206,998 | 6.14% | ||
yedda | 0 | 0 | 6.14% | ||
shentrading | 0 | 49,219,812,139 | 57.6% | ||
zasilla | 0 | 0 | 6.14% | ||
fishaa | 0 | 0 | 6.14% | ||
also.einstein | 0 | 4,537,755,590 | 57.6% | ||
ethanlee | 0 | 251,058,515 | 6.14% | ||
twinsnicole | 0 | 0 | 6.14% | ||
deepthinking | 0 | 0 | 6.14% | ||
gogoabc | 0 | 0 | 6.14% | ||
ericet | 0 | 137,715,572,112 | 57.6% | ||
fanso | 0 | 43,712,778 | 6.14% | ||
aellly | 0 | 7,695,946,016 | 57.6% | ||
naha | 0 | 1,621,318,658 | 1% | ||
huangzuomin | 0 | 11,945,981,141 | 57.6% | ||
lilypang22 | 0 | 34,966,278 | 6.14% | ||
statsexpert | 0 | 16,912,500,975 | 57.6% | ||
payroll | 0 | 4,989,521,658 | 2% | ||
zens | 0 | 0 | 6.14% | ||
andrewma | 0 | 289,901,260 | 1.22% | ||
steemitvip | 0 | 0 | 6.14% | ||
regals | 0 | 0 | 6.14% | ||
softmetal | 0 | 60,762,253,831 | 57.6% | ||
liuzg | 0 | 17,963,071,500 | 57.6% | ||
tanlikming | 0 | 18,726,583,029 | 57.6% | ||
honoru | 0 | 158,410,567,111 | 57.6% | ||
joelone | 0 | 0 | 6.14% | ||
sweet-jenny8 | 0 | 1,281,149,567 | 6.14% | ||
robertyan | 0 | 10,241,489,260 | 57.6% | ||
xiaoyuanwmm | 0 | 2,020,827,480 | 57.6% | ||
team-cn | 0 | 58,684,606,275 | 10% | ||
ffbank | 0 | 0 | 6.14% | ||
tiffany4ever | 0 | 550,841,183,944 | 57.6% | ||
weicomenew | 0 | 0 | 6.14% | ||
laiyuehta | 0 | 242,604,407 | 6.14% | ||
turtlegraphics | 0 | 106,556,010 | 6.14% | ||
sunai | 0 | 17,449,923,962 | 57.6% | ||
anonyvoter | 0 | 4,126,896,081 | 17% | ||
julian2013 | 0 | 40,561,698,188 | 57.6% | ||
edwardchan | 0 | 2,454,493,079 | 57.6% | ||
slientstorm | 0 | 31,770,325,600 | 57.6% | ||
pet.society | 0 | 298,344,596,251 | 57.6% | ||
annepink | 0 | 52,999,495,274 | 57.6% | ||
witnesstools | 0 | 388,213,978 | 6.14% | ||
cherryzz | 0 | 26,941,123,472 | 57.6% | ||
teamcn-shop | 0 | 22,472,028,910 | 57.6% | ||
ilovecoding | 0 | 359,148,266 | 6.14% | ||
yunki | 0 | 2,206,281,458 | 57.6% | ||
cloudblade | 0 | 19,001,459,601 | 57.6% | ||
kelvinzhang | 0 | 3,339,357,589 | 57.6% | ||
steemfuckeos | 0 | 154,973,733 | 6.14% | ||
honey00 | 0 | 4,266,266,903 | 57.6% | ||
ahua | 0 | 3,416,259,024 | 57.6% | ||
morningshine | 0 | 114,858,946,868 | 57.6% | ||
cnstm | 0 | 1,102,319,998,893 | 100% | ||
cn-activity | 0 | 3,921,249,705 | 57.6% | ||
berrydeng | 0 | 2,316,527,708 | 57.6% | ||
davidchen | 0 | 41,142,584,866 | 57.6% | ||
teamcn-fund | 0 | 728,573,837 | 57.6% | ||
limka | 0 | 103,377,983 | 100% | ||
cecilian | 0 | 8,353,781,971 | 57.79% | ||
devyleona | 0 | 11,239,835,506 | 57.6% | ||
walker886 | 0 | 4,092,164,341 | 57.6% | ||
randomvoter | 0 | 7,458,289,981 | 17% | ||
m15197972567 | 0 | 3,199,001,873 | 57.6% | ||
blockcleaner | 0 | 2,660,216,730 | 6.14% | ||
kgame | 0 | 2,087,302,946 | 57.6% | ||
steem-drivers | 0 | 308,721,661 | 23.5% | ||
cn-zzang | 0 | 7,058,926,863 | 57.6% | ||
cplusplus | 0 | 359,902,393 | 6.14% | ||
cn-leo | 0 | 2,162,631,322 | 57.6% | ||
cn-sct | 0 | 30,529,177,789 | 57.6% | ||
cn-pal | 0 | 2,677,961,000 | 57.6% | ||
xiaoq.sports | 0 | 7,263,036,491 | 57.6% | ||
justsoso | 0 | 57,459,724 | 6.14% | ||
cn-marlians | 0 | 12,024,436,319 | 57.6% | ||
hykwf678233 | 0 | 226,867,514,173 | 57.6% | ||
gillianlien | 0 | 7,501,235,617 | 57.6% | ||
ericetchen | 0 | 404,736,858 | 57.6% | ||
stevewu | 0 | 361,468,760 | 57.6% | ||
kristinasiu | 0 | 760,083,620 | 57.6% | ||
longhash | 0 | 44,896,145 | 6.14% | ||
cnlifes | 0 | 0 | 6.14% | ||
cnfish | 0 | 0 | 6.14% | ||
llfestyle | 0 | 0 | 6.14% | ||
mary.janikowski | 0 | 462,361,724 | 28.05% | ||
soo002 | 0 | 0 | 1% | ||
omg62g | 0 | 0 | 1% | ||
annzhao | 0 | 345,771,246 | 57.6% | ||
marygong77777 | 0 | 2,069,689,751 | 57.6% | ||
cn-trail | 0 | 13,706,156,937 | 57.6% | ||
cnbuddy-reward | 0 | 223,876,079,811 | 50% | ||
coffeelove | 0 | 0 | 1% | ||
starnote | 0 | 88,579,391 | 58% | ||
dblogvoter | 0 | 1,142,849,358 | 17% | ||
neoxvoter | 0 | 1,676,393,707 | 17% | ||
creavoter | 0 | 1,166,299,223 | 17% | ||
bo022 | 0 | 11,147,313,886 | 57.6% | ||
gillianlienmap | 0 | 2,072,568,489 | 57.6% | ||
moochain.net | 0 | 89,707,131 | 58% | ||
lemool | 0 | 0 | 58% | ||
liebin | 0 | 0 | 58% | ||
moocer | 0 | 0 | 58% | ||
steem-zh | 0 | 0 | 58% | ||
steem-holder | 0 | 1,115,351,948 | 17% | ||
steeemmonsters | 0 | 0 | 6.14% | ||
maiydue | 0 | 0 | 6.14% | ||
wilhb82 | 0 | 0 | 6.14% | ||
morningshlne | 0 | 0 | 6.14% | ||
steem.buzz | 0 | 0 | 57.6% | ||
splinterislands | 0 | 0 | 6.14% | ||
sexybeach | 0 | 354,803,855 | 6.14% | ||
suckmydick | 0 | 154,410,430 | 6.14% | ||
chromebook | 0 | 153,126,084 | 6.14% | ||
ericandryan | 0 | 697,670,118 | 6.14% | ||
familyonline-tv | 0 | 160,583,602,531 | 57.6% | ||
fantate | 0 | 3,664,401,701 | 57.6% | ||
suguchu | 0 | 2,786,079,826 | 57.6% | ||
littleksroad | 0 | 67,742,166,869 | 57.6% | ||
justyy222 | 0 | 149,769,172 | 6.14% | ||
llllyyyyllll | 0 | 22,397,328,296 | 57.6% | ||
sweetime | 0 | 2,468,946,657 | 57.6% | ||
capehorn | 0 | 2,169,988,761 | 57.6% | ||
xiaobao | 0 | 792,481,182 | 57.6% | ||
choseal-leo | 0 | 102,826,578,877 | 57.6% | ||
kitgfdsa5 | 0 | 2,931,929,801 | 57.6% | ||
xiaomalailiao | 0 | 4,724,638,771 | 57.6% | ||
yuyusong | 0 | 1,833,947,315 | 57.6% |
啪啪啪
post_id | 86,538,067 |
---|---|
author | sunai |
permlink | qcsofe |
category | hive-180932 |
json_metadata | {"app":"steemcn\/0.1"} |
created | 2020-07-01 14:33:18 |
last_update | 2020-07-01 14:33:18 |
depth | 1 |
children | 0 |
net_rshares | 0 |
last_payout | 2020-07-08 14:33:18 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 SBD |
curator_payout_value | 0.000 SBD |
pending_payout_value | 0.000 SBD |
promoted | 0.000 SBD |
body_length | 3 |
author_reputation | 82,329,514,724,848 |
root_title | "Code Combat -- Clash of Clones" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 SBD |
percent_steem_dollars | 10,000 |
有时间,我也要去学习制作游戏代码,拍拍~
post_id | 86,544,429 |
---|---|
author | wilhb81 |
permlink | qctpxq |
category | hive-180932 |
json_metadata | {"app":"steemcn\/0.1"} |
created | 2020-07-02 04:03:27 |
last_update | 2020-07-02 04:03:27 |
depth | 1 |
children | 0 |
net_rshares | 0 |
last_payout | 2020-07-09 04:03:27 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 SBD |
curator_payout_value | 0.000 SBD |
pending_payout_value | 0.000 SBD |
promoted | 0.000 SBD |
body_length | 20 |
author_reputation | 451,278,293,500,053 |
root_title | "Code Combat -- Clash of Clones" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 SBD |
percent_steem_dollars | 10,000 |