#How can I write this cleaner?

25 messages · Page 1 of 1 (latest)

worn root
thorn crescentBOT
#

This post has been reserved for your question.

Hey @worn root! Please use /close or the Close Post button above when you're finished. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.

TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.

modest stratus
#
  1. make it an array ffs how many times do i have to tell you
open elbow
#

first, create a list of your train station objects

#

or array

#

as that_guy mentioned

modest stratus
#
  1. loop through the array and count how many have cyan backgrounds, then check if that number is >= 2
open elbow
#

and count the elements with the specified colour

worn root
#

How can I count how many CYAN backgrounds have?

modest stratus
#

loop, check, increment variable

worn root
#

like this?

modest stratus
#

have them already be an array

#

ive told you this so many times already

#

bahnhofN - bad
bahnhofs[i] - better

#

you should not have those bahnhof1 at all

worn root
modest stratus
#

no it isn't

#

and it wouldn't have been if you had just used arrays from the start

#

also, use camelCase methods, not snake_case

#

you're here every so often asking for code review, when it's all just mostly the same issue. numbered variables. you'd think you'd learn by now

#

also, you can just use background++;

worn root
modest stratus
#

it. huh?

#

you're already using it