#๐Ÿ”’ can someone explain to me what this is asking pls

48 messages ยท Page 1 of 1 (latest)

quasi lynx
crimson nexusBOT
#

@quasi lynx

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

vernal spindle
quasi lynx
#

I don't get the whole question, so basically it's a grid with different cells, and it's asking to calculate the neighbours living in one cell?

#

but if that's the case, why in the testing part, it gives us a full grid instead of just one cell

vernal spindle
quasi lynx
#

what does it mean to be on/off tho

vernal spindle
#

given a cell, how many of its neighbours are on

#

if the value is 0, it is off. If the value is 1, it is on

#

basically, how many cell neighbours are 1s

quasi lynx
#

ok I kinda get it

#

but then what does this mean then

vernal spindle
#

since this is a grid, we're just scanning all the positions around the current position. We need to make sure the position we're looking at actually is on the grid

#

if 0, 0 is the top left corner, then our neighbour -1, 0 would not be valid

quasi lynx
#

wait so if that cell is on, then we're just adding the value of the cell to the living amount right

quasi lynx
vernal spindle
vernal spindle
#

x is the grid, i and j are your coordinates

#

it's super confusing that they decided to use these parameter names though

quasi lynx
#

oooh ok I think I get it?

vernal spindle
#

the names are explained in the comment at least

quasi lynx
#

yh I'm just counfused mainly because of this sentence

vernal spindle
#

they give an example for checking the top left neighbour. You just need to complete the logic for the other 7 neighbours

#

they show you the logic for each neighbour

quasi lynx
#

ahhh ok

vernal spindle
#

let's say that my current position is 3, 3

#

2, 2 would be the top left

#

2, 3 would be top mid

#

2, 4 would be top right

#

etc

quasi lynx
#

oooh so basically

#

the number of neighbours living in one cell

#

is based on the neighbours living in the 8 cells around it?

vernal spindle
#

and every cell has 8 neighbours

#

(unless a boundary)

quasi lynx
vernal spindle
#

yes, which is "how many neighbours are on of any given cell"

quasi lynx
#

ooooooooh ok I get it

#

thank you very much

#

!close

crimson nexusBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.