1. Contest #2 Spazbot Question
- Posted by cklester <cklester at yahoo.com> Nov 22, 2004
- 660 views
- Last edited Nov 23, 2004
Is the following a valid bot program?
include eubots.ew ------------------------------------------------------------------------------- --SpazBot --Author: c.k.lester --Date: 2004.11.22 --Version: 1.0 --Comments: -- This is a simple moving bot. It moves randomly. Good luck catching it. -- ------------------------------------------------------------------------------- entrant_name = "SpazBot" entrant_desc = "This AI does nothing but run around.\n"& "Good for moving-target practice." ------------------------------------------------------------------------------- without warning ------------------------------------------------------------------------------- -- must I do the following? function get_my_pos(sequence a, sequence me) sequence pos pos = {} for H=1 to length(a) do -- HEIGHT for W=1 to length(a[x]) do -- WIDTH if a[W][H] = me then pos = {W,H} end if end for end for return pos end function ------------------------------------------------------------------------------- --start procedure procedure start() end procedure ------------------------------------------------------------------------------- --get_orders function function get_orders(sequence arena, sequence metrics) return {get_my_pos(arena,metrics[IDENTITY]),MOVE,rand(8)} end function ------------------------------------------------------------------------------- --cleanup procedure procedure cleanup() end procedure ------------------------------------------------------------------------------- eubot_init(routine_id("start"), routine_id("get_orders"), routine_id("cleanup") )
-=ck "Programming in a state of EUPHORIA." http://www.cklester.com/euphoria/
2. Re: Contest #2 Spazbot Question
- Posted by Patrick Barnes <mrtrick at gmail.com> Nov 22, 2004
- 603 views
- Last edited Nov 23, 2004
> posted by: cklester <cklester at yahoo.com> > Is the following a valid bot program? Um.... No, not really. Nothing wrong with the structure of it... but get_orders() is to get orders for EVERY unit you control, not just a single one. I made a couple of little changes: (oh, and metrics[IDENTITY] is an int, you passed it to a sequence param)
include eubots.ew --Comments: -- This is a simple moving bot. It moves randomly. Good luck catching it. -- without warning --Initialise pos to be the size of the number of units it has left. pos = {} for x=1 to metrics[WIDTH] do -- HEIGHT for y=1 to metrics[HEIGHT] do -- WIDTH if arena[x][y] = metrics[IDENTITY] then pos = append(pos, {x,y}) end if end for end for return pos end function --get_orders function function get_orders(sequence arena, sequence metrics) sequence units units = find_all_units(arena, metrics) for a = 1 to length(units) do units[a] = {units[a], MOVE, rand(8) } --transform the unit into an order. end for return units end function eubot_init(routine_id("start"), routine_id("get_orders"), routine_id("cleanup") )
-- MrTrick
3. Re: Contest #2 Spazbot Question
- Posted by cklester <cklester at yahoo.com> Nov 23, 2004
- 582 views
Patrick Barnes wrote: > > > posted by: cklester <cklester at yahoo.com> > > Is the following a valid bot program? > > Nothing wrong with the structure of it... but get_orders() is to get > orders for EVERY unit you control, not just a single one. I made a > couple of little changes: Are you going to drop X number of my bots into the arena at random locations? Also, I'm guessing find_all_units() is my responsibility, or is that an arena or eubots.e function? -=ck "Programming in a state of EUPHORIA." http://www.cklester.com/euphoria/
4. Re: Contest #2 Spazbot Question
- Posted by Patrick Barnes <mrtrick at gmail.com> Nov 23, 2004
- 581 views
On Mon, 22 Nov 2004 16:28:28 -0800, cklester <guest at rapideuphoria.com> wrote: > > Nothing wrong with the structure of it... but get_orders() is to get > > orders for EVERY unit you control, not just a single one. I made a > > couple of little changes: > > Are you going to drop X number of my bots into the arena at random > locations? Not random. For the tournament and final maps, they'll start in a bunch, a good distance from any enemy units. > Also, I'm guessing find_all_units() is my responsibility, or is that an > arena or eubots.e function? Yes, it's your responsibility, although how you find them is up to you. I can see there's a bit of confusion regarding the role of the program, is it per unit, or for all units, etc... I'll update the website (wait 8 hours for changes, I'm at work now) to clarify things... -- MrTrick