private KOLEJNOSC odwrocRuch(KOLEJNOSC _ruch) { switch (_ruch) { case KOLEJNOSC.GORA: return KOLEJNOSC.DOL; case KOLEJNOSC.GORA_PRAWO: return KOLEJNOSC.DOL_LEWO; case KOLEJNOSC.PRAWO: return KOLEJNOSC.LEWO; case KOLEJNOSC.DOL_PRAWO: return KOLEJNOSC.GORA_LEWO; case KOLEJNOSC.DOL: return KOLEJNOSC.GORA; case KOLEJNOSC.DOL_LEWO: return KOLEJNOSC.GORA_PRAWO; case KOLEJNOSC.LEWO: return KOLEJNOSC.PRAWO; case KOLEJNOSC.GORA_LEWO: return KOLEJNOSC.DOL_PRAWO; } return KOLEJNOSC.GORA; }
private bool czySciana(Wspolrzedne _obecny, KOLEJNOSC _ruch) { switch (_ruch) { case KOLEJNOSC.GORA: return !((_obecny.Y - 1 >= 0) && (mapa[_obecny.X, _obecny.Y - 1] == 0)); case KOLEJNOSC.GORA_PRAWO: return !((_obecny.Y - 1 >= 0) && (_obecny.X + 1 < wymiarX / SKALA) && (mapa[_obecny.X + 1, _obecny.Y - 1] == 0)); case KOLEJNOSC.PRAWO: return !((_obecny.X + 1 < wymiarX / SKALA) && (mapa[_obecny.X + 1, _obecny.Y] == 0)); case KOLEJNOSC.DOL_PRAWO: return !((_obecny.Y + 1 < wymiarY / SKALA) && (_obecny.X + 1 < wymiarX / SKALA) && (mapa[_obecny.X + 1, _obecny.Y + 1] == 0)); case KOLEJNOSC.DOL: return !((_obecny.Y + 1 < wymiarY / SKALA) && (mapa[_obecny.X, _obecny.Y + 1] == 0)); case KOLEJNOSC.DOL_LEWO: return !((_obecny.Y + 1 < wymiarY / SKALA) && (_obecny.X - 1 >= 0) && (mapa[_obecny.X - 1, _obecny.Y + 1] == 0)); case KOLEJNOSC.LEWO: return !((_obecny.X - 1 >= 0) && (mapa[_obecny.X + 1, _obecny.Y] == 0)); case KOLEJNOSC.GORA_LEWO: return !((_obecny.Y - 1 >= 0) && (_obecny.X - 1 >= 0) && (mapa[_obecny.X - 1, _obecny.Y + 1] == 0)); } return false; }