r/ProgrammerHumor • • Jun 10 '23

[deleted by user]

[removed]

12k Upvotes

615 comments sorted by

View all comments

2.5k

u/Xanthus730 Jun 10 '23

During my bachelor's had an AI class where our final project was Robocode, where you make an AI for a little tank that fights other tanks.

I went whole-hog with my first attempt. Pattern matching, probabilistic dodging, logically deducing power of enemy shots etc... Was going ok, but was struggling against some of the harder example bots.

So, I made a second version that just ran around and oscillated back and forth in a Sin pattern.

I turned in both. The wiggle-bot won. :(

511

u/wademcgillis Jun 10 '23

That sounds exactly like a game I used to play in the 90s/early 2000s called Robot Battle. It was version 1.3 and IIRC 1.4 was a big revamp with flashy graphics.

1.3 was better.

166

u/Nightmare2828 Jun 10 '23

isnt that the game where going ultra light with huge batteries meant you won cause the other bot couldnt catch you and ran out of battery so you pushed it into a pit and won?

24

u/rojadvocado Jun 10 '23

Are you thinking of Robot Rage? The game that was on mini clip.

9

u/And_Justice Jun 10 '23

Now there's a game I haven't thought about in years

→ More replies (2)
→ More replies (2)

33

u/Helix_Aurora Jun 10 '23

I also played Robot battle. My best bot was 6 lines of code with invalid syntax

4

u/itsFromTheSimpsons Jun 10 '23

There was a PS 1 game called Carnage Heart where you built mechs, upgraded their hardware and could write their AI with a sort of connected blocks UI thing where each block was a conditional based on on of their sensors or some action like move or shoot one of their gun types. Ton of fun, would recommend. I've played it on emulator in the past so it's out there

246

u/FireBone62 Jun 10 '23

Stupid bots are better at doing stuff, while clever bots are good at simulating an player.

48

u/koala_cola Jun 10 '23

Whoa you’re right

We’re all fuckin bots dude

→ More replies (2)

48

u/ric2b Jun 10 '23

Did you end up testing both against each other to understand why that behavior was hard to deal with?

75

u/Xanthus730 Jun 10 '23

Oh yeah, that's how I decided the constants for the 2nd bot. I basically just moved in a Sin wave at an amplitude that 'tended to' avoid most of the shots from 'smarter' bots at least for a little while, and constant shooting while moving in a Sin wave also produces a shot pattern that's very difficult to dodge.

4

u/bb_avin Jun 11 '23

Oh, so it's not simple like you made it sound in the original comment. You did actually ensure the sine pattern was more effective at solving the problem.

6

u/Xanthus730 Jun 11 '23

True, but the entire code was something like <10 lines. It was just a few minutes of tweaking numbers. I spent weeks on bot one, hundreds of lines of dense code. Bot 2 I knocked out in like 45minutes of number tweaking.

38

u/NoteBlock08 Jun 10 '23

I had a similar assignment in my embedded systems class. My friend who eventually gave up and just made his tank spin like a helicopter and fire as fast as it could placed higher than all the rest of our group.

56

u/hilfandy Jun 10 '23

I did an AI asteroids competition and destroyed all other bots solely because I made a replacement for the canned moveToPoint function that would get me to a location slightly faster. Had nothing to do with AI and was entirely based on me going down a rabbit hole of vector math

34

u/TruthOf42 Jun 10 '23

I did robocode as well! It was 08 and all in java.

→ More replies (4)

8

u/ThatHappyCamper Jun 10 '23

I remember in high school I added completely random swaps of the orbiting direction and that got the bot to the point where it could put dodge the completely tricked out probabilistic dodging bots, tho the gun tracking was pretty basic so that side wasn't amazing

5

u/dlevac Jun 10 '23

My friend had a similar project. He noticed that the messaging protocol used was not fully secure: it was vulnerable to replay attack as all messages were broadcasted (encrypted but not tagged for at-most-once delivery).

So he submitted an average AI but his tanks would rebroadcast all messages received making all other tanks unable to do anything...

4

u/Asleep-Specific-1399 Jun 10 '23

The wiggle bot is too powerful, that was invented back in the day when ai was pure. Some games that come to mind missile commander, Mario, etc..

4

u/smeggysmeg Jun 10 '23

When I built a game in C in high school, this is how the computer opponent worked. It was surprisingly challenging to defeat that moves around randomly and attacks.

3

u/Brusanan Jun 10 '23

When we did robocode the winners were all ones that used neural networks to learn.

→ More replies (3)

3

u/ITriedLightningTendr Jun 10 '23

I did that, we ended up running out of time and just merging two sample bots together and it best everyone else

3

u/PersonalFan480 Jun 10 '23

Reminds me of Axelrod's 1980 prisoner's dilemma algorithm tournament. He asked for folk to submit programs to play an iterated prisoner's dilemma game against each other. Tit for tat outperformed just about every other algorithm tried.

→ More replies (5)