From 3656b87b86c76580fe947f02ac920343b49041a1 Mon Sep 17 00:00:00 2001 From: Julien Dessaux Date: Tue, 18 Feb 2025 00:05:48 +0100 Subject: [golang] implement sending the starting probe to a shipyard that sells other probes --- golang/pkg/agent/run.go | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'golang/pkg/agent/run.go') diff --git a/golang/pkg/agent/run.go b/golang/pkg/agent/run.go index 8767c50..7d7c3a1 100644 --- a/golang/pkg/agent/run.go +++ b/golang/pkg/agent/run.go @@ -23,7 +23,8 @@ type State int const ( start_running_contracts_with_the_command_ship = iota - visit_all_shipyards + visit_all_shipyards_with_the_starting_probe + send_the_starting_probe_to_a_shipyard_that_sells_probes ) func Run( @@ -55,9 +56,16 @@ func Run( agent.wg.Add(1) go agent.autoContracting(&agent.ships[0]) state++ - case visit_all_shipyards: + case visit_all_shipyards_with_the_starting_probe: if err := agent.visitAllShipyards(&agent.ships[1]); err != nil { - agent.channel <- fmt.Errorf("agent runner returned an error on state %d: %w", state, err) + agent.channel <- fmt.Errorf("failed agent run: %w", err) + return + } + state++ + case send_the_starting_probe_to_a_shipyard_that_sells_probes: + if err := agent.sendShipToShipyardThatSells(&agent.ships[1], "SHIP_PROBE"); err != nil { + agent.channel <- fmt.Errorf("failed agent run: %w", err) + return } state++ default: -- cgit v1.2.3