Can anyone tell me if this is possible to do in Linq?
- by user275561
So I have been working and trying for a couple of hours. I am creating a BubbleBreaker type of game. I Can do it using for loop or while but I am trying to also get practice in using Linq. Here is what I am trying to do in pesudo code.
Each Bubble has a Column and Row Property. If The bubble subtracts one from its Column property and finds the same Color bubble, it should Select it then Subtract -1 and see if two bubbles away there is also a same color bubble. If there is then subtract -2 and so on. So What I am trying to do is
var test= _theBubbles.TakeWhile((i, s) => i.BubbleColor== bubble.BubbleColor)//Then somehow tell it to do bubble.Column-s
and then Subtract s from bubble.Column So the Idea is to keep looking down the column till the bubble isnt the same