Further improvements to rule-based bot - Halite III coding competition p.6

sentdex · Beginner ·🛠️ AI Tools & Apps ·7y ago

Key Takeaways

Improves a rule-based bot for the Halite III coding competition

Full Transcript

what's going on everybody and welcome to part 6 of the halide 2018 slash highlight 3 tutorial series in the previous video we got our BOTS basically to the point where they run around they collect enough halite to get basically somewhere equal or less or two three three three halite and then they attempt to go drop it off and we're seeing that they're getting stuck at the depot here the at least the one of the more likely reasons why they're getting stuck is first of all they're just always going to get stuck so if we look back at our code when we go to deposit the ship is going to continue trying to move to the shipyard position but at some point the ship will get to the shipyard and at that point once the ship has arrived at the shipyard it's made its drop-off so in theory the naive navigate is going to actually be don't move at all because if we're still trying to get to that shipyard and we're at the shipyard it'll be don't move so I'm gonna use some truly expert logic that asks if move equals what is it is it can't remember if its direction with a capital D yeah both our capital Direction die still so if the move is don't move basically that means we made it and it's time to drop off so we're gonna say so if move is equal to hold still then we're just going to say ship States shipped out ID is now equal to collecting and the single quotes when everything else is double quotes is gonna bother me so we're gonna fix that okay so at this point they should begin moving around pretty well so the first thing I'm gonna do now is test it and let's see how we've done hopefully no air is this time I apologize for all the errors I've been causing okay so let's go into here and pull up our replays I cleared all the other ones so I just have the one right now so this is after our updates okay so we move out we deploy it looks like we actually for the first time somewhat reliably are collecting halite and returning it so that's pretty good so what should we think about doing next so at least when I look at this I see a lot of behaviors like where the a is collect and go back and forth and back and forth so I think this would be a little more apparent it's it's happening so fast because we're not collecting very much halite so for now I'm just gonna say let's just ain't change this ever so slightly nine five so oops - 0.95 okay so now if it's like almost to the max so at this point let me save that will rerun this we'll come over into our replay here and watch this replay this one's like not really too too bad okay this guy definitely just did it let me go back again and this isn't RIT like that action there where it's like zigzag dig dig dig that's not really beneficial so what I would suggest is you know having some sort of maybe slightly extra weighting associated with just maybe holding still we can see it at least initially right at the start of the game it doesn't appear to really be an issue that happens too much but as there's less highlight remaining in the general area it does appear that the ships do a lot is exactly that we'd really rather than just finish the job pick up all the halide all right so that would be the next thing I would probably start doing and there's probably a few ways that we could do that one option we have those just whenever we so highlight dict position equals highlight amount one thing that we could throw in here is just anywhere in here you know we could do it here even if let's say if Direction equals Direction dot still we could say this is this times four or let's do three four seems a little egregious else it equals the regular halide amount so in this case hopefully we should stay a little more still so let's see how we do there let's run it whoops I'm not that might have been my fault okay no it wasn't my fault okay what do we got here is oh my gosh I've been throwing in a one here dude okay all right that's awesome really cool I mean I'm really having a good time with that one okay okay back to where I was let me see here I think that's the hardest thing about halite is the way that you're executing everything is like so blind that and then the way that halide is working with all the other languages because everything is just like using standard output stuff and that just makes it really tough when it comes like it makes it great because we can use any programming language but it makes it super challenging when it comes to debugging but anyway let me see okay we're definitely moving back so let's do go back to time 0.995 and then oh the other thing was multiplying if it was uh let's see how they ticked if halide dict equals how light amount else logging down info attempting to move position choices okay and then here was the other thing so if Direction equals Direction dot still we want to do that [Music] times four or let guess we'll go with three and then else okay let's try again shall we no errors let's go whoo only warnings up to 83 though that's kind of scary let's see how we did replays throw it in can we go find I can't remember if we know okay okay so they collect return collect return and they're a little less moving around I can't remember what we maxed out with before and in fact I think we have too many replays but it was it's gonna be any of the replays that has like a significant so it's probably this one here so at the end here we ended with a little over 20,000 talat or so whereas prior to this we were picking up halite but we weren't getting anywhere near that's the same amount so holding still definitely helps and then the other thing that we could do is see like for example like once you get to this point the question could be at what point like when really should you turn around so right here we're turning around at point nine five what if we tried three three save that come back here rerun the game come over here grab the replay that's a much shorter replay that doesn't look as good at all I think cuz they're probably getting stuffed up there that would be my guess I don't know they don't look nearly there like it doesn't really look like they're getting jammed up too much a couple of those ships definitely got jammed up I'm tempted to run it again one more time I definitely think that guy aired out did we make it - no we didn't make it far enough I'm not sure why that bought aired out that's interesting who was that that would be player this player probably or maybe we need to go down one more player one go to the end max is an empty sequence okay so probably what happened there is like like for one of these ships like if they're not well it would be one that would be a ship that was not in port I guess or I guess it could be a ship that's in there basically that ship can't go anywhere because he's surrounded by our own ships one thing you'd probably wanna add later on I'm not gonna work on that in this video but ships can swap positions they just can't go to the same position so you could swap positions with any of the ships though and that would be better so anyway I'm gonna go back to 0.95 because apparently that was the way to go let's see if this one gets as many as that uh initially did that's interesting we didn't really get like any warnings at all let's come back over here throw in the replay how did we do pretty good again so it looks like after turn about 200 I think cuz that's in our code we only made ships up to turn 200 we might want to go a little higher than that so you might want to change that and how I need more than that that's fine and the shipyard not occupied that's fine too so let's try going to make ships all the way up to turn 300 okay the game ended let's check this replay we also should try like a bigger map okay so that was not nearly as good let's try a larger map though so this is a 32 by 32 I think we can have all the way up to like a 64 I'm not sure if they we ever do like a 2 players 64 by 64 game though it's a pretty big game game is ended let's just check what we got here also does not look as good so I guess we'll just we'll stick with the turn number 200 then that's fine let's run that again and then after this we can just submit the by so submitting the bots is kind of the same as it was before only now you can really just copy and paste it into the little interpreter thing and that should be fine and then you can run it otherwise you just need to submit as my bot on this one didn't go as well either I only got to about 10k 200 but whatever so if you want to submit the bot it's really as simple as just go into play basically copy your code go to the editor paste in your code run it make sure it works probably a good idea I'm pretty sure on this one we can make it run at least ten eggs I wish they would add 10x to the other replays that would be nice there we go okay oops go back here cool yeah this navigation is just not very good that would probably be the next major thing you'd want to work on is just fixing the navigation like again this guy just ran out of possible options but regardless when you're ready you can just hit submit and that uploads your bot otherwise what you just need to do is have your little folder with HLT in it and then your main script so it should be like my bot dot pi is what it should be called zip that up to something you call like submission zip and then you can go to play and they just drag and drop it in here so again and just in here you can see - my bot dot extension and upload it so anyway that's all for now if you got questions comments concerns whatever feel free to leave them below otherwise probably I'm gonna start transitioning into doing machine learning BOTS rather than rule-based a I bots so that's what I'm gonna be focusing on but if you got questions comments whatever on the bots up to this point feel free to leave them below otherwise I will see you guys in another video

