using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Snake { public class Worm { public List Body = new List(); public Worm(Cell startCell) { Body.Add(startCell); } public void Move(int x, int y, Map map) { Cell swapCell = map.Cells[x, y]; for (int i = 1; i < Body.Count; i++) { map.SwapCells(swapCell, Body[i]); swapCell = Body[i]; } } public void Eat(ref Cell cell) { cell.Type = CellTypes.Snake; Body.Add(cell); } } }