Discuss Scratch

MartinBraendli2
Scratcher
100+ posts

[ATC#6] Robo Golf

This is the 6th instalment of the Advanced Topics Challenge.
Goal
Your goal is to create a program, that controls the robot to play Robo Golf. Robo Golf is quite simple.

The robot has to pick up the 4 balls and has to put them in to the hole of the matching colour. Its probably best if you play one round of Robo Golf to get familiar. Its super simple.
Creating a program to do this autonomously is harder though. At the begin of a round, the robot has no information about its location, orientation and the random generated map it's on. Also, its view is very limited. It only senses the first Object in front of it.
Rules
Winner of ATC#6 is who ever creates the program, that lets the robot finish a certain amount (not yet determined) of rounds in the least amount of turns. A turn is every movement of the robot (forward, turn left, turn right, pick up/ place ball).
Remix the template and replace the code in the sprite “Controller” with code that lets the robot do its task autonomously. For input you can only use the global variables provided:
(View)
(Ball)
(Success)
The other global variables/lists can be used too, but are of less help.
The output can only be done via the use of the following broadcasts (ideally “broadcast and wait”):
broadcast [Move v] and wait
broadcast [Turn Left v] and wait
broadcast [Turn Right v] and wait
broadcast [Interact v] and wait
broadcast [Give Up v]
So generally you can't use Motion and Sensing blocks to get information about the map/bot or to interact with the map/bot. IO has to be done exclusively via broadcasts/ global variables.
Variables

View
Stores information about what is in front of the robot. “0” means there's nothing in front of it (except the wall). 1-4 are the balls (order RGBY), 5-8 are the matching holes (also RGBY), 9-14 are obstacles that block the view and path of the robot but don't serve any further purpose.

Ball
Stores “0” if no ball is held, else it stores the id of ball (1-4, RGBY).

Success
Is updated after any movement. If you try to move forward and nothing blocks you, it is set to 1, but if movemet fails because the path is blocked, it is set to 0.
If you have no ball and use “Interact”, Success is set to 1 if you were able to pick up a ball, to 0 else.
If you have a ball and use “Interact”, Success is set to 0 if an object in front of you stops you from placing the ball. If the ball can be placed on an empty space, Success is set to 1. If you can place it into the matching hole, Success is set to 2.
Submission
Rename the “Controller” sprite in your remix to your name. In the renamed Controller, on the block below the “when i receive initialize”, change “(YourName)” to your name. In “When I receive start”, leave the if statement intact, so that your controller only runs, when “Running” is set to your name (so i can have multiple controllers in the same project).
Add your remix to this studio. I will then only take the Controller sprite of your project and add it to the original project. This means you are free to change everything in the remix, as long as your controller doesn't change its protocol and is still able to control the original robot in the original environment.


I will update this with further rules about submission and time frame.

Last edited by MartinBraendli2 (Aug. 21, 2016 02:26:48)

MartinBraendli2
Scratcher
100+ posts

[ATC#6] Robo Golf

reserved
IcyCoder
Scratcher
1000+ posts

[ATC#6] Robo Golf

First!
MegaApuTurkUltra
Scratcher
1000+ posts

[ATC#6] Robo Golf

So we're not going to get a way to know absolute position / direction?

I ask because there's absolutely no way to know if you're against a wall or not with the current setup

Last edited by MegaApuTurkUltra (Aug. 20, 2016 00:06:03)

MartinBraendli2
Scratcher
100+ posts

[ATC#6] Robo Golf

Btw, we're out of medals. Does anyone have a good idea for the design of the next medals? Ideally without changing the general look too much.
MartinBraendli2
Scratcher
100+ posts

[ATC#6] Robo Golf

MegaApuTurkUltra wrote:

So we're not going to get a way to know absolute position / direction?
Absolute direction doesn't matter, the position can be figured out (its not absolute, but relative to the walls).
IcyCoder
Scratcher
1000+ posts

[ATC#6] Robo Golf

This is really a cool idea!
MegaApuTurkUltra
Scratcher
1000+ posts

[ATC#6] Robo Golf

MartinBraendli2 wrote:

MegaApuTurkUltra wrote:

So we're not going to get a way to know absolute position / direction?
Absolute direction doesn't matter, the position can be figured out (its not absolute, but relative to the walls).
Position cannot be figured out, since you don't know the distance to anything
MartinBraendli2
Scratcher
100+ posts

[ATC#6] Robo Golf

MegaApuTurkUltra wrote:

MartinBraendli2 wrote:

MegaApuTurkUltra wrote:

So we're not going to get a way to know absolute position / direction?
Absolute direction doesn't matter, the position can be figured out (its not absolute, but relative to the walls).
Position cannot be figured out, since you don't know the distance to anything
Not without moving. But you have the Variable “Success”, that tells you, whether you are stuck or were able to move…
MegaApuTurkUltra
Scratcher
1000+ posts

[ATC#6] Robo Golf

MartinBraendli2 wrote:

MegaApuTurkUltra wrote:

MartinBraendli2 wrote:

MegaApuTurkUltra wrote:

So we're not going to get a way to know absolute position / direction?
Absolute direction doesn't matter, the position can be figured out (its not absolute, but relative to the walls).
Position cannot be figured out, since you don't know the distance to anything
Not without moving. But you have the Variable “Success”, that tells you, whether you are stuck or were able to move…
Ok then I don't like this challenge.

But if I don't do it CL's almost certainly winning…
MartinBraendli2
Scratcher
100+ posts

[ATC#6] Robo Golf

MegaApuTurkUltra wrote:

MartinBraendli2 wrote:

MegaApuTurkUltra wrote:

MartinBraendli2 wrote:

MegaApuTurkUltra wrote:

So we're not going to get a way to know absolute position / direction?
Absolute direction doesn't matter, the position can be figured out (its not absolute, but relative to the walls).
Position cannot be figured out, since you don't know the distance to anything
Not without moving. But you have the Variable “Success”, that tells you, whether you are stuck or were able to move…
Ok then I don't like this challenge.
Not bh, but curious. How come?
IcyCoder
Scratcher
1000+ posts

[ATC#6] Robo Golf

OK so mine is quite stupid right now
MegaApuTurkUltra
Scratcher
1000+ posts

[ATC#6] Robo Golf

MartinBraendli2 wrote:

MegaApuTurkUltra wrote:

MartinBraendli2 wrote:

MegaApuTurkUltra wrote:

MartinBraendli2 wrote:

MegaApuTurkUltra wrote:

So we're not going to get a way to know absolute position / direction?
Absolute direction doesn't matter, the position can be figured out (its not absolute, but relative to the walls).
Position cannot be figured out, since you don't know the distance to anything
Not without moving. But you have the Variable “Success”, that tells you, whether you are stuck or were able to move…
Ok then I don't like this challenge.
Not bh, but curious. How come?
I'd prefer a challenge where the task is more complicated but you have all the world info you want.
TheMonsterOfTheDeep
Scratcher
1000+ posts

[ATC#6] Robo Golf

MartinBraendli2 wrote:

Btw, we're out of medals. Does anyone have a good idea for the design of the next medals? Ideally without changing the general look too much.
I don't have a good idea, but I do have an idea:

If I am supposed to make medals with 1-5 on them, I can do that, but if I have to use 6-10 I don't know how to do that. Also this might be too extravagant.

EDIT: Huh, it looked better in GIMP. I'm going to see if I can fix it…
EDIT2: Fixed.

Last edited by TheMonsterOfTheDeep (Aug. 20, 2016 02:33:25)

IcyCoder
Scratcher
1000+ posts

[ATC#6] Robo Golf

MegaApuTurkUltra wrote:

MartinBraendli2 wrote:

MegaApuTurkUltra wrote:

MartinBraendli2 wrote:

MegaApuTurkUltra wrote:

MartinBraendli2 wrote:

MegaApuTurkUltra wrote:

So we're not going to get a way to know absolute position / direction?
Absolute direction doesn't matter, the position can be figured out (its not absolute, but relative to the walls).
Position cannot be figured out, since you don't know the distance to anything
Not without moving. But you have the Variable “Success”, that tells you, whether you are stuck or were able to move…
Ok then I don't like this challenge.
Not bh, but curious. How come?
I'd prefer a challenge where the task is more complicated but you have all the world info you want.
Well if you take a long time you can get all the info you want
IcyCoder
Scratcher
1000+ posts

[ATC#6] Robo Golf

There is a bug the view thing is all messed up
MegaApuTurkUltra
Scratcher
1000+ posts

[ATC#6] Robo Golf

IcyCoder wrote:

MegaApuTurkUltra wrote:

MartinBraendli2 wrote:

MegaApuTurkUltra wrote:

MartinBraendli2 wrote:

MegaApuTurkUltra wrote:

MartinBraendli2 wrote:

MegaApuTurkUltra wrote:

So we're not going to get a way to know absolute position / direction?
Absolute direction doesn't matter, the position can be figured out (its not absolute, but relative to the walls).
Position cannot be figured out, since you don't know the distance to anything
Not without moving. But you have the Variable “Success”, that tells you, whether you are stuck or were able to move…
Ok then I don't like this challenge.
Not bh, but curious. How come?
I'd prefer a challenge where the task is more complicated but you have all the world info you want.
Well if you take a long time you can get all the info you want
all the world info you want without wasting turns
MegaApuTurkUltra
Scratcher
1000+ posts

[ATC#6] Robo Golf

Argh “Initzialize” ಠ_ಠ
MegaApuTurkUltra
Scratcher
1000+ posts

[ATC#6] Robo Golf

Yay I made a really naive bot

It only takes about 1000 turns to finish


@when received "Initizalize" {
  setVariable("myName", "NaiveBot");
  addToList(getVariable("myName"), "Participants");
}
@when received "Start" {
  if(!getVariable("Running") == getVariable("myName")) {
    stop("this script");
  }
  state = 0;
  
  while(true) {
    if(state == 0) {
      rand = random(1, 3);
      if(rand == 1 && getVariable("Success") > 0) {
        broadcastAndWait("Move");
      } else {
        if(rand == 2) {
          broadcastAndWait("Turn Left");
          broadcastAndWait("Move");
        } else {
          broadcastAndWait("Turn Right");
          broadcastAndWait("Move");
        }
      }
      
      if((getVariable("Ball") == 0 && getVariable("View") <= 4)
          && getVariable("View") >= 1) {
        state = 1;
      }
      if(getVariable("Ball") > 0 && getVariable("View") == getVariable("Ball") + 4) {
        state = 1;
      }
    } else { if(state == 1) {
      if(getVariable("Success") > 0) {
        broadcastAndWait("Move");
      } else {
        broadcastAndWait("Interact");
        state = 0;
      }
    }}
  }
}

Last edited by MegaApuTurkUltra (Aug. 20, 2016 01:40:50)

IcyCoder
Scratcher
1000+ posts

[ATC#6] Robo Golf

MegaApuTurkUltra wrote:

Yay I made a really naive bot

It only takes about 1000 turns to finish
Ha it only takes mine less than 700

Powered by DjangoBB