الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

أتعبتني هذه المسألة و أريد لها حلا

مغلق
بدأه hussain79_02 في 26 فبراير 2003 · 1 رد · 458 مشاهدة · في ارشيف قسم C/C++
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

السلام عليكم و رحمة الله و بركاته

اخوتي الاعزاء... مرحبا بكم مرة أخرى و أرجو منكم المساعدة فلقد اعيتني هذه المسألة و أرجو أن أحصل على حل لها( ارجو ان يكون الحل بلغة سي و ليس سي++) اذ تقول:

The game of life is a computer simulation of the life and death events of population of bacteria.Write a program to simulate the game of life. The program should determine the life, death and survival of bacteria from one generation to yhe next using the follwing rules:

• Every empty cell with three living neighbors will come to life in the next generation

• Any cell with one or zero neighbors will die of loneliness, while any cell with four or more neighbors will die from overcroweding.

• Any cell with two or three neighbors will live into the generation.

Program Requirments:

1. The cells of the game will be represented by a matrix ( 50 X 50 ) of type character>

2. A DisplyBacteria function that takes a matrix and its size then displays the matrix on the screen.

3. A InitializeBacteria function that takes a matrix and its size as parameters and randomly assigns 'X' (occupied cell ) or ' ' (empty cell) to all the cell in the matrix.

4. A CountNeighbors function that takes a matrix, its size, the position of a specified cell which is the row and column number.The function should calculate and return the number of neighbors(occupied cell) for a given cell.

5. A UpdateBacteria function that calls the CountNeighbors function and controls which cells live and die.

6. Display 100 generations. Clear the screen after each generation.

#2

أخي أرجو أن تقوم بقراءة قوانين الكتابة في المنتدى!

هذا الموضوع مغلق.

مواضيع مشابهة