Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <conio.h>
- using namespace std;
- enum E_ELEMENTY_MAPY {Eel_pusty = 46, // znak '.'
- Eel_postac = 111}; // znak 'o'
- /*----------------------------------------------------------------------------*/
- const unsigned wielkosc_mapy = 15; // wielkosc mapy
- E_ELEMENTY_MAPY IT_mapa [wielkosc_mapy][wielkosc_mapy];
- const char Start_wiersz = 0; // indeksy poczatkowe
- const char Start_kolumna = 0;
- /*----------------------------------------------------------------------------*/
- void wypelnianie_IT_mapa (void) {
- for (int i=0;i<wielkosc_mapy;i++) {
- for (int j=0;i<wielkosc_mapy;j++) {
- IT_mapa[j][i] = Eel_pusty; }
- }
- IT_mapa[Start_wiersz][Start_kolumna] = Eel_postac;
- };
- /*---------------------------------------------------------------------------*/
- void rysuj_mape()
- {
- char index_wierszy = 0;
- char index_kolumn = 0;
- system ("cls");
- cout << endl << " ";
- for (int i=0;i<(wielkosc_mapy*2+1);i++)
- { cout << "_"; }
- // rysowanie lini gornej
- cout << endl;
- for (int i=0;i<wielkosc_mapy;i++)
- {
- cout << " |";
- for (int j=0;j<wielkosc_mapy;j++)
- { cout << " " << static_cast<char>(IT_mapa[i][j]); }
- // rysowanie elementu tablicy
- cout << " |" << endl;
- }
- cout << " ";
- for (int i=0;i<(wielkosc_mapy*2+1);i++)
- { cout << "-"; }
- };
- /*----------------------------------------------------------------------------*/
- int ruch(void)
- {
- int wcisniety_klawisz = getch();
- if (wcisniety_klawisz == 224) {
- if (kbhit()){
- return getch();}
- } else { return wcisniety_klawisz; }
- };
Add Comment
Please, Sign In to add comment