Original Description

Text tutorials and sample code: coming soon(tm) Discord: https://discord.gg/sentdex Support the content: https://pythonprogramming.net/support-donate/ Twitter: https://twitter.com/sentdex Facebook: https://www.facebook.com/pythonprogramming.net/ Twitch: https://www.twitch.tv/sentdex G+: https://plus.google.com/+sentdex
Watch on YouTube ↗ (saves to browser)
Sign in to unlock AI tutor explanation · ⚡30

Playlist

Uploads from sentdex · sentdex · 0 of 60

← Previous Next →
1 Matplotlib Python Tutorial Part 1: Basics and your first Graph!
Matplotlib Python Tutorial Part 1: Basics and your first Graph!
sentdex
2 Python Encryption Tutorial with PyCrypto
Python Encryption Tutorial with PyCrypto
sentdex
3 Python's Logging Function
Python's Logging Function
sentdex
4 wxPython Tutorials 1: Making Windows GUIs with Python : Installing + 1st window!
wxPython Tutorials 1: Making Windows GUIs with Python : Installing + 1st window!
sentdex
5 wxPython Tutorials 2: Making Windows GUIs with Python: Customizing Window Parameters
wxPython Tutorials 2: Making Windows GUIs with Python: Customizing Window Parameters
sentdex
6 wxPython Programming Tutorial 3: Menu Bar and Menu Button
wxPython Programming Tutorial 3: Menu Bar and Menu Button
sentdex
7 wxPython Programming Tutorial 4: Panels
wxPython Programming Tutorial 4: Panels
sentdex
8 wxPython Programming Tutorial 5: User Input Saved To Variables
wxPython Programming Tutorial 5: User Input Saved To Variables
sentdex
9 wxPython Programming Tutorial 6: Multiple Choice Input
wxPython Programming Tutorial 6: Multiple Choice Input
sentdex
10 wxPython Programming Tutorial 7: Adding Static Text and Colors
wxPython Programming Tutorial 7: Adding Static Text and Colors
sentdex
11 wxPython Programming Tutorial 8: Custom Button Images
wxPython Programming Tutorial 8: Custom Button Images
sentdex
12 wxPython Programming Tutorial 9: Tool Bar Items and Sub Menus!
wxPython Programming Tutorial 9: Tool Bar Items and Sub Menus!
sentdex
13 Basic PHP Tutorial 13: Multi-dimensional Array
Basic PHP Tutorial 13: Multi-dimensional Array
sentdex
14 Basic PHP Tutorial 15: Functions and Global Variables
Basic PHP Tutorial 15: Functions and Global Variables
sentdex
15 Basic PHP Tutorial 12: Associative Array
Basic PHP Tutorial 12: Associative Array
sentdex
16 Basic PHP Tutorial 14: Foreach loop
Basic PHP Tutorial 14: Foreach loop
sentdex
17 Basic PHP Tutorial 16: Include and Require
Basic PHP Tutorial 16: Include and Require
sentdex
18 Basic PHP Tutorial 7: Assignment, comparison and Logical operators
Basic PHP Tutorial 7: Assignment, comparison and Logical operators
sentdex
19 Basic PHP Tutorial 4: Variables and Comments
Basic PHP Tutorial 4: Variables and Comments
sentdex
20 Basic PHP Tutorial 11: Arrays part 1, basic array
Basic PHP Tutorial 11: Arrays part 1, basic array
sentdex
21 Basic PHP Tutorial 6: If else and else if conditionals cont'd
Basic PHP Tutorial 6: If else and else if conditionals cont'd
sentdex
22 Basic PHP Tutorial 1: Intro to PHP
Basic PHP Tutorial 1: Intro to PHP
sentdex
23 Basic PHP Tutorial 3: HTML with PHP
Basic PHP Tutorial 3: HTML with PHP
sentdex
24 Basic PHP Tutorial 9: While Loop
Basic PHP Tutorial 9: While Loop
sentdex
25 Basic PHP Tutorial 10: Switch Statement
Basic PHP Tutorial 10: Switch Statement
sentdex
26 Basic PHP Tutorial 2: Print and Echo
Basic PHP Tutorial 2: Print and Echo
sentdex
27 Basic PHP Tutorial 5: If else and else if conditional statements
Basic PHP Tutorial 5: If else and else if conditional statements
sentdex
28 Basic PHP Tutorial 8: Arithmatic Operators: Doing math with php
Basic PHP Tutorial 8: Arithmatic Operators: Doing math with php
sentdex
29 Basic PHP Tutorial 17: User Input Form Example / String Manipulation
Basic PHP Tutorial 17: User Input Form Example / String Manipulation
sentdex
30 Basic PHP Tutorial 18: HTML Entities and forms cont'd
Basic PHP Tutorial 18: HTML Entities and forms cont'd
sentdex
31 Basic PHP Tutorial 19: Finding words in strings
Basic PHP Tutorial 19: Finding words in strings
sentdex
32 Basic PHP Programming Tutorial 20: Saving to a File / writing and appending
Basic PHP Programming Tutorial 20: Saving to a File / writing and appending
sentdex
33 Basic PHP Programming Tutorial 22: Hashing part 2: salting
Basic PHP Programming Tutorial 22: Hashing part 2: salting
sentdex
34 Basic PHP Programming Tutorial 23: Variables in Strings and tokenizing
Basic PHP Programming Tutorial 23: Variables in Strings and tokenizing
sentdex
35 Basic PHP Programming Tutorial 21: MD5 Hashing For Security
Basic PHP Programming Tutorial 21: MD5 Hashing For Security
sentdex
36 Basic PHP Programming Tutorial 24: String similarity
Basic PHP Programming Tutorial 24: String similarity
sentdex
37 Basic PHP Programming Tutorial 25: Time and Time stamps
Basic PHP Programming Tutorial 25: Time and Time stamps
sentdex
38 Basic PHP Programming Tutorial 26: Die and Exit
Basic PHP Programming Tutorial 26: Die and Exit
sentdex
39 Basic PHP Programming Tutorial 27: MySQL Databases Part 1
Basic PHP Programming Tutorial 27: MySQL Databases Part 1
sentdex
40 Basic PHP Programming Tutorial 28: MySQL Database Part 2: Reading From Database
Basic PHP Programming Tutorial 28: MySQL Database Part 2: Reading From Database
sentdex
41 Basic PHP Programming Tutorial 29: MySQL Database Part 3: Inputting Data
Basic PHP Programming Tutorial 29: MySQL Database Part 3: Inputting Data
sentdex
42 Basic PHP Programming Tutorial 30: MySQL database in Use
Basic PHP Programming Tutorial 30: MySQL database in Use
sentdex
43 Django Tutorial Web Development with Python Part 1: Installing Django
Django Tutorial Web Development with Python Part 1: Installing Django
sentdex
44 Python Tutorial: File Deletion and Folder Deletion / directory deletion
Python Tutorial: File Deletion and Folder Deletion / directory deletion
sentdex
45 Python Tutorial: How to Rename Files and Move Files with Python
Python Tutorial: How to Rename Files and Move Files with Python
sentdex
46 3D Graphs in Matplotlib for Python: Basic 3D Line
3D Graphs in Matplotlib for Python: Basic 3D Line
sentdex
47 3D Plotting in Matplotlib for Python: 3D Scatter Plot
3D Plotting in Matplotlib for Python: 3D Scatter Plot
sentdex
48 3D Charts in Matplotlib for Python: Multiple datasets scatter plot
3D Charts in Matplotlib for Python: Multiple datasets scatter plot
sentdex
49 Sikuli Tutorial 1: Visually programming in python!
Sikuli Tutorial 1: Visually programming in python!
sentdex
50 Sikuli Tutorial 2: Program visually in python!
Sikuli Tutorial 2: Program visually in python!
sentdex
51 Sikuli Tutorial 3: Program visually in python!
Sikuli Tutorial 3: Program visually in python!
sentdex
52 3D Bar Charts in Python and Matplotlib
3D Bar Charts in Python and Matplotlib
sentdex
53 3D Plane wire frame Graph Chart in Python
3D Plane wire frame Graph Chart in Python
sentdex
54 Raspberry Pi Part 1 Introduction
Raspberry Pi Part 1 Introduction
sentdex
55 Raspberry Pi Part 8: First Download and Update! (Firmware)
Raspberry Pi Part 8: First Download and Update! (Firmware)
sentdex
56 Raspberry Pi Part 10: How to set up a Linux Web Server on your Pi
Raspberry Pi Part 10: How to set up a Linux Web Server on your Pi
sentdex
57 Raspberry Pi Part 11: Remote Desktop
Raspberry Pi Part 11: Remote Desktop
sentdex
58 Twitter Analysis: How to rank a user's influence
Twitter Analysis: How to rank a user's influence
sentdex
59 GPIO Tutorial for Pi Part 2 - Programming the GPIO
GPIO Tutorial for Pi Part 2 - Programming the GPIO
sentdex
60 GPIO Tutorial for Raspberry Pi Part 1 - Setting up
GPIO Tutorial for Raspberry Pi Part 1 - Setting up
sentdex

Related Reads

📰
PodcastorAI Guide: How to Use It, Best Prompts & Use Cases (2026)
Learn to use PodcastorAI to turn scripts into studio-quality video podcast episodes in 15 minutes
Dev.to AI
📰
I built Steno to protect your most sensitive conversations. AI notetaker & notepad. 1200+ GitHub stars, 1000s of downloads
Learn about Steno, an AI-powered notetaker and notepad for sensitive conversations, and its latest release 0.6.4
Dev.to · Darth_Ruzin
📰
Enterprise Storage Is Rebuilding Itself Around AI-Ready Data
Enterprise storage is shifting focus from capacity to AI-ready data governance, driving 22.7% market growth in Q1 2026
Forbes Innovation
📰
Beyond 11,000: Navigating the Unified MCP Server Catalog That's Reshaping AI Tooling
Learn to navigate the Unified MCP Server Catalog with over 11,000 tools, reshaping AI tooling and streamlining development workflows
Dev.to · Robert Pelloni
Up next
Wix Harmony: Wix's AI Website Builder Explained (2026)
TheFigCo
Watch →