SlideShare a Scribd company logo
1 of 2
Download to read offline
C Program:
The Snake game involves controlling a snake that moves along a 2D plane. The goal is to lead
this snake to an apple on the map, that upon eating, increases the length of the snake.
As more apples are eaten, the player must be careful as they move the snake, as the game will
end if the snake moves back into their tail.
For this exercise, you will be implementing a simpler version of Snake. This version involves:
Spawning the snake and the apple
Moving the snake up/down/left/right in a loop (using u/d/l/r commands)
Ending the game when the snake reaches the apple
Since this game is fundamentally about moving a snake on a 2D plane, it should make sense to
represent this as a 2D array in code. In the starter code provided, you should notice that the first
line of code in the main() function defines this array as:
enum land map[SIZE][SIZE];
This means that the map is made up only of values defined in the enum land definition above the
main() function.
Let's have a look at what each value in enum land represents:
NOT_VISITED - Indicates a land tile that the snake has not visited yet
VISITED - Indicates a land tile that the snake has visited
SNAKE - The land tile the snake is currently on
APPLE - The land tile the apple is currently on
You have been provided a print_map() function that will print the 2D array with the enum land tiles
set.
Make sure you understand everything mentioned above before reading the example below!
#include <stdio.h>
#define SIZE 8
enum land {
NOT_VISITED,
VISITED,
SNAKE,
APPLE
};
void initialise_map(enum land map[SIZE][SIZE]);
void print_map(enum land map[SIZE][SIZE]);
int main(void) {
enum land map[SIZE][SIZE];
initialise_map(map);
printf("Welcome to Snake!n");
// TODO: Complete the program HERE
return 0;
}
void initialise_map(enum land map[SIZE][SIZE]) {
for (int row = 0; row < SIZE; ++row) {
for (int col = 0; col < SIZE; ++col) {
map[row][col] = NOT_VISITED;
}
}
}
void print_map(enum land map[SIZE][SIZE]) {
for (int row = 0; row < SIZE; ++row) {
for (int col = 0; col < SIZE; ++col) {
if (map[row][col] == NOT_VISITED) {
printf(". ");
} else if (map[row][col] == VISITED) {
printf("- ");
} else if (map[row][col] == SNAKE) {
printf("S ");
} else if (map[row][col] == APPLE) {
printf("A ");
}
}
printf("n");
}
}

More Related Content

More from jaipur2

Bullying according to noted expert Dan Olweus poisons t.pdf
Bullying according to noted expert Dan Olweus poisons t.pdfBullying according to noted expert Dan Olweus poisons t.pdf
Bullying according to noted expert Dan Olweus poisons t.pdfjaipur2
 
C++ Please I am posting the fifth time and hoping to get th.pdf
C++ Please I am posting the fifth time and hoping to get th.pdfC++ Please I am posting the fifth time and hoping to get th.pdf
C++ Please I am posting the fifth time and hoping to get th.pdfjaipur2
 
C++ only plz Write a function that takes two arguments and .pdf
C++ only  plz Write a function that takes two arguments and .pdfC++ only  plz Write a function that takes two arguments and .pdf
C++ only plz Write a function that takes two arguments and .pdfjaipur2
 
C++ only 319 LAB Exact change Write a program with total c.pdf
C++ only 319 LAB Exact change Write a program with total c.pdfC++ only 319 LAB Exact change Write a program with total c.pdf
C++ only 319 LAB Exact change Write a program with total c.pdfjaipur2
 
C++ Help with the section for doEditTweet only Program .pdf
C++ Help with the section for doEditTweet only  Program .pdfC++ Help with the section for doEditTweet only  Program .pdf
C++ Help with the section for doEditTweet only Program .pdfjaipur2
 
C++ is a highlevel programming language that consists of v.pdf
C++ is a highlevel programming language that consists of v.pdfC++ is a highlevel programming language that consists of v.pdf
C++ is a highlevel programming language that consists of v.pdfjaipur2
 
