logo
down
shadow

Turtle that has no effect on other turtles implementation but speeds up the reaction


Turtle that has no effect on other turtles implementation but speeds up the reaction

By : nus
Date : October 15 2020, 11:12 PM
it helps some times There are many ways to do this, of course. I can't tell what is going on in your program from the little snipped you include.
One way would be to have the catalyst be of a different breed:
code :


Share : facebook icon twitter icon
Query / create subset of turtles for each turtle

Query / create subset of turtles for each turtle


By : Garrawind
Date : March 29 2020, 07:55 AM
around this issue Okay, you have several choices here. You can get rid of the error by removing the []
code :
to find-dominant-flockmates
  let my-own-age-experience age-experience
  ask other turtles [
    ifelse age-experience > my-own-age-experience
      [ set more-dominant true ]
      [ set more-dominant false ]
  ]
  set dominant-flockmates other turtles with [ more-dominant ]
end
to find-dominant-flockmates
  let my-own-age-experience age-experience
  ask other turtles
  [ set more-dominant ifelse-value (age-experience > my-own-age-experience)
      [ true ]
      [ false ]
  ]
  set dominant-flockmates other turtles with [ more-dominant ]
end
to find-dominant-flockmates
  let my-own-age-experience age-experience
  set dominant-flockmates other turtles with [ age-experience > my-own-age-experience ]
end
Check for Turtles behind current turtle

Check for Turtles behind current turtle


By : Yael De Gale
Date : March 29 2020, 07:55 AM
like below fixes the issue You should read patch-ahead help from the official documentation.
Based on the documentation provided there, syntax is like this patch-ahead distance so if you want to look back you should use:
code :
patch-ahead -1
set t_dir heading
tick
patch-at-heading-and-distance t_dir -1
Can't get different speeds for game players in turtle module

Can't get different speeds for game players in turtle module


By : user2981740
Date : March 29 2020, 07:55 AM
help you fix your problem If I understand your need, you want good guys and bad guys to move at different speeds. A key to this is understanding there are two concepts of speed at work in the program: turtle's speed() method:
code :
player.speed(0)
good.speed(0)
bad.speed(10)
good.speed = randint(5, 8)
bad.speed = randint(5, 8)
y -= good.speed
y -= bad.speed
good.velocity = randint(1, 4)  # was .speed
bad.velocity = randint(5, 8)  # was .speed
y -= good.velocity  # was .speed
y -= bad.velocity  # was .speed
# Our module's
from turtle import Screen, Turtle
from random import randint

# Functions
def go_left():
    player.direction = 'left'

def go_right():
    player.direction = 'right'

# Screen
screen = Screen()
screen.setup(width=800, height=600)
screen.title("Falling Piece's mini_game by Rafa94")
screen.bgcolor('purple')
screen.tracer(0)

# player
player = Turtle()
player.shape('turtle')
player.speed('fastest')
player.color('blue')
player.penup()
player.sety(-250)  # y is positive in the up direction; negative in the down direction
player.direction = 'stop'

# Create a list of good players
# Good represents good_player
goods = []  # Empty list

# Add good players
for _ in range(20):  # We are making a set of 20 players

    # We want the other players basically across from each other
    # thats we copyied the code one on -y and one on +y (first
    # player in the bottom, second player on top of Screen)

    good = Turtle()
    good.shape('circle')
    good.speed('fastest')
    good.color('red')
    good.penup()
    good.goto(-100, 250)  # y is positive in the up direction; negative in the down direction
    good.velocity = randint(1, 4)
    goods.append(good)

# Create a list of bad players
# Bad represents bad_players
bads = []  # Empty list

# Add bad players
for _ in range(20):  # we are making a set of 20 players

    # We want the other player basically across from each other
    # thats we copyied the code one on -y and one on +y (first
    # player in the bottom, second player on top of Screen)

    bad = Turtle()
    bad.shape('circle')
    bad.speed('fastest')
    bad.color('yellow')
    bad.penup()
    bad.goto(100, 250)  # y is positive in the up direction; negative in the down direction
    bad.velocity = randint(5, 8)
    bads.append(bad)

# Keyboard Binding
screen.onkeypress(go_left, 'Left')
screen.onkeypress(go_right, 'Right')
screen.listen()  # Basically saying listen for keyboard input

# Main game loop
# While something is true it will repeat
while True:
    # Move player
    x = player.xcor()

    if player.direction == 'left':
        x -= 3
    elif player.direction == 'right':
        x += 3

    player.setx(x)

    # Move Good Player
    for good in goods:
        y = good.ycor() - good.velocity  # We want the ball to be falling at a smooth speed
        good.sety(y)

        if y < -300:
            # Check if it's off the Screen
            x = randint(-380, 380)
            y = randint(300, 400)
            good.goto(x, y)
        elif good.distance(player) < 20:
            # Check for collision with player
            x = randint(-380, 380)
            y = randint(300, 400)
            good.goto(x, y)

    # Move bad Player
    for bad in bads:
        y = bad.ycor() - bad.velocity  # We want the ball to be falling at a slow speed
        bad.sety(y)

        if y < -300:
            # Check if it's off the Screen
            x = randint(-380, 380)
            y = randint(300, 400)
            bad.goto(x, y)
        elif bad.distance(player) < 20:
            # Check for collision with player
            x = randint(-380, 380)
            y = randint(300, 400)
            bad.goto(x, y)

    # Update screen
    screen.update()

