Gold Battle KoTHKing of the Hill: Robot BattleWhat Doesn't Kill Me…King of the Hill - FirefightersCave Rangers - Exploring the DarknessKOTH: TNT Run ChallengeBattle of the Fellowships KotHGold Collector KoTHArt Attack KoTHGold Hunter KoTHKnights and Knaves and Codes
Can living where Rare Earth magnetic ore is abundant provide any protection?
Help me, I hate squares!
What would the United Kingdom's "optimal" Brexit deal look like?
Why are prop blades not shaped like household fan blades?
How did Biff return to 2015 from 1955 without a lightning strike?
Move arrows along a contour
Why isn't LOX/UDMH used in staged combustion rockets now-a-days?
Russian pronunciation of /etc (a directory)
How do I make my photos have more impact?
Using Python in a Bash Script
Patio gate not at right angle to the house
Why are we moving in circles with a tandem kayak?
Introduction to the Sicilian
PCB design using code instead of clicking a mouse?
How to prevent a single-element caster from being useless against immune foes?
Coworker mumbles to herself when working, how to ask her to stop?
Why didn't General Martok receive discommendation in Star Trek: Deep Space Nine?
Why don't short runways use ramps for takeoff?
Applications of pure mathematics in operations research
What is a Mono Word™?
Can you remove a blindfold using the Telekinesis spell?
Best Ergonomic Design for a handheld ranged weapon
"Fewer errors means better products" or fewer errors mean better products."
"Valet parking " or "parking valet"
Gold Battle KoTH
King of the Hill: Robot BattleWhat Doesn't Kill Me…King of the Hill - FirefightersCave Rangers - Exploring the DarknessKOTH: TNT Run ChallengeBattle of the Fellowships KotHGold Collector KoTHArt Attack KoTHGold Hunter KoTHKnights and Knaves and Codes
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
$begingroup$
In this challenge, each submission is one bot. Each bot should be a Javascript function. Bots will fight to obtain the highest total worth in gold. Gold can be farmed, or earned from killing other bots, and is used to upgrade healing, attacking, shielding, and farming.
Objective:
Over a number of rounds containing up to 1000 turns (ends when only one bot is left), the bot with the highest total worth (the sum of all gold obtained) is the winner.
Turns:
In each turn, every bot which is alive (>0 HP) will be run once. It can return a move, which can be one of the following:
- Heal: Regains HP
- Attack: Removes HP from another bot
- Shield: Defends against later attacks
- Stun: Skips another bot's next turn
- Farm: Earns gold at the cost of HP
- Upgrade: Make certain moves better
All bots will return their move before any are executed, so a stun, heal, attack, shield, etc. will not affect any bots moving later in that turn. For example, if Bot A stuns Bot B, and Bot B is after Bot A in the turn order, Bot B will still move later in that same turn and the stun will occur on the next turn.
Combat, Farming, and Upgrading:
Each bot has a maximum HP of 100, and an assigned UID between 0 and 99. This UID changes after every round, and is how bots keep track of each other.
Healing is one of the simplest moves, adding an amount of HP determined by its level (starts at 5 HP). A bot cannot heal past 100 HP.
Attacking a bot by its UID is another possible move, with a base damage of 5 HP at level 0. Bots can also be stunned, skipping their next turn, which also uses UIDs.
Bots have additional shield HP, which has no limit. This shield HP will absorb damage from direct attacks from other bots, and is added by shielding. At level 0, shielding adds 5 shield HP.
Farming will earn 5 gold at level 0, at the cost of 2 HP. This 2 HP cannot be shielded. The only use for gold (beyond winning) is to upgrade moves. Healing, attacking, and shielding have a base value of 5 HP, and farming starts at 5 gold. Each of those moves have individual levels, which start at 0. These formulas will determine the value in HP or gold of a move, where L is the level:
- Healing:
L + 5
- Attacking:
1.25L + 5
- Shielding:
1.5L + 5
- Farming:
2L + 5
The cost of upgrading any move is the same for a certain level, and is determined by 2.5L² + 2.5L + 10
, where L is the current level. A bot can use the function cost(currentLevel)
as a shortcut to determine this.
Bots start with 25 gold, allowing them to quickly upgrade either two moves to level 1, or one move to level 2. This beginning gold does not count towards a bots total worth. Killing a bot gives you half of its total worth in gold, rounded up, and if two bots kill another in the same turn, they both get the reward.
Input/Output:
In order to communicate with the controller, the return value of the function is used to send move information. One of these should be returned:
- Heal:
heal()
- Attack:
attack(uid)
- Shield:
shield()
- Stun:
stun(uid)
- Farm:
farm()
- Upgrade:
upgrade("heal" / "attack" / "shield" / "farm")
To skip a turn (do nothing), return nothing, or return a falsy value.
To get the current turn number (starts at 1), use turn()
.
The arguments of your function will include information about your bot, UIDs of other bots, and between-turn storage. The first argument is an object with the following properties: uid
, hp
, gold
, and shield
. These are copies of your bot's current information. There is also an nested object levels
, with the level numbers of heal
, attack
, shield
, and farm
.
The second argument is a shuffled array of all alive bots other than yours, formatted as an object containing properties uid
, hp
(plus shield), worth
, and attack
(attack level). The third argument is an empty object which can be used for between-turn storage.
Example Bots:
This bot will farm until it can upgrade its attack to level 5, then attack a random bot each turn until it dies (or wins). Not very effective due to lack of healing/shielding.
function freeTestBotA(me, others, storage)
if (me.levels.attack < 5)
if (me.gold < cost(me.levels.attack))
return farm();
return upgrade("attack");
return attack(others[0].uid);
This bot has two modes: offensive and defensive. It will either stun a random bot or heal when in defensive mode, and it will either attack or shield when in offensive mode. It will attempt to upgrade its attacks whenever possible.
function freeTestBotB(me, others, storage)
if (me.gold >= cost(me.levels.attack))
return upgrade("attack");
if (me.hp < 50)
if (Math.random() < 0.5)
return stun(others[0].uid);
else
return heal();
else
if (Math.random() < 0.5)
return attack(others[0].uid);
else
return shield();
Rules:
Standard Loopholes forbidden- Bots may not read, modify, or add any variables outside of their scope, may not attempt to cheat, and may not call any functions other than the ones explicitly specified that they may call
- Return value must be falsy, or one of the above function outputs
- Bots should not be designed to target a specific bot, but can be designed to take advantage of common strategies
- Controller can be found here
- Chatroom
king-of-the-hill
$endgroup$
|
show 12 more comments
$begingroup$
In this challenge, each submission is one bot. Each bot should be a Javascript function. Bots will fight to obtain the highest total worth in gold. Gold can be farmed, or earned from killing other bots, and is used to upgrade healing, attacking, shielding, and farming.
Objective:
Over a number of rounds containing up to 1000 turns (ends when only one bot is left), the bot with the highest total worth (the sum of all gold obtained) is the winner.
Turns:
In each turn, every bot which is alive (>0 HP) will be run once. It can return a move, which can be one of the following:
- Heal: Regains HP
- Attack: Removes HP from another bot
- Shield: Defends against later attacks
- Stun: Skips another bot's next turn
- Farm: Earns gold at the cost of HP
- Upgrade: Make certain moves better
All bots will return their move before any are executed, so a stun, heal, attack, shield, etc. will not affect any bots moving later in that turn. For example, if Bot A stuns Bot B, and Bot B is after Bot A in the turn order, Bot B will still move later in that same turn and the stun will occur on the next turn.
Combat, Farming, and Upgrading:
Each bot has a maximum HP of 100, and an assigned UID between 0 and 99. This UID changes after every round, and is how bots keep track of each other.
Healing is one of the simplest moves, adding an amount of HP determined by its level (starts at 5 HP). A bot cannot heal past 100 HP.
Attacking a bot by its UID is another possible move, with a base damage of 5 HP at level 0. Bots can also be stunned, skipping their next turn, which also uses UIDs.
Bots have additional shield HP, which has no limit. This shield HP will absorb damage from direct attacks from other bots, and is added by shielding. At level 0, shielding adds 5 shield HP.
Farming will earn 5 gold at level 0, at the cost of 2 HP. This 2 HP cannot be shielded. The only use for gold (beyond winning) is to upgrade moves. Healing, attacking, and shielding have a base value of 5 HP, and farming starts at 5 gold. Each of those moves have individual levels, which start at 0. These formulas will determine the value in HP or gold of a move, where L is the level:
- Healing:
L + 5
- Attacking:
1.25L + 5
- Shielding:
1.5L + 5
- Farming:
2L + 5
The cost of upgrading any move is the same for a certain level, and is determined by 2.5L² + 2.5L + 10
, where L is the current level. A bot can use the function cost(currentLevel)
as a shortcut to determine this.
Bots start with 25 gold, allowing them to quickly upgrade either two moves to level 1, or one move to level 2. This beginning gold does not count towards a bots total worth. Killing a bot gives you half of its total worth in gold, rounded up, and if two bots kill another in the same turn, they both get the reward.
Input/Output:
In order to communicate with the controller, the return value of the function is used to send move information. One of these should be returned:
- Heal:
heal()
- Attack:
attack(uid)
- Shield:
shield()
- Stun:
stun(uid)
- Farm:
farm()
- Upgrade:
upgrade("heal" / "attack" / "shield" / "farm")
To skip a turn (do nothing), return nothing, or return a falsy value.
To get the current turn number (starts at 1), use turn()
.
The arguments of your function will include information about your bot, UIDs of other bots, and between-turn storage. The first argument is an object with the following properties: uid
, hp
, gold
, and shield
. These are copies of your bot's current information. There is also an nested object levels
, with the level numbers of heal
, attack
, shield
, and farm
.
The second argument is a shuffled array of all alive bots other than yours, formatted as an object containing properties uid
, hp
(plus shield), worth
, and attack
(attack level). The third argument is an empty object which can be used for between-turn storage.
Example Bots:
This bot will farm until it can upgrade its attack to level 5, then attack a random bot each turn until it dies (or wins). Not very effective due to lack of healing/shielding.
function freeTestBotA(me, others, storage)
if (me.levels.attack < 5)
if (me.gold < cost(me.levels.attack))
return farm();
return upgrade("attack");
return attack(others[0].uid);
This bot has two modes: offensive and defensive. It will either stun a random bot or heal when in defensive mode, and it will either attack or shield when in offensive mode. It will attempt to upgrade its attacks whenever possible.
function freeTestBotB(me, others, storage)
if (me.gold >= cost(me.levels.attack))
return upgrade("attack");
if (me.hp < 50)
if (Math.random() < 0.5)
return stun(others[0].uid);
else
return heal();
else
if (Math.random() < 0.5)
return attack(others[0].uid);
else
return shield();
Rules:
Standard Loopholes forbidden- Bots may not read, modify, or add any variables outside of their scope, may not attempt to cheat, and may not call any functions other than the ones explicitly specified that they may call
- Return value must be falsy, or one of the above function outputs
- Bots should not be designed to target a specific bot, but can be designed to take advantage of common strategies
- Controller can be found here
- Chatroom
king-of-the-hill
$endgroup$
$begingroup$
Do shields ever decay on their own, or can you just keep stacking them up forever?
$endgroup$
– HyperNeutrino
6 hours ago
2
$begingroup$
No specification for the gold gained from killing other bots.
$endgroup$
– Draco18s
6 hours ago
$begingroup$
Is there any way to determine the move of each bot on each turn? Just knowing the state at the end of each turn doesn't even let you determine which bot attacked you; is that intentional?
$endgroup$
– HyperNeutrino
6 hours ago
$begingroup$
Is there a max level for abilities?
$endgroup$
– Luis felipe De jesus Munoz
6 hours ago
1
$begingroup$
@Draco18s I think it has to do with shielding. I forgot to make shielding activate after the turn ends.
$endgroup$
– Redwolf Programs
4 hours ago
|
show 12 more comments
$begingroup$
In this challenge, each submission is one bot. Each bot should be a Javascript function. Bots will fight to obtain the highest total worth in gold. Gold can be farmed, or earned from killing other bots, and is used to upgrade healing, attacking, shielding, and farming.
Objective:
Over a number of rounds containing up to 1000 turns (ends when only one bot is left), the bot with the highest total worth (the sum of all gold obtained) is the winner.
Turns:
In each turn, every bot which is alive (>0 HP) will be run once. It can return a move, which can be one of the following:
- Heal: Regains HP
- Attack: Removes HP from another bot
- Shield: Defends against later attacks
- Stun: Skips another bot's next turn
- Farm: Earns gold at the cost of HP
- Upgrade: Make certain moves better
All bots will return their move before any are executed, so a stun, heal, attack, shield, etc. will not affect any bots moving later in that turn. For example, if Bot A stuns Bot B, and Bot B is after Bot A in the turn order, Bot B will still move later in that same turn and the stun will occur on the next turn.
Combat, Farming, and Upgrading:
Each bot has a maximum HP of 100, and an assigned UID between 0 and 99. This UID changes after every round, and is how bots keep track of each other.
Healing is one of the simplest moves, adding an amount of HP determined by its level (starts at 5 HP). A bot cannot heal past 100 HP.
Attacking a bot by its UID is another possible move, with a base damage of 5 HP at level 0. Bots can also be stunned, skipping their next turn, which also uses UIDs.
Bots have additional shield HP, which has no limit. This shield HP will absorb damage from direct attacks from other bots, and is added by shielding. At level 0, shielding adds 5 shield HP.
Farming will earn 5 gold at level 0, at the cost of 2 HP. This 2 HP cannot be shielded. The only use for gold (beyond winning) is to upgrade moves. Healing, attacking, and shielding have a base value of 5 HP, and farming starts at 5 gold. Each of those moves have individual levels, which start at 0. These formulas will determine the value in HP or gold of a move, where L is the level:
- Healing:
L + 5
- Attacking:
1.25L + 5
- Shielding:
1.5L + 5
- Farming:
2L + 5
The cost of upgrading any move is the same for a certain level, and is determined by 2.5L² + 2.5L + 10
, where L is the current level. A bot can use the function cost(currentLevel)
as a shortcut to determine this.
Bots start with 25 gold, allowing them to quickly upgrade either two moves to level 1, or one move to level 2. This beginning gold does not count towards a bots total worth. Killing a bot gives you half of its total worth in gold, rounded up, and if two bots kill another in the same turn, they both get the reward.
Input/Output:
In order to communicate with the controller, the return value of the function is used to send move information. One of these should be returned:
- Heal:
heal()
- Attack:
attack(uid)
- Shield:
shield()
- Stun:
stun(uid)
- Farm:
farm()
- Upgrade:
upgrade("heal" / "attack" / "shield" / "farm")
To skip a turn (do nothing), return nothing, or return a falsy value.
To get the current turn number (starts at 1), use turn()
.
The arguments of your function will include information about your bot, UIDs of other bots, and between-turn storage. The first argument is an object with the following properties: uid
, hp
, gold
, and shield
. These are copies of your bot's current information. There is also an nested object levels
, with the level numbers of heal
, attack
, shield
, and farm
.
The second argument is a shuffled array of all alive bots other than yours, formatted as an object containing properties uid
, hp
(plus shield), worth
, and attack
(attack level). The third argument is an empty object which can be used for between-turn storage.
Example Bots:
This bot will farm until it can upgrade its attack to level 5, then attack a random bot each turn until it dies (or wins). Not very effective due to lack of healing/shielding.
function freeTestBotA(me, others, storage)
if (me.levels.attack < 5)
if (me.gold < cost(me.levels.attack))
return farm();
return upgrade("attack");
return attack(others[0].uid);
This bot has two modes: offensive and defensive. It will either stun a random bot or heal when in defensive mode, and it will either attack or shield when in offensive mode. It will attempt to upgrade its attacks whenever possible.
function freeTestBotB(me, others, storage)
if (me.gold >= cost(me.levels.attack))
return upgrade("attack");
if (me.hp < 50)
if (Math.random() < 0.5)
return stun(others[0].uid);
else
return heal();
else
if (Math.random() < 0.5)
return attack(others[0].uid);
else
return shield();
Rules:
Standard Loopholes forbidden- Bots may not read, modify, or add any variables outside of their scope, may not attempt to cheat, and may not call any functions other than the ones explicitly specified that they may call
- Return value must be falsy, or one of the above function outputs
- Bots should not be designed to target a specific bot, but can be designed to take advantage of common strategies
- Controller can be found here
- Chatroom
king-of-the-hill
$endgroup$
In this challenge, each submission is one bot. Each bot should be a Javascript function. Bots will fight to obtain the highest total worth in gold. Gold can be farmed, or earned from killing other bots, and is used to upgrade healing, attacking, shielding, and farming.
Objective:
Over a number of rounds containing up to 1000 turns (ends when only one bot is left), the bot with the highest total worth (the sum of all gold obtained) is the winner.
Turns:
In each turn, every bot which is alive (>0 HP) will be run once. It can return a move, which can be one of the following:
- Heal: Regains HP
- Attack: Removes HP from another bot
- Shield: Defends against later attacks
- Stun: Skips another bot's next turn
- Farm: Earns gold at the cost of HP
- Upgrade: Make certain moves better
All bots will return their move before any are executed, so a stun, heal, attack, shield, etc. will not affect any bots moving later in that turn. For example, if Bot A stuns Bot B, and Bot B is after Bot A in the turn order, Bot B will still move later in that same turn and the stun will occur on the next turn.
Combat, Farming, and Upgrading:
Each bot has a maximum HP of 100, and an assigned UID between 0 and 99. This UID changes after every round, and is how bots keep track of each other.
Healing is one of the simplest moves, adding an amount of HP determined by its level (starts at 5 HP). A bot cannot heal past 100 HP.
Attacking a bot by its UID is another possible move, with a base damage of 5 HP at level 0. Bots can also be stunned, skipping their next turn, which also uses UIDs.
Bots have additional shield HP, which has no limit. This shield HP will absorb damage from direct attacks from other bots, and is added by shielding. At level 0, shielding adds 5 shield HP.
Farming will earn 5 gold at level 0, at the cost of 2 HP. This 2 HP cannot be shielded. The only use for gold (beyond winning) is to upgrade moves. Healing, attacking, and shielding have a base value of 5 HP, and farming starts at 5 gold. Each of those moves have individual levels, which start at 0. These formulas will determine the value in HP or gold of a move, where L is the level:
- Healing:
L + 5
- Attacking:
1.25L + 5
- Shielding:
1.5L + 5
- Farming:
2L + 5
The cost of upgrading any move is the same for a certain level, and is determined by 2.5L² + 2.5L + 10
, where L is the current level. A bot can use the function cost(currentLevel)
as a shortcut to determine this.
Bots start with 25 gold, allowing them to quickly upgrade either two moves to level 1, or one move to level 2. This beginning gold does not count towards a bots total worth. Killing a bot gives you half of its total worth in gold, rounded up, and if two bots kill another in the same turn, they both get the reward.
Input/Output:
In order to communicate with the controller, the return value of the function is used to send move information. One of these should be returned:
- Heal:
heal()
- Attack:
attack(uid)
- Shield:
shield()
- Stun:
stun(uid)
- Farm:
farm()
- Upgrade:
upgrade("heal" / "attack" / "shield" / "farm")
To skip a turn (do nothing), return nothing, or return a falsy value.
To get the current turn number (starts at 1), use turn()
.
The arguments of your function will include information about your bot, UIDs of other bots, and between-turn storage. The first argument is an object with the following properties: uid
, hp
, gold
, and shield
. These are copies of your bot's current information. There is also an nested object levels
, with the level numbers of heal
, attack
, shield
, and farm
.
The second argument is a shuffled array of all alive bots other than yours, formatted as an object containing properties uid
, hp
(plus shield), worth
, and attack
(attack level). The third argument is an empty object which can be used for between-turn storage.
Example Bots:
This bot will farm until it can upgrade its attack to level 5, then attack a random bot each turn until it dies (or wins). Not very effective due to lack of healing/shielding.
function freeTestBotA(me, others, storage)
if (me.levels.attack < 5)
if (me.gold < cost(me.levels.attack))
return farm();
return upgrade("attack");
return attack(others[0].uid);
This bot has two modes: offensive and defensive. It will either stun a random bot or heal when in defensive mode, and it will either attack or shield when in offensive mode. It will attempt to upgrade its attacks whenever possible.
function freeTestBotB(me, others, storage)
if (me.gold >= cost(me.levels.attack))
return upgrade("attack");
if (me.hp < 50)
if (Math.random() < 0.5)
return stun(others[0].uid);
else
return heal();
else
if (Math.random() < 0.5)
return attack(others[0].uid);
else
return shield();
Rules:
Standard Loopholes forbidden- Bots may not read, modify, or add any variables outside of their scope, may not attempt to cheat, and may not call any functions other than the ones explicitly specified that they may call
- Return value must be falsy, or one of the above function outputs
- Bots should not be designed to target a specific bot, but can be designed to take advantage of common strategies
- Controller can be found here
- Chatroom
king-of-the-hill
king-of-the-hill
edited 1 hour ago
Redwolf Programs
asked 8 hours ago
Redwolf ProgramsRedwolf Programs
4513 silver badges16 bronze badges
4513 silver badges16 bronze badges
$begingroup$
Do shields ever decay on their own, or can you just keep stacking them up forever?
$endgroup$
– HyperNeutrino
6 hours ago
2
$begingroup$
No specification for the gold gained from killing other bots.
$endgroup$
– Draco18s
6 hours ago
$begingroup$
Is there any way to determine the move of each bot on each turn? Just knowing the state at the end of each turn doesn't even let you determine which bot attacked you; is that intentional?
$endgroup$
– HyperNeutrino
6 hours ago
$begingroup$
Is there a max level for abilities?
$endgroup$
– Luis felipe De jesus Munoz
6 hours ago
1
$begingroup$
@Draco18s I think it has to do with shielding. I forgot to make shielding activate after the turn ends.
$endgroup$
– Redwolf Programs
4 hours ago
|
show 12 more comments
$begingroup$
Do shields ever decay on their own, or can you just keep stacking them up forever?
$endgroup$
– HyperNeutrino
6 hours ago
2
$begingroup$
No specification for the gold gained from killing other bots.
$endgroup$
– Draco18s
6 hours ago
$begingroup$
Is there any way to determine the move of each bot on each turn? Just knowing the state at the end of each turn doesn't even let you determine which bot attacked you; is that intentional?
$endgroup$
– HyperNeutrino
6 hours ago
$begingroup$
Is there a max level for abilities?
$endgroup$
– Luis felipe De jesus Munoz
6 hours ago
1
$begingroup$
@Draco18s I think it has to do with shielding. I forgot to make shielding activate after the turn ends.
$endgroup$
– Redwolf Programs
4 hours ago
$begingroup$
Do shields ever decay on their own, or can you just keep stacking them up forever?
$endgroup$
– HyperNeutrino
6 hours ago
$begingroup$
Do shields ever decay on their own, or can you just keep stacking them up forever?
$endgroup$
– HyperNeutrino
6 hours ago
2
2
$begingroup$
No specification for the gold gained from killing other bots.
$endgroup$
– Draco18s
6 hours ago
$begingroup$
No specification for the gold gained from killing other bots.
$endgroup$
– Draco18s
6 hours ago
$begingroup$
Is there any way to determine the move of each bot on each turn? Just knowing the state at the end of each turn doesn't even let you determine which bot attacked you; is that intentional?
$endgroup$
– HyperNeutrino
6 hours ago
$begingroup$
Is there any way to determine the move of each bot on each turn? Just knowing the state at the end of each turn doesn't even let you determine which bot attacked you; is that intentional?
$endgroup$
– HyperNeutrino
6 hours ago
$begingroup$
Is there a max level for abilities?
$endgroup$
– Luis felipe De jesus Munoz
6 hours ago
$begingroup$
Is there a max level for abilities?
$endgroup$
– Luis felipe De jesus Munoz
6 hours ago
1
1
$begingroup$
@Draco18s I think it has to do with shielding. I forgot to make shielding activate after the turn ends.
$endgroup$
– Redwolf Programs
4 hours ago
$begingroup$
@Draco18s I think it has to do with shielding. I forgot to make shielding activate after the turn ends.
$endgroup$
– Redwolf Programs
4 hours ago
|
show 12 more comments
8 Answers
8
active
oldest
votes
$begingroup$
Unkillable, forked from Undyable.
function UnkillableBot(me)
if(me.hp < 100 - (me.levels.heal + 5))
return heal()
else
if(me.gold >= cost(me.levels.heal))
return upgrade("heal")
else if(me.gold >= cost(me.levels.farm))
return upgrade("farm")
else
return farm()
Given the exponential costs of upgrades, may as well upgrade farming if we can't upgrade healing, allowing the bot to collect gold more efficiently.
$endgroup$
$begingroup$
Absolutely crushing the competition in my tests
$endgroup$
– Redwolf Programs
4 hours ago
add a comment |
$begingroup$
Undyable Bot (v3)
function undyableBot(me, others, storage)
if(me.hp < 100 - (me.levels.heal + 5)*2)
console.log(me.hp, me.levels.heal + 5)
return heal()
else
if(me.levels.heal < 10 && cost(me.levels.heal) / 2 < cost(me.levels.farm))
if(me.gold >= cost(me.levels.heal))
return upgrade("heal")
else
return farm()
else
if(me.gold >= cost(me.levels.farm))
return upgrade("farm")
else
return farm()
$endgroup$
$begingroup$
Don't mind me...I'm going to borrow this.
$endgroup$
– Draco18s
5 hours ago
add a comment |
$begingroup$
SniperBot
- heals if can get one-shot
- heals if under 50 health and won't over-heal
- attacks bot if can pick it off and earn more money than farming
- upgrades farming if can afford
- upgrades healing if is under 80 health and can afford
- farms
vultures don't need an attack
function sniperBot(me, others)
for(var i = 0; i < others.length; i++)if(others[i].attack > me.hp)return heal();
if(me.hp < 30 && me.hp < 100 - me.levels.heal - 5) return heal();
var target = -1;
var targetWorth = me.levels.farm * 2 + 5;
for(var i = 0; i < others.length; i++)
if (others[i].hp <= 1.25 * me.levels.attack + 5 && others[i].worth / 2 > targetWorth)
target= others[i].uid;
targetWorth = others[i].worth / 2;
if(target!=-1) return attack(target);
if(me.gold >= cost(me.levels.farm)) return upgrade("farm");
if(me.hp < 50 && me.gold >= cost(me.levels.heal)) return upgrade("heal");
return farm();
New contributor
$endgroup$
$begingroup$
Unexpected identifier (int
) on line 2. ReferenceError: health is not defined.
$endgroup$
– Draco18s
3 hours ago
$begingroup$
Should beme.hp
?
$endgroup$
– mbomb007
3 hours ago
$begingroup$
sorry. new to javascript. thanks for the help
$endgroup$
– Andrew Borders
3 hours ago
add a comment |
$begingroup$
Optimist
function Optimist(me, others, storage)
if (me.hp < 10)
return heal();
if ( (me.hp + me.shield) < 50 )
return shield();
if (me.gold >= cost(me.levels.farm) && cost(me.levels.farm) < 0.8 * (1000 - turn()))
return upgrade("farm");
rich_bots = others.sort( (x,y) => y.worth - x.worth );
potential_victim = rich_bots.find( bot => bot.hp <= me.levels.attack * 1.25 + 5 );
if (potential_victim)
return attack(potential_victim.uid);
if (me.gold < rich_bots[0].worth + cost(me.levels.farm) + 25)
return farm();
if (me.levels.heal < me.levels.farm)
return upgrade("heal");
if (me.levels.shield < me.levels.heal)
return upgrade("shield");
if (me.levels.attack < me.levels.shield)
return upgrade("attack");
return shield();
Assumes it will be able to spend 80% of its time peacefully farming, so it starts off by maxing out farming, and only then starts paying any attention to its combat skills. Surely nothing will go wrong!
$endgroup$
add a comment |
$begingroup$
JustFarm
I thought I'd start simple.
function justFarm(me, others)
return farm();
New contributor
$endgroup$
4
$begingroup$
This bot will suicide due to the 2HP cost of farming.
$endgroup$
– Draco18s
6 hours ago
$begingroup$
@Draco18s Although the round may end before that, depending on the number of bots
$endgroup$
– Redwolf Programs
6 hours ago
$begingroup$
While technically true, a 50 round timer is very very short when the default end time is 1000.
$endgroup$
– Draco18s
5 hours ago
$begingroup$
It beat the two example bots, but now there are a few more submissions I might try to come up with something better.
$endgroup$
– Anonymous
5 hours ago
$begingroup$
@Anonymous Maybe including healing and farming upgrades will be enough. Since getting the most gold is the ultimate goal, keeping that as the bot's main job could work. There haven't been any bots so far which have "modes" like heal mode and farm mode, might be an interesting approach
$endgroup$
– Redwolf Programs
3 hours ago
add a comment |
$begingroup$
bullyBot, 437 bytes
function bullyBot(me, others, storage)
if(turn()==1)return farm();
if(storage.bullyTarget==null)storage.bullyTarget=others[0].uid;
var targetlives = false;
for(var i = 0; i < others.length; i++)
if (others[i].uid == storage.bullyTarget)
targetlives = true;
break;
if(!targetlives)storage.bullyTarget = others[0].uid;
return stun(storage.bullyTarget);
Try it online!
May not win but will certainly try his damndest to make sure his target doesn't either. bullyBot also farms on the first turn so that if there's no outside influence, he will beat his target 5-0 or tie them 5-5.
$endgroup$
add a comment |
$begingroup$
Indestructible
A modification of Draco18's bot, using shields (more effective against other bots)
function indestructible(me)
if (me.hp < 80 - (me.levels.heal + 5))
return heal();
else if (me.hp < 100)
return shield();
else
if (me.gold >= cost(me.levels.shield))
return upgrade("shield");
else if (me.gold >= cost(me.levels.farm))
return upgrade("farm");
else
return farm();
$endgroup$
$begingroup$
You have to rename the function.
$endgroup$
– Draco18s
4 hours ago
$begingroup$
@Draco18s Odd, I thought I did. Hold on
$endgroup$
– Redwolf Programs
4 hours ago
add a comment |
$begingroup$
ScavengerBot (V2)
Realized it wasn't much of a scavenger before. New strategy is wait until it can kill another bot. If no one can be killed, it sits and builds up shield.
function scavengerBot(me, others)
if (me.shield < (me.levels.shield * 1.5 + 5))
return shield();
var currentAttack = 1.25 * me.levels.attack + 5;
var hasVictim = false;
var victimUid = 0;
var maxWorth = 0;
for (var i = 0; i < others.length; i++)
var hp = others[i].hp;
var worth = others[i].worth;
if (hp <= currentAttack && worth > maxWorth)
hasVictim = true;
victimUid = others[i].uid;
maxWorth = worth;
if (hasVictim)
return attack(victimUid);
if (me.gold >= cost(me.levels.attack))
return upgrade("attack");
if (me.gold >= cost(me.levels.shield))
return upgrade("shield");
return shield();
$endgroup$
1
$begingroup$
me.levels.attacl
?
$endgroup$
– Draco18s
5 hours ago
$begingroup$
Good catch, fixed
$endgroup$
– reffu
4 hours ago
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "200"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f189110%2fgold-battle-koth%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
8 Answers
8
active
oldest
votes
8 Answers
8
active
oldest
votes
active
oldest
votes
active
oldest
votes
$begingroup$
Unkillable, forked from Undyable.
function UnkillableBot(me)
if(me.hp < 100 - (me.levels.heal + 5))
return heal()
else
if(me.gold >= cost(me.levels.heal))
return upgrade("heal")
else if(me.gold >= cost(me.levels.farm))
return upgrade("farm")
else
return farm()
Given the exponential costs of upgrades, may as well upgrade farming if we can't upgrade healing, allowing the bot to collect gold more efficiently.
$endgroup$
$begingroup$
Absolutely crushing the competition in my tests
$endgroup$
– Redwolf Programs
4 hours ago
add a comment |
$begingroup$
Unkillable, forked from Undyable.
function UnkillableBot(me)
if(me.hp < 100 - (me.levels.heal + 5))
return heal()
else
if(me.gold >= cost(me.levels.heal))
return upgrade("heal")
else if(me.gold >= cost(me.levels.farm))
return upgrade("farm")
else
return farm()
Given the exponential costs of upgrades, may as well upgrade farming if we can't upgrade healing, allowing the bot to collect gold more efficiently.
$endgroup$
$begingroup$
Absolutely crushing the competition in my tests
$endgroup$
– Redwolf Programs
4 hours ago
add a comment |
$begingroup$
Unkillable, forked from Undyable.
function UnkillableBot(me)
if(me.hp < 100 - (me.levels.heal + 5))
return heal()
else
if(me.gold >= cost(me.levels.heal))
return upgrade("heal")
else if(me.gold >= cost(me.levels.farm))
return upgrade("farm")
else
return farm()
Given the exponential costs of upgrades, may as well upgrade farming if we can't upgrade healing, allowing the bot to collect gold more efficiently.
$endgroup$
Unkillable, forked from Undyable.
function UnkillableBot(me)
if(me.hp < 100 - (me.levels.heal + 5))
return heal()
else
if(me.gold >= cost(me.levels.heal))
return upgrade("heal")
else if(me.gold >= cost(me.levels.farm))
return upgrade("farm")
else
return farm()
Given the exponential costs of upgrades, may as well upgrade farming if we can't upgrade healing, allowing the bot to collect gold more efficiently.
answered 5 hours ago
Draco18sDraco18s
1,8716 silver badges19 bronze badges
1,8716 silver badges19 bronze badges
$begingroup$
Absolutely crushing the competition in my tests
$endgroup$
– Redwolf Programs
4 hours ago
add a comment |
$begingroup$
Absolutely crushing the competition in my tests
$endgroup$
– Redwolf Programs
4 hours ago
$begingroup$
Absolutely crushing the competition in my tests
$endgroup$
– Redwolf Programs
4 hours ago
$begingroup$
Absolutely crushing the competition in my tests
$endgroup$
– Redwolf Programs
4 hours ago
add a comment |
$begingroup$
Undyable Bot (v3)
function undyableBot(me, others, storage)
if(me.hp < 100 - (me.levels.heal + 5)*2)
console.log(me.hp, me.levels.heal + 5)
return heal()
else
if(me.levels.heal < 10 && cost(me.levels.heal) / 2 < cost(me.levels.farm))
if(me.gold >= cost(me.levels.heal))
return upgrade("heal")
else
return farm()
else
if(me.gold >= cost(me.levels.farm))
return upgrade("farm")
else
return farm()
$endgroup$
$begingroup$
Don't mind me...I'm going to borrow this.
$endgroup$
– Draco18s
5 hours ago
add a comment |
$begingroup$
Undyable Bot (v3)
function undyableBot(me, others, storage)
if(me.hp < 100 - (me.levels.heal + 5)*2)
console.log(me.hp, me.levels.heal + 5)
return heal()
else
if(me.levels.heal < 10 && cost(me.levels.heal) / 2 < cost(me.levels.farm))
if(me.gold >= cost(me.levels.heal))
return upgrade("heal")
else
return farm()
else
if(me.gold >= cost(me.levels.farm))
return upgrade("farm")
else
return farm()
$endgroup$
$begingroup$
Don't mind me...I'm going to borrow this.
$endgroup$
– Draco18s
5 hours ago
add a comment |
$begingroup$
Undyable Bot (v3)
function undyableBot(me, others, storage)
if(me.hp < 100 - (me.levels.heal + 5)*2)
console.log(me.hp, me.levels.heal + 5)
return heal()
else
if(me.levels.heal < 10 && cost(me.levels.heal) / 2 < cost(me.levels.farm))
if(me.gold >= cost(me.levels.heal))
return upgrade("heal")
else
return farm()
else
if(me.gold >= cost(me.levels.farm))
return upgrade("farm")
else
return farm()
$endgroup$
Undyable Bot (v3)
function undyableBot(me, others, storage)
if(me.hp < 100 - (me.levels.heal + 5)*2)
console.log(me.hp, me.levels.heal + 5)
return heal()
else
if(me.levels.heal < 10 && cost(me.levels.heal) / 2 < cost(me.levels.farm))
if(me.gold >= cost(me.levels.heal))
return upgrade("heal")
else
return farm()
else
if(me.gold >= cost(me.levels.farm))
return upgrade("farm")
else
return farm()
edited 2 hours ago
answered 6 hours ago
Luis felipe De jesus MunozLuis felipe De jesus Munoz
6,5662 gold badges18 silver badges74 bronze badges
6,5662 gold badges18 silver badges74 bronze badges
$begingroup$
Don't mind me...I'm going to borrow this.
$endgroup$
– Draco18s
5 hours ago
add a comment |
$begingroup$
Don't mind me...I'm going to borrow this.
$endgroup$
– Draco18s
5 hours ago
$begingroup$
Don't mind me...I'm going to borrow this.
$endgroup$
– Draco18s
5 hours ago
$begingroup$
Don't mind me...I'm going to borrow this.
$endgroup$
– Draco18s
5 hours ago
add a comment |
$begingroup$
SniperBot
- heals if can get one-shot
- heals if under 50 health and won't over-heal
- attacks bot if can pick it off and earn more money than farming
- upgrades farming if can afford
- upgrades healing if is under 80 health and can afford
- farms
vultures don't need an attack
function sniperBot(me, others)
for(var i = 0; i < others.length; i++)if(others[i].attack > me.hp)return heal();
if(me.hp < 30 && me.hp < 100 - me.levels.heal - 5) return heal();
var target = -1;
var targetWorth = me.levels.farm * 2 + 5;
for(var i = 0; i < others.length; i++)
if (others[i].hp <= 1.25 * me.levels.attack + 5 && others[i].worth / 2 > targetWorth)
target= others[i].uid;
targetWorth = others[i].worth / 2;
if(target!=-1) return attack(target);
if(me.gold >= cost(me.levels.farm)) return upgrade("farm");
if(me.hp < 50 && me.gold >= cost(me.levels.heal)) return upgrade("heal");
return farm();
New contributor
$endgroup$
$begingroup$
Unexpected identifier (int
) on line 2. ReferenceError: health is not defined.
$endgroup$
– Draco18s
3 hours ago
$begingroup$
Should beme.hp
?
$endgroup$
– mbomb007
3 hours ago
$begingroup$
sorry. new to javascript. thanks for the help
$endgroup$
– Andrew Borders
3 hours ago
add a comment |
$begingroup$
SniperBot
- heals if can get one-shot
- heals if under 50 health and won't over-heal
- attacks bot if can pick it off and earn more money than farming
- upgrades farming if can afford
- upgrades healing if is under 80 health and can afford
- farms
vultures don't need an attack
function sniperBot(me, others)
for(var i = 0; i < others.length; i++)if(others[i].attack > me.hp)return heal();
if(me.hp < 30 && me.hp < 100 - me.levels.heal - 5) return heal();
var target = -1;
var targetWorth = me.levels.farm * 2 + 5;
for(var i = 0; i < others.length; i++)
if (others[i].hp <= 1.25 * me.levels.attack + 5 && others[i].worth / 2 > targetWorth)
target= others[i].uid;
targetWorth = others[i].worth / 2;
if(target!=-1) return attack(target);
if(me.gold >= cost(me.levels.farm)) return upgrade("farm");
if(me.hp < 50 && me.gold >= cost(me.levels.heal)) return upgrade("heal");
return farm();
New contributor
$endgroup$
$begingroup$
Unexpected identifier (int
) on line 2. ReferenceError: health is not defined.
$endgroup$
– Draco18s
3 hours ago
$begingroup$
Should beme.hp
?
$endgroup$
– mbomb007
3 hours ago
$begingroup$
sorry. new to javascript. thanks for the help
$endgroup$
– Andrew Borders
3 hours ago
add a comment |
$begingroup$
SniperBot
- heals if can get one-shot
- heals if under 50 health and won't over-heal
- attacks bot if can pick it off and earn more money than farming
- upgrades farming if can afford
- upgrades healing if is under 80 health and can afford
- farms
vultures don't need an attack
function sniperBot(me, others)
for(var i = 0; i < others.length; i++)if(others[i].attack > me.hp)return heal();
if(me.hp < 30 && me.hp < 100 - me.levels.heal - 5) return heal();
var target = -1;
var targetWorth = me.levels.farm * 2 + 5;
for(var i = 0; i < others.length; i++)
if (others[i].hp <= 1.25 * me.levels.attack + 5 && others[i].worth / 2 > targetWorth)
target= others[i].uid;
targetWorth = others[i].worth / 2;
if(target!=-1) return attack(target);
if(me.gold >= cost(me.levels.farm)) return upgrade("farm");
if(me.hp < 50 && me.gold >= cost(me.levels.heal)) return upgrade("heal");
return farm();
New contributor
$endgroup$
SniperBot
- heals if can get one-shot
- heals if under 50 health and won't over-heal
- attacks bot if can pick it off and earn more money than farming
- upgrades farming if can afford
- upgrades healing if is under 80 health and can afford
- farms
vultures don't need an attack
function sniperBot(me, others)
for(var i = 0; i < others.length; i++)if(others[i].attack > me.hp)return heal();
if(me.hp < 30 && me.hp < 100 - me.levels.heal - 5) return heal();
var target = -1;
var targetWorth = me.levels.farm * 2 + 5;
for(var i = 0; i < others.length; i++)
if (others[i].hp <= 1.25 * me.levels.attack + 5 && others[i].worth / 2 > targetWorth)
target= others[i].uid;
targetWorth = others[i].worth / 2;
if(target!=-1) return attack(target);
if(me.gold >= cost(me.levels.farm)) return upgrade("farm");
if(me.hp < 50 && me.gold >= cost(me.levels.heal)) return upgrade("heal");
return farm();
New contributor
edited 1 hour ago
New contributor
answered 3 hours ago
Andrew BordersAndrew Borders
215 bronze badges
215 bronze badges
New contributor
New contributor
$begingroup$
Unexpected identifier (int
) on line 2. ReferenceError: health is not defined.
$endgroup$
– Draco18s
3 hours ago
$begingroup$
Should beme.hp
?
$endgroup$
– mbomb007
3 hours ago
$begingroup$
sorry. new to javascript. thanks for the help
$endgroup$
– Andrew Borders
3 hours ago
add a comment |
$begingroup$
Unexpected identifier (int
) on line 2. ReferenceError: health is not defined.
$endgroup$
– Draco18s
3 hours ago
$begingroup$
Should beme.hp
?
$endgroup$
– mbomb007
3 hours ago
$begingroup$
sorry. new to javascript. thanks for the help
$endgroup$
– Andrew Borders
3 hours ago
$begingroup$
Unexpected identifier (
int
) on line 2. ReferenceError: health is not defined.$endgroup$
– Draco18s
3 hours ago
$begingroup$
Unexpected identifier (
int
) on line 2. ReferenceError: health is not defined.$endgroup$
– Draco18s
3 hours ago
$begingroup$
Should be
me.hp
?$endgroup$
– mbomb007
3 hours ago
$begingroup$
Should be
me.hp
?$endgroup$
– mbomb007
3 hours ago
$begingroup$
sorry. new to javascript. thanks for the help
$endgroup$
– Andrew Borders
3 hours ago
$begingroup$
sorry. new to javascript. thanks for the help
$endgroup$
– Andrew Borders
3 hours ago
add a comment |
$begingroup$
Optimist
function Optimist(me, others, storage)
if (me.hp < 10)
return heal();
if ( (me.hp + me.shield) < 50 )
return shield();
if (me.gold >= cost(me.levels.farm) && cost(me.levels.farm) < 0.8 * (1000 - turn()))
return upgrade("farm");
rich_bots = others.sort( (x,y) => y.worth - x.worth );
potential_victim = rich_bots.find( bot => bot.hp <= me.levels.attack * 1.25 + 5 );
if (potential_victim)
return attack(potential_victim.uid);
if (me.gold < rich_bots[0].worth + cost(me.levels.farm) + 25)
return farm();
if (me.levels.heal < me.levels.farm)
return upgrade("heal");
if (me.levels.shield < me.levels.heal)
return upgrade("shield");
if (me.levels.attack < me.levels.shield)
return upgrade("attack");
return shield();
Assumes it will be able to spend 80% of its time peacefully farming, so it starts off by maxing out farming, and only then starts paying any attention to its combat skills. Surely nothing will go wrong!
$endgroup$
add a comment |
$begingroup$
Optimist
function Optimist(me, others, storage)
if (me.hp < 10)
return heal();
if ( (me.hp + me.shield) < 50 )
return shield();
if (me.gold >= cost(me.levels.farm) && cost(me.levels.farm) < 0.8 * (1000 - turn()))
return upgrade("farm");
rich_bots = others.sort( (x,y) => y.worth - x.worth );
potential_victim = rich_bots.find( bot => bot.hp <= me.levels.attack * 1.25 + 5 );
if (potential_victim)
return attack(potential_victim.uid);
if (me.gold < rich_bots[0].worth + cost(me.levels.farm) + 25)
return farm();
if (me.levels.heal < me.levels.farm)
return upgrade("heal");
if (me.levels.shield < me.levels.heal)
return upgrade("shield");
if (me.levels.attack < me.levels.shield)
return upgrade("attack");
return shield();
Assumes it will be able to spend 80% of its time peacefully farming, so it starts off by maxing out farming, and only then starts paying any attention to its combat skills. Surely nothing will go wrong!
$endgroup$
add a comment |
$begingroup$
Optimist
function Optimist(me, others, storage)
if (me.hp < 10)
return heal();
if ( (me.hp + me.shield) < 50 )
return shield();
if (me.gold >= cost(me.levels.farm) && cost(me.levels.farm) < 0.8 * (1000 - turn()))
return upgrade("farm");
rich_bots = others.sort( (x,y) => y.worth - x.worth );
potential_victim = rich_bots.find( bot => bot.hp <= me.levels.attack * 1.25 + 5 );
if (potential_victim)
return attack(potential_victim.uid);
if (me.gold < rich_bots[0].worth + cost(me.levels.farm) + 25)
return farm();
if (me.levels.heal < me.levels.farm)
return upgrade("heal");
if (me.levels.shield < me.levels.heal)
return upgrade("shield");
if (me.levels.attack < me.levels.shield)
return upgrade("attack");
return shield();
Assumes it will be able to spend 80% of its time peacefully farming, so it starts off by maxing out farming, and only then starts paying any attention to its combat skills. Surely nothing will go wrong!
$endgroup$
Optimist
function Optimist(me, others, storage)
if (me.hp < 10)
return heal();
if ( (me.hp + me.shield) < 50 )
return shield();
if (me.gold >= cost(me.levels.farm) && cost(me.levels.farm) < 0.8 * (1000 - turn()))
return upgrade("farm");
rich_bots = others.sort( (x,y) => y.worth - x.worth );
potential_victim = rich_bots.find( bot => bot.hp <= me.levels.attack * 1.25 + 5 );
if (potential_victim)
return attack(potential_victim.uid);
if (me.gold < rich_bots[0].worth + cost(me.levels.farm) + 25)
return farm();
if (me.levels.heal < me.levels.farm)
return upgrade("heal");
if (me.levels.shield < me.levels.heal)
return upgrade("shield");
if (me.levels.attack < me.levels.shield)
return upgrade("attack");
return shield();
Assumes it will be able to spend 80% of its time peacefully farming, so it starts off by maxing out farming, and only then starts paying any attention to its combat skills. Surely nothing will go wrong!
edited 1 hour ago
answered 3 hours ago
histocrathistocrat
19.6k4 gold badges32 silver badges74 bronze badges
19.6k4 gold badges32 silver badges74 bronze badges
add a comment |
add a comment |
$begingroup$
JustFarm
I thought I'd start simple.
function justFarm(me, others)
return farm();
New contributor
$endgroup$
4
$begingroup$
This bot will suicide due to the 2HP cost of farming.
$endgroup$
– Draco18s
6 hours ago
$begingroup$
@Draco18s Although the round may end before that, depending on the number of bots
$endgroup$
– Redwolf Programs
6 hours ago
$begingroup$
While technically true, a 50 round timer is very very short when the default end time is 1000.
$endgroup$
– Draco18s
5 hours ago
$begingroup$
It beat the two example bots, but now there are a few more submissions I might try to come up with something better.
$endgroup$
– Anonymous
5 hours ago
$begingroup$
@Anonymous Maybe including healing and farming upgrades will be enough. Since getting the most gold is the ultimate goal, keeping that as the bot's main job could work. There haven't been any bots so far which have "modes" like heal mode and farm mode, might be an interesting approach
$endgroup$
– Redwolf Programs
3 hours ago
add a comment |
$begingroup$
JustFarm
I thought I'd start simple.
function justFarm(me, others)
return farm();
New contributor
$endgroup$
4
$begingroup$
This bot will suicide due to the 2HP cost of farming.
$endgroup$
– Draco18s
6 hours ago
$begingroup$
@Draco18s Although the round may end before that, depending on the number of bots
$endgroup$
– Redwolf Programs
6 hours ago
$begingroup$
While technically true, a 50 round timer is very very short when the default end time is 1000.
$endgroup$
– Draco18s
5 hours ago
$begingroup$
It beat the two example bots, but now there are a few more submissions I might try to come up with something better.
$endgroup$
– Anonymous
5 hours ago
$begingroup$
@Anonymous Maybe including healing and farming upgrades will be enough. Since getting the most gold is the ultimate goal, keeping that as the bot's main job could work. There haven't been any bots so far which have "modes" like heal mode and farm mode, might be an interesting approach
$endgroup$
– Redwolf Programs
3 hours ago
add a comment |
$begingroup$
JustFarm
I thought I'd start simple.
function justFarm(me, others)
return farm();
New contributor
$endgroup$
JustFarm
I thought I'd start simple.
function justFarm(me, others)
return farm();
New contributor
New contributor
answered 6 hours ago
AnonymousAnonymous
191 bronze badge
191 bronze badge
New contributor
New contributor
4
$begingroup$
This bot will suicide due to the 2HP cost of farming.
$endgroup$
– Draco18s
6 hours ago
$begingroup$
@Draco18s Although the round may end before that, depending on the number of bots
$endgroup$
– Redwolf Programs
6 hours ago
$begingroup$
While technically true, a 50 round timer is very very short when the default end time is 1000.
$endgroup$
– Draco18s
5 hours ago
$begingroup$
It beat the two example bots, but now there are a few more submissions I might try to come up with something better.
$endgroup$
– Anonymous
5 hours ago
$begingroup$
@Anonymous Maybe including healing and farming upgrades will be enough. Since getting the most gold is the ultimate goal, keeping that as the bot's main job could work. There haven't been any bots so far which have "modes" like heal mode and farm mode, might be an interesting approach
$endgroup$
– Redwolf Programs
3 hours ago
add a comment |
4
$begingroup$
This bot will suicide due to the 2HP cost of farming.
$endgroup$
– Draco18s
6 hours ago
$begingroup$
@Draco18s Although the round may end before that, depending on the number of bots
$endgroup$
– Redwolf Programs
6 hours ago
$begingroup$
While technically true, a 50 round timer is very very short when the default end time is 1000.
$endgroup$
– Draco18s
5 hours ago
$begingroup$
It beat the two example bots, but now there are a few more submissions I might try to come up with something better.
$endgroup$
– Anonymous
5 hours ago
$begingroup$
@Anonymous Maybe including healing and farming upgrades will be enough. Since getting the most gold is the ultimate goal, keeping that as the bot's main job could work. There haven't been any bots so far which have "modes" like heal mode and farm mode, might be an interesting approach
$endgroup$
– Redwolf Programs
3 hours ago
4
4
$begingroup$
This bot will suicide due to the 2HP cost of farming.
$endgroup$
– Draco18s
6 hours ago
$begingroup$
This bot will suicide due to the 2HP cost of farming.
$endgroup$
– Draco18s
6 hours ago
$begingroup$
@Draco18s Although the round may end before that, depending on the number of bots
$endgroup$
– Redwolf Programs
6 hours ago
$begingroup$
@Draco18s Although the round may end before that, depending on the number of bots
$endgroup$
– Redwolf Programs
6 hours ago
$begingroup$
While technically true, a 50 round timer is very very short when the default end time is 1000.
$endgroup$
– Draco18s
5 hours ago
$begingroup$
While technically true, a 50 round timer is very very short when the default end time is 1000.
$endgroup$
– Draco18s
5 hours ago
$begingroup$
It beat the two example bots, but now there are a few more submissions I might try to come up with something better.
$endgroup$
– Anonymous
5 hours ago
$begingroup$
It beat the two example bots, but now there are a few more submissions I might try to come up with something better.
$endgroup$
– Anonymous
5 hours ago
$begingroup$
@Anonymous Maybe including healing and farming upgrades will be enough. Since getting the most gold is the ultimate goal, keeping that as the bot's main job could work. There haven't been any bots so far which have "modes" like heal mode and farm mode, might be an interesting approach
$endgroup$
– Redwolf Programs
3 hours ago
$begingroup$
@Anonymous Maybe including healing and farming upgrades will be enough. Since getting the most gold is the ultimate goal, keeping that as the bot's main job could work. There haven't been any bots so far which have "modes" like heal mode and farm mode, might be an interesting approach
$endgroup$
– Redwolf Programs
3 hours ago
add a comment |
$begingroup$
bullyBot, 437 bytes
function bullyBot(me, others, storage)
if(turn()==1)return farm();
if(storage.bullyTarget==null)storage.bullyTarget=others[0].uid;
var targetlives = false;
for(var i = 0; i < others.length; i++)
if (others[i].uid == storage.bullyTarget)
targetlives = true;
break;
if(!targetlives)storage.bullyTarget = others[0].uid;
return stun(storage.bullyTarget);
Try it online!
May not win but will certainly try his damndest to make sure his target doesn't either. bullyBot also farms on the first turn so that if there's no outside influence, he will beat his target 5-0 or tie them 5-5.
$endgroup$
add a comment |
$begingroup$
bullyBot, 437 bytes
function bullyBot(me, others, storage)
if(turn()==1)return farm();
if(storage.bullyTarget==null)storage.bullyTarget=others[0].uid;
var targetlives = false;
for(var i = 0; i < others.length; i++)
if (others[i].uid == storage.bullyTarget)
targetlives = true;
break;
if(!targetlives)storage.bullyTarget = others[0].uid;
return stun(storage.bullyTarget);
Try it online!
May not win but will certainly try his damndest to make sure his target doesn't either. bullyBot also farms on the first turn so that if there's no outside influence, he will beat his target 5-0 or tie them 5-5.
$endgroup$
add a comment |
$begingroup$
bullyBot, 437 bytes
function bullyBot(me, others, storage)
if(turn()==1)return farm();
if(storage.bullyTarget==null)storage.bullyTarget=others[0].uid;
var targetlives = false;
for(var i = 0; i < others.length; i++)
if (others[i].uid == storage.bullyTarget)
targetlives = true;
break;
if(!targetlives)storage.bullyTarget = others[0].uid;
return stun(storage.bullyTarget);
Try it online!
May not win but will certainly try his damndest to make sure his target doesn't either. bullyBot also farms on the first turn so that if there's no outside influence, he will beat his target 5-0 or tie them 5-5.
$endgroup$
bullyBot, 437 bytes
function bullyBot(me, others, storage)
if(turn()==1)return farm();
if(storage.bullyTarget==null)storage.bullyTarget=others[0].uid;
var targetlives = false;
for(var i = 0; i < others.length; i++)
if (others[i].uid == storage.bullyTarget)
targetlives = true;
break;
if(!targetlives)storage.bullyTarget = others[0].uid;
return stun(storage.bullyTarget);
Try it online!
May not win but will certainly try his damndest to make sure his target doesn't either. bullyBot also farms on the first turn so that if there's no outside influence, he will beat his target 5-0 or tie them 5-5.
answered 5 hours ago
VeskahVeskah
1,9875 silver badges23 bronze badges
1,9875 silver badges23 bronze badges
add a comment |
add a comment |
$begingroup$
Indestructible
A modification of Draco18's bot, using shields (more effective against other bots)
function indestructible(me)
if (me.hp < 80 - (me.levels.heal + 5))
return heal();
else if (me.hp < 100)
return shield();
else
if (me.gold >= cost(me.levels.shield))
return upgrade("shield");
else if (me.gold >= cost(me.levels.farm))
return upgrade("farm");
else
return farm();
$endgroup$
$begingroup$
You have to rename the function.
$endgroup$
– Draco18s
4 hours ago
$begingroup$
@Draco18s Odd, I thought I did. Hold on
$endgroup$
– Redwolf Programs
4 hours ago
add a comment |
$begingroup$
Indestructible
A modification of Draco18's bot, using shields (more effective against other bots)
function indestructible(me)
if (me.hp < 80 - (me.levels.heal + 5))
return heal();
else if (me.hp < 100)
return shield();
else
if (me.gold >= cost(me.levels.shield))
return upgrade("shield");
else if (me.gold >= cost(me.levels.farm))
return upgrade("farm");
else
return farm();
$endgroup$
$begingroup$
You have to rename the function.
$endgroup$
– Draco18s
4 hours ago
$begingroup$
@Draco18s Odd, I thought I did. Hold on
$endgroup$
– Redwolf Programs
4 hours ago
add a comment |
$begingroup$
Indestructible
A modification of Draco18's bot, using shields (more effective against other bots)
function indestructible(me)
if (me.hp < 80 - (me.levels.heal + 5))
return heal();
else if (me.hp < 100)
return shield();
else
if (me.gold >= cost(me.levels.shield))
return upgrade("shield");
else if (me.gold >= cost(me.levels.farm))
return upgrade("farm");
else
return farm();
$endgroup$
Indestructible
A modification of Draco18's bot, using shields (more effective against other bots)
function indestructible(me)
if (me.hp < 80 - (me.levels.heal + 5))
return heal();
else if (me.hp < 100)
return shield();
else
if (me.gold >= cost(me.levels.shield))
return upgrade("shield");
else if (me.gold >= cost(me.levels.farm))
return upgrade("farm");
else
return farm();
edited 4 hours ago
answered 4 hours ago
Redwolf ProgramsRedwolf Programs
4513 silver badges16 bronze badges
4513 silver badges16 bronze badges
$begingroup$
You have to rename the function.
$endgroup$
– Draco18s
4 hours ago
$begingroup$
@Draco18s Odd, I thought I did. Hold on
$endgroup$
– Redwolf Programs
4 hours ago
add a comment |
$begingroup$
You have to rename the function.
$endgroup$
– Draco18s
4 hours ago
$begingroup$
@Draco18s Odd, I thought I did. Hold on
$endgroup$
– Redwolf Programs
4 hours ago
$begingroup$
You have to rename the function.
$endgroup$
– Draco18s
4 hours ago
$begingroup$
You have to rename the function.
$endgroup$
– Draco18s
4 hours ago
$begingroup$
@Draco18s Odd, I thought I did. Hold on
$endgroup$
– Redwolf Programs
4 hours ago
$begingroup$
@Draco18s Odd, I thought I did. Hold on
$endgroup$
– Redwolf Programs
4 hours ago
add a comment |
$begingroup$
ScavengerBot (V2)
Realized it wasn't much of a scavenger before. New strategy is wait until it can kill another bot. If no one can be killed, it sits and builds up shield.
function scavengerBot(me, others)
if (me.shield < (me.levels.shield * 1.5 + 5))
return shield();
var currentAttack = 1.25 * me.levels.attack + 5;
var hasVictim = false;
var victimUid = 0;
var maxWorth = 0;
for (var i = 0; i < others.length; i++)
var hp = others[i].hp;
var worth = others[i].worth;
if (hp <= currentAttack && worth > maxWorth)
hasVictim = true;
victimUid = others[i].uid;
maxWorth = worth;
if (hasVictim)
return attack(victimUid);
if (me.gold >= cost(me.levels.attack))
return upgrade("attack");
if (me.gold >= cost(me.levels.shield))
return upgrade("shield");
return shield();
$endgroup$
1
$begingroup$
me.levels.attacl
?
$endgroup$
– Draco18s
5 hours ago
$begingroup$
Good catch, fixed
$endgroup$
– reffu
4 hours ago
add a comment |
$begingroup$
ScavengerBot (V2)
Realized it wasn't much of a scavenger before. New strategy is wait until it can kill another bot. If no one can be killed, it sits and builds up shield.
function scavengerBot(me, others)
if (me.shield < (me.levels.shield * 1.5 + 5))
return shield();
var currentAttack = 1.25 * me.levels.attack + 5;
var hasVictim = false;
var victimUid = 0;
var maxWorth = 0;
for (var i = 0; i < others.length; i++)
var hp = others[i].hp;
var worth = others[i].worth;
if (hp <= currentAttack && worth > maxWorth)
hasVictim = true;
victimUid = others[i].uid;
maxWorth = worth;
if (hasVictim)
return attack(victimUid);
if (me.gold >= cost(me.levels.attack))
return upgrade("attack");
if (me.gold >= cost(me.levels.shield))
return upgrade("shield");
return shield();
$endgroup$
1
$begingroup$
me.levels.attacl
?
$endgroup$
– Draco18s
5 hours ago
$begingroup$
Good catch, fixed
$endgroup$
– reffu
4 hours ago
add a comment |
$begingroup$
ScavengerBot (V2)
Realized it wasn't much of a scavenger before. New strategy is wait until it can kill another bot. If no one can be killed, it sits and builds up shield.
function scavengerBot(me, others)
if (me.shield < (me.levels.shield * 1.5 + 5))
return shield();
var currentAttack = 1.25 * me.levels.attack + 5;
var hasVictim = false;
var victimUid = 0;
var maxWorth = 0;
for (var i = 0; i < others.length; i++)
var hp = others[i].hp;
var worth = others[i].worth;
if (hp <= currentAttack && worth > maxWorth)
hasVictim = true;
victimUid = others[i].uid;
maxWorth = worth;
if (hasVictim)
return attack(victimUid);
if (me.gold >= cost(me.levels.attack))
return upgrade("attack");
if (me.gold >= cost(me.levels.shield))
return upgrade("shield");
return shield();
$endgroup$
ScavengerBot (V2)
Realized it wasn't much of a scavenger before. New strategy is wait until it can kill another bot. If no one can be killed, it sits and builds up shield.
function scavengerBot(me, others)
if (me.shield < (me.levels.shield * 1.5 + 5))
return shield();
var currentAttack = 1.25 * me.levels.attack + 5;
var hasVictim = false;
var victimUid = 0;
var maxWorth = 0;
for (var i = 0; i < others.length; i++)
var hp = others[i].hp;
var worth = others[i].worth;
if (hp <= currentAttack && worth > maxWorth)
hasVictim = true;
victimUid = others[i].uid;
maxWorth = worth;
if (hasVictim)
return attack(victimUid);
if (me.gold >= cost(me.levels.attack))
return upgrade("attack");
if (me.gold >= cost(me.levels.shield))
return upgrade("shield");
return shield();
edited 3 hours ago
answered 5 hours ago
reffureffu
9713 silver badges6 bronze badges
9713 silver badges6 bronze badges
1
$begingroup$
me.levels.attacl
?
$endgroup$
– Draco18s
5 hours ago
$begingroup$
Good catch, fixed
$endgroup$
– reffu
4 hours ago
add a comment |
1
$begingroup$
me.levels.attacl
?
$endgroup$
– Draco18s
5 hours ago
$begingroup$
Good catch, fixed
$endgroup$
– reffu
4 hours ago
1
1
$begingroup$
me.levels.attacl
?$endgroup$
– Draco18s
5 hours ago
$begingroup$
me.levels.attacl
?$endgroup$
– Draco18s
5 hours ago
$begingroup$
Good catch, fixed
$endgroup$
– reffu
4 hours ago
$begingroup$
Good catch, fixed
$endgroup$
– reffu
4 hours ago
add a comment |
If this is an answer to a challenge…
…Be sure to follow the challenge specification. However, please refrain from exploiting obvious loopholes. Answers abusing any of the standard loopholes are considered invalid. If you think a specification is unclear or underspecified, comment on the question instead.
…Try to optimize your score. For instance, answers to code-golf challenges should attempt to be as short as possible. You can always include a readable version of the code in addition to the competitive one.
Explanations of your answer make it more interesting to read and are very much encouraged.…Include a short header which indicates the language(s) of your code and its score, as defined by the challenge.
More generally…
…Please make sure to answer the question and provide sufficient detail.
…Avoid asking for help, clarification or responding to other answers (use comments instead).
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f189110%2fgold-battle-koth%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
$begingroup$
Do shields ever decay on their own, or can you just keep stacking them up forever?
$endgroup$
– HyperNeutrino
6 hours ago
2
$begingroup$
No specification for the gold gained from killing other bots.
$endgroup$
– Draco18s
6 hours ago
$begingroup$
Is there any way to determine the move of each bot on each turn? Just knowing the state at the end of each turn doesn't even let you determine which bot attacked you; is that intentional?
$endgroup$
– HyperNeutrino
6 hours ago
$begingroup$
Is there a max level for abilities?
$endgroup$
– Luis felipe De jesus Munoz
6 hours ago
1
$begingroup$
@Draco18s I think it has to do with shielding. I forgot to make shielding activate after the turn ends.
$endgroup$
– Redwolf Programs
4 hours ago