C++ Help with the section for getNextId only Program to.pdf
C++ Help with the section for getNextId only  Program to.pdfC++ Help with the section for getNextId only  Program to.pdf
C++ Help with the section for getNextId only Program to.pdfjaipur2
 
C++ Help with the section for doEditTweet only NOT using s.pdf
C++ Help with the section for doEditTweet only NOT using s.pdfC++ Help with the section for doEditTweet only NOT using s.pdf
C++ Help with the section for doEditTweet only NOT using s.pdfjaipur2
 
C++ Programming Exercise 9 from Chapter 16 Upload your so.pdf
C++  Programming Exercise 9 from Chapter 16 Upload your so.pdfC++  Programming Exercise 9 from Chapter 16 Upload your so.pdf
C++ Programming Exercise 9 from Chapter 16 Upload your so.pdfjaipur2
 
BU RESTORAN KURTARILABLR M Juan ve Bonita Gonzales Ohio .pdf
BU RESTORAN KURTARILABLR M  Juan ve Bonita Gonzales Ohio .pdfBU RESTORAN KURTARILABLR M  Juan ve Bonita Gonzales Ohio .pdf
BU RESTORAN KURTARILABLR M Juan ve Bonita Gonzales Ohio .pdfjaipur2
 
C Sao Paulodaki Lumiar okulunda snf ev devi veya oyun zam.pdf
C Sao Paulodaki Lumiar okulunda snf ev devi veya oyun zam.pdfC Sao Paulodaki Lumiar okulunda snf ev devi veya oyun zam.pdf
C Sao Paulodaki Lumiar okulunda snf ev devi veya oyun zam.pdfjaipur2
 
Bu eitim modlnde sunulan biyolojik tehlike tanmndaki gve.pdf
Bu eitim modlnde sunulan biyolojik tehlike tanmndaki gve.pdfBu eitim modlnde sunulan biyolojik tehlike tanmndaki gve.pdf
Bu eitim modlnde sunulan biyolojik tehlike tanmndaki gve.pdfjaipur2
 
C problem 1 Create Ellipse object Ellipse set fill to Col.pdf
C problem 1 Create Ellipse object Ellipse set fill to Col.pdfC problem 1 Create Ellipse object Ellipse set fill to Col.pdf
C problem 1 Create Ellipse object Ellipse set fill to Col.pdfjaipur2
 
C Program Jrite a program called that prompts the user to en.pdf
C Program Jrite a program called that prompts the user to en.pdfC Program Jrite a program called that prompts the user to en.pdf
C Program Jrite a program called that prompts the user to en.pdfjaipur2
 
c Design a Turing Machine for the following language Lab.pdf
c Design a Turing Machine for the following language Lab.pdfc Design a Turing Machine for the following language Lab.pdf
c Design a Turing Machine for the following language Lab.pdfjaipur2
 
c Give the corresponding snapshots of memory after the fol.pdf
c Give the corresponding snapshots of memory after the fol.pdfc Give the corresponding snapshots of memory after the fol.pdf
c Give the corresponding snapshots of memory after the fol.pdfjaipur2
 
C Language Question 1 4 points Listen Which of the fo.pdf
C Language   Question 1 4 points   Listen Which of the fo.pdfC Language   Question 1 4 points   Listen Which of the fo.pdf
C Language Question 1 4 points Listen Which of the fo.pdfjaipur2
 
C Outine Lozanos strengths and weaknesses as revealed by y.pdf
C Outine Lozanos strengths and weaknesses as revealed by y.pdfC Outine Lozanos strengths and weaknesses as revealed by y.pdf
C Outine Lozanos strengths and weaknesses as revealed by y.pdfjaipur2
 
c Originally when Hubble proposed this classification he .pdf
c Originally when Hubble proposed this classification he .pdfc Originally when Hubble proposed this classification he .pdf
c Originally when Hubble proposed this classification he .pdfjaipur2
 
c Explain the difference between a single user operating sy.pdf
c Explain the difference between a single user operating sy.pdfc Explain the difference between a single user operating sy.pdf
c Explain the difference between a single user operating sy.pdfjaipur2
 

More from jaipur2 (20)

