Can anyone tell me if this is possible to do in Linq?
Posted
by user275561
on Stack Overflow
See other posts from Stack Overflow
or by user275561
Published on 2010-04-07T22:01:56Z
Indexed on
2010/04/07
22:03 UTC
Read the original article
Hit count: 260
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
© Stack Overflow or respective owner