Recent Feedback
For unvadim only: The Mathematician John Horton Conway invented the "Game of Life." Though not a "game" in any traditional sense, it provides interesting behavior that is specified with only a few rules. This project asks you to write a program that allows you to specify an initial configuration. The program follows the rules of LIFE to show the continuing behavior fo the configuration.
LIFE is an organism that lives in a discrete, two-dimensional world. While this world is actually unlimited, we don't have that luxury, so we restrict the array to 80 characters wide by 22 character positions high. If you have access to a larger screen, by all means use it.
This world is an array with each cell capable of holding one LIFE cell. Generations mark the passing of time. Each generation brings births and deaths to the LIFE community. The births and deaths follow the following set of rules.
- We define each cell to have eight neighbor cells. The neighbors of a cell are the cells directly above, below, to the right, to the left, diagonally above to the lright and left, and diagonally below to the right and left.
- If an occupied cell has zero or one neighbors, it dies of loneliness. If an occupied cell has more than three neighbors, it dies of overcrowding.
- If an empty cell has exactly three occupied neighbor cells, there is a birth of a new cell to replace the empty cell.
- Births and deaths are instantaneous and occur at the changes of generation. A cell dying for whatever reason may help cause birth, but a newborn cell cannot resurrect a cell that is dying, nor will a cell's death prevent the death of another, say, by reducing the local population.
notes: Some configurations grow from relatively small starting configurations. Others move across the region. It is recommended that for the text output you use a rectangular array of char with 80 columns and 22 rows to store the LIFE world's successive generations. Use an asterisk * to indicate a living cell, and use blank to indicate an empty (or dead) ceall. If you have a screen with more rows than that, by all means make use of the whole screen.
Examples:
***
becomes
*
then becomes
again, and so on.
Hints: Define a void function named generation that takes the array we call world, an 80 column by 20 row array of char, which contains the initial configuration. The function scans the array and modifies the cells, marking the cells with birhts and deaths in accord with the rules listed earlier. This involves examinign each cell in turn, either killing the cell, letting it live, or, if the cell is empty, deciding whether a cell should be born. There should be a functiond isplay that accepts the array world and displays the array on the screen. Some sort of time delay is appropriate between calls to generation and display. To do this, your program should generate and display the next generation when you press Return. You are at libery to automate this, ut automation si not necessary fot the program.
Also be sure to add the following features:
a. Display the following menu when the program is executed:
[S]ave [L]oad [R]andom [M]anual S[t]ep [G]o St[o]p Cl[e]ar E[x]it.
Save: Saves the last generation to a file after stopping the game.
Load: Loads an initial pattern of living cells from a file.
- Provide the sub-menu with different filenames.
Random: Program generates an initial pattern of living cells.
Manual: A user provides an inital pattern of living cells using keyboard.
Step: Displays the next generation manually, one generation at a time.
Go: Automatically displays the next generations.
Clear: Clears the pattern of living cells.
Exit: Exits the program.
b. You many use different symobols to represent the dead cells and living cells.
c. You may choose different array size.
d. Refer to the following links:
http://okshaw.com/tools/life/life.htm
http://en.wikipedia.org/wiki/Conway's_Game_of_Life
http://www.youtube.com/watch?v=XcuBvj0pw-E
Optional Information: Computer OS: Windows Vista Browser: Firefox Programming Language: C++ Compiler: Dev- C++
Hi
so we are using this chat instead?
yes..
so as you see this one is 23... obviously much less than real value...
so you will have to bonus...
yes of course i will add bonus
how much are you eexpecting?
I would say arround 50
keep in mind I dont get all of it...
$50 worth of bonus?
yes, thus a 73 total from you
can you make it $47 bonus? so make it $70??
but then again i have to check the answer first before giving you the bonus
of course... I dont expect you to pay before you check and it runs as expected
ok..
I cant "set" any bonus ... its based on trust... I trust you that you will do it as agreed...
yes i will pay you as agreed
i just hope you'll do a good job because this determines my grade
ok... will work on it this afternoon, if I have it ready tonight, I will post it here, so you should be notified by am email..
I'll do my best... all 400 positive feedbacks and continuous 5 years of C++ development should help :)
ok. since its 1.40am PST, i am gonna sleep first. and will check back tomorrow
morning
I can say for sure It will not be ready in the next 6-7 hours...
check better your time afternoon
ok sure.
thanks alot :)
see ya... bye
can you provide your lecture notes chapter 01 to 07... so that I can see what topics you covered?!
this should help me write the code more appropriate style to what you learned.
hey
yes
it will be: the boolean expression, if-else statement, break and switch statement, do-while statement, for statement, while statement, using of loops, loop control, nested switch, for loop, type chat, type bool, use getch(), types int and double, simple branching mechanism, using predefined function, void functions, call-by reference, swap_values function, call-by-value, get and put function,one-dimensional array in function, one-dimensional array, partially filled array, searching an array, sorting an array, two-dimensional array, two-dimensional array in function
ok thanks
sure
already working on it for a couple hours, check back later in two hours.. might have it ready
i will be in class by then. i will check back once im done with class then. thanks
I have it ready... let me know when will you be available to test it.
http://wikisend.com/download/653080/game of life.zip
above is the executable which should allow you run it by double clicking on it..
its a zip archive extract it... should contain 4 files.. 3 of which are initial worlds samples in files to be loaded
and one is the executable... double click it to run... and test.
ok i will see it now
hey i only receive the zip
i cant compile and run it because i dont have the program
of course:)
extract the zip file
inside it has 4 files
i did extract it
i see 4 files
double click on the executable one
Game of life
i cant
theres a problem with that
dont open them in devc++ its not source code..
i need the source code dont i?
if you want to compiler yourself yes.. now I want you just to check if it runs fine
double click the executable file.. should run
no it did not run
itgives me an error message
what does it say?
the program cant start because libgcc_s_dw2-1.dll is missing from your computer
one sec
ok
http://wikisend.com/download/727112/gameoflife.zip
here's a devc++ project
choose open project in the devc++
and open this file: Game Of Life.dev
ok i opened that already
what next?
compile and run
you should have the source code there
ctrl+f9
and ctrl+f10
when i open the file
it tells me that main.cpp is not found
so i cant compile and run it
hmm strange....
so.. how do we do this?
try than opening the main.cpp
it comes out
so i just compile and run it?
ok i run it
but the "cells" did not appear
:)
when i put random, only "random world created!"
yes...
than you either need to choose step or go
oklet me try again
try better load.]
and choose one of pre-prepared files..
even when i try inserting manually , no cells appear
did you try step or go?
nothing appears
i put: 10 20-1
wrong...
thats not a world definition
then what is?
try:5 15 25 35 45 5 5 6-1
that will be a row of 6 consecutive cells with life
yap then it writes "user world ready!"
ok.. than try stept by step
or Go
Its similar to what youre doing
but my professor wants the cells to be in the same position.
not creating anotehr generation to another generation
what he said today was to clear screen display, clear screen display, so the cells stay at where they are
and the user actually keys in 20 10 -1 to create the rectangular world of cells
ok... will do clear screen display is a matter or printing 22 empty lines
"and the user actually keys in 20 10 -1 to create the rectangular world of cells"
doesnt make sence
the assignment says it clear.. the world is 80 x 22
its like the program ask the user to enter "The number of column:" and "The number of rows:"
and after the user input the number of columns and rows, the cells will appear as what the user inputs
but there is nothing to appear?! because initial world is empty unless you add coordinates for cells which have life
i understand what you mean. But, the professor showed an example in class
we can use your method, but not the cells only
we need a rectangular *************** and the cells are embedded inside
*******************************0***0****0***0*******
you mean empty spaces with * and life cells with 0 ?
lief cells should be represent by 1
and dead cells or empty spaces are 0
life*
I mean on screen?! what do you want to see for dead and life cells?
I've done everything as the assignment said... why didnt you include all the details than?!
see this version:http://www.wikisend.com/download/800688/main.cpp
it "clears" screen before displaying a new step
ok let me see
sorry because the professor just added new unformatino in class today
I am still confused.. I still dont know what you would like changed...
ok let me illustrate to you
see the assignment example, you can see that by entering 3 coordinates in a row like:2 12 2 2 3-1
so the cells should be like this:00001000010000000001000010000010000100000100010001000001000100010010
the 1 are the life cells something like that
but that will look like crap...
so the cells are moving in that rectangular box only!!
its much nicer with * and spaces
not clearing and display on different lines
it MUST stay where it is.... so the cells are moving IN that rectangular box
:) its impossible
you can use **** for the living cells
in c++ console applications its impossible7
but my professor showed it to us
to make them stay in the box...
you need to print many newlines so that previous contents moves out of voew
its the same as this
and print again
thats javascript :)
its not c++ console..
yes i think thats what he wants. but its in c++
please do understand... you cant get that box of ***** stay on screen and just update positions inside..
you need to move it out of the screen and than print again a new one
thats why he say clear and display and clear and display
because you didnt tell me that user has to enter rows and columns, now I have to redo half of the program .rrrrrrrrr
the assignment said it clear 80x22
im really sorry
i didnt know it'll be like that
are you familiar with pointers and dynamic memory allocation?
nope im not
than how do you pass bidimensional array to functions?
hmm sorry i was taught of memory allocatino before
you mean you are familiar with:char * array = new char[ 3 ];
he just taught that
there was a question on arrays that you did for me
none of the ones i did for you were using dynamic arrays
also in the list of topics, pointers are not covered
" two-dimensional array in function"do you have lecture notes for this chapter?
no
im using problem solving with C++ book
by walter savitch
do you this book as pdf?
no it dont have pdf
what do you want to know?
how do you use two dimensional arrays and pass them to function...
the way I know apparently is not covered in the topic list
///////////////// Example 1 /////////////////#include <iostream>using namespace std;const int rows = 2;const int columns = 3;void fill_array(int table[][columns]);void print_array(const int table[][columns]);int main(){ int table [rows] [columns]; fill_array(table); print_array(table); cout << endl; system ("pause"); return 0;}/* ****************************************************************** *//* ****************************************************************** */void fill_array(int table[][columns]){ for (int i = 0; i < rows; i++) { cout << "Enter scores for student " << i + 1 << endl; for (int j = 0; j < columns; j++) { cin >> table [j]; } }}/* ****************************************************************** *//* ****************************************************************** */void print_array(const int table[][columns]){ cout << "\t" << "\t"; for (int j = 0; j < columns; j++) cout << "Grade" << j + 1 << "\t"; cout << endl; cout << "\n\t "; for (int n = 0; n <= columns; n++) { cout << "--------"; } cout << endl; for (int i = 0; i < rows; i++) { cout << "Student" << i + 1 << " |" << "\t"; for (int j = 0; j < columns; j++) { cout << table [j] << "\t"; } cout << endl; }}
this is an example
many things need to change... if you want user to be able to type in world size..
check back tomorrow
tomorrow?
I've already spent too much time on this today
but this is due tomorrow 6am!
I thought you said you need it tomorrow night?
PST
which is tonight!!
i said that last night
it was 1 am when I was chating to you.. thus it was "today"
you said it was 1.45 am
damn. that was my mistake.
but i really need this assignment done by this midnight today
argh... its already close to midnight my time...
ok... stay on... in case I have more questions....
sorry for the miscom
http://ge.tt/8e3m9W6?c
see if that is closer to what you need
it displays 1 and 0
i cant open the file
sorry i can
yes something like that
but when i press for random, the cells did not randomly move
thats not random move!! it random sets life in aprox. 40% of cells
no! its supposed to move randomly
#Random: Program generates an initial pattern of living cells.
you got it wrong. what the professor means is that when the cells are already in the output, and when user press Random, it should move randomly
:) sorry but I think I got it right... what you say doesnt make sence when you refer to game of life
annd when i press load , they say they failed to load file
oh sorry need to give you 3 ffiles again
http://ge.tt/9TCAAW6?c
extract these 3 files and copy them to the same folder as main.cpp
the load option needs them to load initial world from one of them
wait let me see
hey when i pressed "Clear", it did not clear the whole screen
thus it clears the world?! it makes all cells empty
but theres still a problem
when i put manual
and?
its not working
i did like what you said
5 15 25 3-1
whats your world size?
15 30
i tried the same numbers.. and I get it ok...
did it say user world ready?
did you hit go or step?
yes i did
it works
but you still cant make the rectanglular box of cells stay at the same place?
isnt it allways at the bottom?
yes but the problem is. thats not what the professor wants!
he wants it to stay on the same place!!!
but it stays!!!
where do you see it moving?
no its just repititions
what do you mean repetitions?
its the same... generation by generation going doing
down*
but thats the "clear" & "display"
in c++ you cant overwrite symbols already on screen
you just move the stuff already on screen, of the screen... and display new stuff
so what i meannnnn is that the rectangular box will not move down for the next generation
you CANT overwrite symbols already on screen.
thus you have to "move" all up.. and display new stuff below.
but that was not what he showed me
show me what he showed you...
show me the code he used to do that...
i cant because he did nt give it to us
its first time I hear of such thing...
he just displayed in class
what did he display?!
did he show you a c++ code in devc++?
so the rectangular box of cells is displayed on the screen. and when the user press Go or Step, the rectangular box stays at the same place annd line on the screen
it just keeps flashing, clear and display on the screen, on the same place!!!! generation after generation
very different from yours
he doesnt want to see the previous generation on screen
so it should be CLEARED and the next generation would be displayed on the exact same place as the previous generation, just the cells places are different
are you familiar with teamviewer?
yes i am
start it... and give me details... I need to see what "you" see...
im not seeing it now!! he showed us in class
did u see the link i gave you?
YES... but the demo there is not a c++ application written in devc++ !!!!!!!!!!!!!!!!!!!!!
even if we use teamviewer, theres nothing you can see
I want to see how it looks on your screen... maybe its different than mine.. because on mine I see it allways on the bottom left corner and you dont I dont see the previous generations
ok i will show you
826 692 814
my id
password?
7862
you know what. if thats what you can do
wait.. let me do some research on this devc++
i'll just send this to my professor
maybe it has some hidden features
lol.. indeed devc++ compiler has some hidden features :)
what do you mean?
it has "clear screen" feature... which usually cant be found in many other c++ compilers
try this:
http://www.wikisend.com/download/425222/main.cpp
yes thats what i meant
phew
great
i will play around with it first
and if i have any problem with this
i will talk to you in here again
you need to be fast... I am not gonna be online for long
you can go offline first
i will be going to my next class now
you want see me online until tomorrow..
what time will you be online again?
tomorrow
same time as today.. probably 1 am PST
will you still be online by 9am?
probably yes... but you said you need this by midnight today
i need to send this to my professor first
today
he will get back to me by tomorrow morning
ok...
so I am not getting payed today ...
yeap but i will pay you by tomorrow morning
dont worry
ok see ya tomorrow
ok see ya
theres a problem. you did not include "STOP" in the menu
in the assignment description , Stop is not mentioned... what should it do?
but Stop is not mentioned
there should be
let me check
[S]ave oad [R]andom [M]anual S[t]ep [G]o St[o]p Cl[e]ar E[x]it
there is stop
St[o]p
yes... its no problem displaying... but that doesnt say what action should it take?!
or simply said, what should happen when that option is selected.
to stop whatever the cells are doing
:) but when the menu is displayed, you are already stoped
after pressing go, and if the user wants the thing to stop
please just include it inside
its one of the requirement
I can include the text ... but still not sure I understand what should happen if stop is selected
how comes there is no description for it in the assignment
because it is basically asking the program to stop what the cells are doing after the cells randomly display itself
if the user selects GO, the cells will keep displaying
and after that, if the user wants to stop what the cells are doing
it should sto
stop
but you stop that by hitting any key
then make it ONLY when the user presses st[o]p
then it stops, not just any keys
can you make that?
ok.. as you wish
here you gohttp://ge.tt/9KlEfW6?c
now after go... it will stop only when 'o' is pressed...
let me submit this to my professor and i'll get back to you by tomorrow evening latest
hwy
Experience: Good knowledge of OOP principles. 3+ years of programming experience with Java and C++. Sun Certified Java Programmer 5.0.
I see you accepted the answer....
yes and i wanted to ask you whats the bonus you want? FYI, i got 50/100 for this project!!!!!
well... I want as agreed....any reason for 50 ?! didnt the application run as by the assignment description?
?!