Bullying according to noted expert Dan Olweus poisons t.pdf
Bullying according to noted expert Dan Olweus poisons t.pdfBullying according to noted expert Dan Olweus poisons t.pdf
Bullying according to noted expert Dan Olweus poisons t.pdf
 
C++ Please I am posting the fifth time and hoping to get th.pdf
C++ Please I am posting the fifth time and hoping to get th.pdfC++ Please I am posting the fifth time and hoping to get th.pdf
C++ Please I am posting the fifth time and hoping to get th.pdf
 
C++ only plz Write a function that takes two arguments and .pdf
C++ only  plz Write a function that takes two arguments and .pdfC++ only  plz Write a function that takes two arguments and .pdf
C++ only plz Write a function that takes two arguments and .pdf
 
C++ only 319 LAB Exact change Write a program with total c.pdf
C++ only 319 LAB Exact change Write a program with total c.pdfC++ only 319 LAB Exact change Write a program with total c.pdf
C++ only 319 LAB Exact change Write a program with total c.pdf
 
C++ Help with the section for doEditTweet only Program .pdf
C++ Help with the section for doEditTweet only  Program .pdfC++ Help with the section for doEditTweet only  Program .pdf
C++ Help with the section for doEditTweet only Program .pdf
 
C++ is a highlevel programming language that consists of v.pdf
C++ is a highlevel programming language that consists of v.pdfC++ is a highlevel programming language that consists of v.pdf
C++ is a highlevel programming language that consists of v.pdf
 
C++ Help with the section for getNextId only Program to.pdf
C++ Help with the section for getNextId only  Program to.pdfC++ Help with the section for getNextId only  Program to.pdf
C++ Help with the section for getNextId only Program to.pdf
 
C++ Help with the section for doEditTweet only NOT using s.pdf
C++ Help with the section for doEditTweet only NOT using s.pdfC++ Help with the section for doEditTweet only NOT using s.pdf
C++ Help with the section for doEditTweet only NOT using s.pdf
 
C++ Programming Exercise 9 from Chapter 16 Upload your so.pdf
C++  Programming Exercise 9 from Chapter 16 Upload your so.pdfC++  Programming Exercise 9 from Chapter 16 Upload your so.pdf
C++ Programming Exercise 9 from Chapter 16 Upload your so.pdf
 
BU RESTORAN KURTARILABLR M Juan ve Bonita Gonzales Ohio .pdf
BU RESTORAN KURTARILABLR M  Juan ve Bonita Gonzales Ohio .pdfBU RESTORAN KURTARILABLR M  Juan ve Bonita Gonzales Ohio .pdf
BU RESTORAN KURTARILABLR M Juan ve Bonita Gonzales Ohio .pdf
 
C Sao Paulodaki Lumiar okulunda snf ev devi veya oyun zam.pdf
C Sao Paulodaki Lumiar okulunda snf ev devi veya oyun zam.pdfC Sao Paulodaki Lumiar okulunda snf ev devi veya oyun zam.pdf
C Sao Paulodaki Lumiar okulunda snf ev devi veya oyun zam.pdf
 
Bu eitim modlnde sunulan biyolojik tehlike tanmndaki gve.pdf
Bu eitim modlnde sunulan biyolojik tehlike tanmndaki gve.pdfBu eitim modlnde sunulan biyolojik tehlike tanmndaki gve.pdf
Bu eitim modlnde sunulan biyolojik tehlike tanmndaki gve.pdf
 
C problem 1 Create Ellipse object Ellipse set fill to Col.pdf
C problem 1 Create Ellipse object Ellipse set fill to Col.pdfC problem 1 Create Ellipse object Ellipse set fill to Col.pdf
C problem 1 Create Ellipse object Ellipse set fill to Col.pdf
 
C Program Jrite a program called that prompts the user to en.pdf
C Program Jrite a program called that prompts the user to en.pdfC Program Jrite a program called that prompts the user to en.pdf
C Program Jrite a program called that prompts the user to en.pdf
 
