Bueno,es que he empezado la carrera y nos han dicho de hacer este programa.
Lo he estado viendo y,no sé hacerlo.
Si alguien puede pasarme aunque sea el principio,se lo agradecería un montón.
No es un trabajo lo que me piden,pero quiero aprender a ver cómo va.
Uso Pascal ISO 10206(el DEV-GNU en Windows)
(Sé que esta es la página en inglés,pero es que en la de España no me respondieron a ninguna de mis preguntas)
GRACIAS!!!!
----------------------------------------
Someone know how to do the Game of Live(Conway)?
Is to do it in PASCAL ISO 10206(DEV-GNU)
The teacher tell us about the program and I wanted to know how I can do it in Pascal.
Please,if you know, could you give me the first part or try to explain(in easy words) how I need to do?
THANKS YOU SO MUCH!!!
(the spanish education in languages is weird,so.....Sorry 4 my bad english)....
Update:And not,it isn't homework. The teacher talk us about the Game Of Life.
No,no me mandaron tareas/deberes,no lo son. Esto se nos comentó en clase y me interesa.
Copyright © 2024 1QUIZZ.COM - All rights reserved.
Answers & Comments
Verified answer
Conway's Life is based on some simple rules. For both these rules you need to count the number of occupied cells surrounding any given cell. Then in the program you need to loop over all the cells. Ideally you need an infinite amount of space, however, you can get good results by ignoring the outermost ring of cells. That is, leave a border where you do not create any occupied cells.
Imagine you have a "board" of 100 cells by 100 cells. In the program you will need to have a current board and a next board. You will look at the cells in the current board and write the next move in the next board. You will then need to swap them over and repeat.
Your program will be something like this pseudo-code:
For xCell = 1 to 99
For yCell = 1 to 99
CellCount=0
For x = xCell-1 to xCell+1
For y = yCell-1 to yCell+1
If (x<>xCell AND y<>yCell) AND OldCell(xCell,yCell)=Occupied then CellCount=CellCount+1
Next y
Next x
If CellCount>3 then NewCell(xCell,yCell)=Empty
If CellCount=3 then NewCell(xCell,yCell)=Occupied
If CellCount<2 then NewCell(xCell,yCell)=Empty
If CellCount=2 AND OldCell(xCell,yCell)=Occupied then NewCell(xCell,yCell)=Occupied
Next yCell
Next xCell
You will need to display the old board while you are processing.
After processing change the new board for the one on the screen and the display should update smoothly.
Best of luck.
http://www.youtube.com/watch?v=XcuBvj0pw-E