screen.mainloop()
How can I get Netlogo turtle coordinates which can then be used by the other turtles to navigate them to that turtle?

How can I get Netlogo turtle coordinates which can then be used by the other turtles to navigate them to that turtle?


By : Greg Carter
Date : March 29 2020, 07:55 AM
Hope this helps In netlogo, I have four turtles, one Pacman turtle and 3 ghosts which will attempt to track the Pacman down by using its location that should be reported inside a variable, but I can't understand how to retrieve the Pacman turtle's location and store it in a variable. This variable should be updated with every move the Pacman makes so that the ghosts are attracted to the newest patch location where the Pacman was. , This should get you started. (Not tested.)
How can I ask a turtle to count the number of other turtles which have a turtle-own value bigger than myself?

How can I ask a turtle to count the number of other turtles which have a turtle-own value bigger than myself?


By : Lionel Sausin
Date : October 12 2020, 12:00 PM
like below fixes the issue Your code is mostly correct.
Try the below. Essentially, I removed the outside the of myself because the reference of who myself is refers to the caller of the caller---you have direct access to dis-door1 in the scope of ask people [...here...]
code :
ask people[
  set dis-door1 distancexy 15 0
  set dis-door2 distancexy 0 15
  set density1 (count people with [([dis-door1] of other people) < ([dis-door1] of myself)]) / dis-door1
  set density2 (count people with [([dis-door2] of other people) < ([dis-door2] of myself)]) / dis-door2
  ]
Related Posts Related Posts :
  • weight update of one random layer in multilayer neural network using backpagation?
  • Find most recent date in a list of objects on LocalDate property using Java 8 stream
  • deflateSetDictionary usage
  • Getting Me using Azure OAuth 2 Token
  • How do I get an Aspara Video playauth?
  • Avoiding memory leaks with Commanded in an aggregate that doesn't produce an event
  • Terraform: How to get a boolean from interpolation?
  • How can I disable shift (or any modifier) for some keys but not for others?
  • How to access component model from outside
  • Formatting decimal output when multiplying all numerical values in a string?
  • How to solve the numerical instability to a solution of a system of ordinary differential equations
  • How can I determine if a row has changed?
  • Inherited software that's built on Visual FoxPro, How can I access the source files and edit the program as needed?
  • Problem accessing orion-psb-image-R5.4 on FIWARE Lab using ssh
  • Check if List of Matrix Indexes are adjacent
  • View availability message on summary page Cart
  • Spring AMQP RabbitMQ RPC - Queue with with some messages that do not expect a response
  • App Pool Login Failed Message in New Acumatica Version
  • New-AzureRmSqlDatabaseImport does not accept a DatabaseMaxSizeBytes greater than 5GB
  • How to get the list of queues from a server?
  • Maxima plot discrete data with 3 columns
  • Referencing field from input in a Logstash filter
  • Chapel : Understanding lifetime of managed classes with zip and user-defined iterators
  • Compile With Static Library Using GNAT
  • Is there a way to receive most messages out of the standard SQS Queue? [NOT FIFO]
  • Remove shadow from XFCE panel
  • How do I serialize TransactionBuilder
  • How to disable Rule: one-line in TSLint
  • Automatically Ignore @OneToMany, @ManyToOne
  • Accidently renamed libc.so.6 and cannot chroot within rescue mode
  • A proper way to serialize/deserialize Xodus-dnq entity
  • How to hide the overlays in A frame?
  • PRelue is not supperted with mmdnn?
  • JasperReports: How to pass parameter to subReport
  • Is there built-in web analytics tool in Liferay?
  • 'if' scenario in an equation. How do I implement it?
  • Uncaught [CKEDITOR.editor] The instance "html" already exists
  • Trimming variable in CLLE
  • Slot not being passed from action to layout in Symfony 1.4
  • Are there any disadvantages of using C# 3.0 features?
  • How to download paypal transactions using some API
  • Microsoft CRM could not log you on to the system. Make sure your user record
  • Good acceleration structure for ray sphere tests with spheres that move
  • Draw formatted rich text
  • How can I sum values in column based on the value in another column?
  • JBoss eventually stops responding to request, but no OOME
  • Prevent inline-block from wrapping on white-space: pre?
  • Neural Network Recommendation Engine
  • Getting the return value of an exec process
  • Dynamics CRM: Create users with specific GUIDs
  • Languages used to write programs for satellite-missions?
  • is it possible to use only two semaphores to synchronise three or more threads?
  • Opengl ES - drawing a plane of multiple vertices
  • Make Aptana never use Windows line endings
  • Stub property and save other behaviour
  • What would you call "callback" or "closure" in general?
  • Drag a bezier curve to edit it
  • Archive/Compress Command FTP Through Terminal?
  • how can I use curly braces in a mysql query?
  • or operator in vbscript
  • shadow
    Privacy Policy - Terms - Contact Us © bighow.org