c Design a Turing Machine for the following language Lab.pdf
c Design a Turing Machine for the following language Lab.pdfc Design a Turing Machine for the following language Lab.pdf
c Design a Turing Machine for the following language Lab.pdf
 
c Give the corresponding snapshots of memory after the fol.pdf
c Give the corresponding snapshots of memory after the fol.pdfc Give the corresponding snapshots of memory after the fol.pdf
c Give the corresponding snapshots of memory after the fol.pdf
 
C Language Question 1 4 points Listen Which of the fo.pdf
C Language   Question 1 4 points   Listen Which of the fo.pdfC Language   Question 1 4 points   Listen Which of the fo.pdf
C Language Question 1 4 points Listen Which of the fo.pdf
 
C Outine Lozanos strengths and weaknesses as revealed by y.pdf
C Outine Lozanos strengths and weaknesses as revealed by y.pdfC Outine Lozanos strengths and weaknesses as revealed by y.pdf
C Outine Lozanos strengths and weaknesses as revealed by y.pdf
 
c Originally when Hubble proposed this classification he .pdf
c Originally when Hubble proposed this classification he .pdfc Originally when Hubble proposed this classification he .pdf
c Originally when Hubble proposed this classification he .pdf
 
c Explain the difference between a single user operating sy.pdf
c Explain the difference between a single user operating sy.pdfc Explain the difference between a single user operating sy.pdf
c Explain the difference between a single user operating sy.pdf
 

Recently uploaded

Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementmkooblal
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfSumit Tiwari
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceSamikshaHamane
 
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,Virag Sontakke
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfUjwalaBharambe
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfadityarao40181
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxJiesonDelaCerna
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaVirag Sontakke
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfMahmoud M. Sallam
 
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxHistory Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxsocialsciencegdgrohi
 

Recently uploaded (20)

Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of management
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in Pharmacovigilance
 
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdf
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptx
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of India
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdf
 
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxHistory Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
 

C Program The Snake game involves controlling a snake that .pdf

  • 1. C Program: The Snake game involves controlling a snake that moves along a 2D plane. The goal is to lead this snake to an apple on the map, that upon eating, increases the length of the snake. As more apples are eaten, the player must be careful as they move the snake, as the game will end if the snake moves back into their tail. For this exercise, you will be implementing a simpler version of Snake. This version involves: Spawning the snake and the apple Moving the snake up/down/left/right in a loop (using u/d/l/r commands) Ending the game when the snake reaches the apple Since this game is fundamentally about moving a snake on a 2D plane, it should make sense to represent this as a 2D array in code. In the starter code provided, you should notice that the first line of code in the main() function defines this array as: enum land map[SIZE][SIZE]; This means that the map is made up only of values defined in the enum land definition above the main() function. Let's have a look at what each value in enum land represents: NOT_VISITED - Indicates a land tile that the snake has not visited yet VISITED - Indicates a land tile that the snake has visited SNAKE - The land tile the snake is currently on APPLE - The land tile the apple is currently on You have been provided a print_map() function that will print the 2D array with the enum land tiles set. Make sure you understand everything mentioned above before reading the example below! #include <stdio.h> #define SIZE 8 enum land { NOT_VISITED, VISITED, SNAKE, APPLE }; void initialise_map(enum land map[SIZE][SIZE]); void print_map(enum land map[SIZE][SIZE]); int main(void) { enum land map[SIZE][SIZE]; initialise_map(map); printf("Welcome to Snake!n"); // TODO: Complete the program HERE return 0; } void initialise_map(enum land map[SIZE][SIZE]) { for (int row = 0; row < SIZE; ++row) {
  • 2. for (int col = 0; col < SIZE; ++col) { map[row][col] = NOT_VISITED; } } } void print_map(enum land map[SIZE][SIZE]) { for (int row = 0; row < SIZE; ++row) { for (int col = 0; col < SIZE; ++col) { if (map[row][col] == NOT_VISITED) { printf(". "); } else if (map[row][col] == VISITED) { printf("- "); } else if (map[row][col] == SNAKE) { printf("S "); } else if (map[row][col] == APPLE) { printf("A "); } } printf("n"); } }