what's going on everybody and welcome to
part 2 of our halite 3in slash highlight
2018 tutorial series in this video what
we're going to do is start adding some
logic to our bot to hopefully get it to
not move so randomly maybe move with a
purpose so I'm gonna start doing this
locally so if you want to follow along
locally just go to the learn tab here
and then downloads and then download the
Python 3 version for your operating
system when you do that you will get
something that looks like this and this
is the file that we're going to be
modifying them my bot file so so go
ahead and do that and let's go ahead and
get started so the reason why I really
want to do this is because logging
doesn't seem to work as well on the web
editor for some reason like I don't
actually get all my log output on the
web editor
whereas locally when I do logging dot
info I get it and you can't print with
the you know built-in web editor because
of the way halide is actually processed
you're gonna it's gonna it's gonna see
those things that you print and think
that's an input to the game engine and
it's not so anyways we're gonna start
working locally so and then this file is
exactly the same file you get if you
download it I just removes basically all
the comments because we went through
everything I only left this one because
it's important to remember that this is
where the two second timer begins okay
so let's go ahead and get started and
basically our main issue here is that
our ships are just moving randomly to
collect halite and now what I want to do
is start moving to words highlights
instead so after a quick you know kind
of poking around the documentation I
found that every ship you know a ship
has a position and from that position
you can't so from any position so it's
not it's not a ship attribute it is a
method of any position you could need
so so from any position you can do a dot
get surrounding Cardinals so that means
get the north south west and east so you
can get that the information not only
the position of those positions but also
the you can use that to start figuring
out okay well how much how light is at
each of those positions so you could
start at your ships position and be like
okay what are the surrounding Cardinals
here where is the the best highlight in
the next closest move I could possibly
make and that's what we're going to do
but you could later you know kind of
expand that out as as many iterations as
you could possibly handle and then
choose the direction that is the most
advantageous to you probably taking into
some consideration the other ships that
you've got but yeah so anyways we're
gonna we're gonna make use of this this
method here so coming back over to our
bots for ship in me get ships the first
thing that we want to do is our choices
to moot because each ship can only move
like for each turn each ship can only
move once like one position and it can
only go up down left right so we have
choices so choices will be ship dot
position so ship dot position is that
position object and then we can do the
dot get surrounding was it to get
surrounding Cardinals yeah so we can get
those surrounding Cardinals now what we
can do is and in fact I think I might
[Music]
I might I might have us actually keep
this logic this is probably pretty good
starting logic here but we don't
necessarily want to move randomly but
the next thing I'd like to do is let's
just do a if game dot turn number equals
15 we're gonna logging dot info choices
so at turn 15 we're gonna save a bunch
of choices now let's just run this game
really quick so to run it you can look
at this run game batch file and in fact
this should work right out of the box
because we've kept our name as my bot PI
so you can either run it right from here
or you could you know like it you could
modify it and then just you just double
click this or you can just open a
command you know exe and run it but I'm
just gonna double click it that was
pretty quick and I also don't see any
real errors let me do that again
okay so I think we're hitting some sort
of error here so let me go ahead and
just copy this I want to actually see
there so I'm gonna open up command
prompt let's run this real quick oh ok
some sort of Python issue about tabs and
so I just put it I just installed
sublime text let's see so I'm pretty
sure we're the ones yeah ooh I don't
know what the option is in shoot
okay indent using spaces maybe whoa okay
now I got it okay now we just got to
find the rest of them so it looks like
this one might be the last one okay now
let's try again run game okay it looks
like it works
so whenever a game runs you get your
logging information comes here so if we
click on one of these we'll see indeed
at turn 15
we got the positions the cardinal
positions at the you know surrounding
Cardinals per ship and we should have
gotten the same thing for bought one
yeah there it is also whenever you run
you also get replays in here and some of
these are error logs from before so in
fact let me just delete those and then
let's just run this one more time so we
get the right log so now going into
replays we can see we got a replay and
then we get error logs for each of the
bots so I'll click on this and this just
currently just contains warnings about
about our ships so for example each time
your ship moves it needs to exhaust
halite so in this case it was directed
to use for highlights so it could move
south but only had zero halite so the
ship could no longer move for example so
anyway closing like that we've got a
replay and if you want to watch your
replay you can just go in here click
watch and then just click and drag the
replay anywhere on that page and boom
here's our replay the other thing we can
do is change our theme which I'm going
to do now - ooh there's a new theme
so there's colorblind halite - which is
what I had been using and then roguelike
I'm not sure what that does
besides apparently not let us change it
immediately interesting it's like I've
never heard of roguelike before but it
looks like a ski or something stuff ok
anyway I'm gonna go with highlight -
though drag that in okay so yeah because
with roguelike rogue-like how could you
you can't see the actual house
so I'm not really sure what the deal is
there anyway
cool so now that's basically kind of the
workflow that I tend to use at least
when I'm starting eventually if I'm just
tweaking little things I'll just go to
play copy and paste my code and look at
it really quick there and make quick
tweaks but as long as I want to log info
I'm gonna do it locally so okay so now
that we've got the get surrounding
Cardinals the next thing that we want to
do is get the halite for those
surrounding cardinal positions so that's
what I'm going to be doing in the next
tutorial if you've got questions
comments concerns whatever feel free
lilian below otherwise I will see you
guys in the next video