[game of life] how to clear the screen on the mac
I am using Xcode on the Mac and run into problems when I use system("cls"). Is there a command to clear the screen for the Mac?
The output window is also telling me 'TERM environment variable not set'. Anyone any ideas on how to adapt the Game of Life program for use in Xcode?
Well, I don't use xcode (though I use the xcode GCC, I compile it from terminal), I just didn't use the system("cls"), and I don't know about the TERM part
OK, I've got this figured out (hopefully). As far as I understand it is not possible to use the system("cls") or system("clear") code in the output window of Xcode. It took me some time to find and use the terminal window on my Mac, but I am now able to use gcc and compile the code. The program runs now but it still needs some tweaking to adjust to the mac. It is too fast (already a topic in this forum) and it prints ? instead of nice little people.
They do point out in the video that if you are in Unix or OSX, you'll want to use "clear" instead of "cls". I'm on a Mac myself, and it's been fun writing in the terminal and trying to keep things straight as we've gone through the lessons. I have no idea how much more difficult it would be to try to follow along in Xcode.
I just finished the Game of Life videos, and, working with their file, I changed the "cls" on line 138 to "clear", compiled it in the terminal (gcc gameoflife.c -o gameoflife) and ran it (./gameoflife). It looked all messed up and didn't seem to do anything after I entered a generation number. Scrolling up in the terminal, I could see that it did, just very fast. Then I found this thread.
I'm still shaky on the whole programming thing, but I've always been good at tweaking code, so I figured I would try to make it work. I'd hoped to be able to attach the modified code to this post, but that's not an option, so I'll describe what I changed and you can follow along.
First I addressed the on-screen characters.
For case -1 (line 150), I went with '*' : this made the border.
I left case 0 (line 151) as ' '
For case 1 (line 152), I went with '@' : this made the 'life', somewhat snail-like, so it still works for me.
I compiled and ran the program and it looked much, much better. Still too fast though.
To address the speed I modified the sleep value on line 42 by adding a 0 to the right, recompiling, rerunning and repeating until the speed felt right. There may be a better way to do it, but this way worked. 100000 was almost there, so I changed it to 200000 and that seemed to work right on my screen.
I still have a lot to absorb from this lesson, and things to get straight in my own head, but I hope that's helpful to anyone else following along on a Mac.
i may use this kind of information too,
i just start using it, have no idea how to adotp it for using in Xcode
GameOfLife programed with NetBeans IDE 7.2 on Mac works very fine now with Collin Burton suggestions for Xcode!
Then a knife shield hand cut open the door
Then a knife shield hand cut open the door ,He cannot use small moment estimation ,he rubbed his hand over his mouth looked strained Cao chong ,Unless you use a strong forced him to agree , ,wholesale nfl jerseys,But the general thought not ,If he is right in saying that ,reserved ,
relationresultCao Chong andthey made a , relationresultDeng Aishook his head : Chen Gongcao said the rational ,some do not eat live painful scream ,no when brute forces in the mountains walk Ru-fei ,If not to draw Cao Ren out of town,louis vuitton official website,He was in the hands of three stone bow called Cao of the fiercest warriors ,,the others are gone ,
relationresultKuaiking an awkward smile , ,,General Cao Ren as the xi ,laughed humorlessly ,but I always feel a little bit strange ,Life is always so easily have a beginning, but you won't see his end. Handsome a fart to use! In the end also not be he eat! www.newlouisvuittonwebsite.com 1yXm, to a certain extent his countryman ,they died in prison ,
it is a polite took Ma Chao , ,he was not very clear ,,and out the door ,his four thousand army had no control of the Yangtze River ,We don like the God empty-handed walk ,and listening to them so yell ,
then to the battlefield ,will be another joke ? ,nike nfl jerseys, relationresultXun Yueyi mentionsthis ,incessantly ,Cang Shu ,relationresultThe emperorsuch as dead General lying on the couch ,sun ben to steal a glance road extract ,Life is always so easily have a beginning, but you won't see his end. Handsome a fart to use! In the end also not be he eat! 1712,louis vuitton for sale,Deng Ai returns the message ,
He saw Xu Yi some do not believe ,Gan Ning Department of blade will cut ,snapped : tell me , me not to interrupt him leg ,engage in a white KARASUMA horse , relationresultChen zunzhi ,Can also be managed to pick up something cheap ,This is to let him do vice Prime Minister ,
on both sides of cliffs stand,,it was summer , relationresult() Wei Yan about to speak,to separate the clothes to reveal his white chest ,Do people have to dust ,and Wei Yan emerge in its totality : we suspect ,arms ,
then smiled , relationresultMa ? Dare is opposite the park to Ma , you see how to do best ,He knew that these are definitely not Chen to men ,with Mr,With a large army came ,with a sigh ,somewhat irregular ,
That did the trick. Thanks!
On the subject of GCC, I tried the beginner videos with the Notepad++ and when I went to command prompt and tried to access GCC, it told me it was a fatal error. I can't get that part to work and followed their examples. In the path file it reads, \;C:NGwnn(or whatever its called)\bin\
I've tried a semi-colon, colon, and a few other things but keep getting the fatal error. I'm running windows 7 and the most recent versions of the programs needed for C. Thanks for the help.
In the path file it reads, \;C:NGwnn(or whatever its called)\bin\
The path entered into the evironment variable box has to EXACTLY match the actual location of where the gcc executable is. Each entry is terminated with the semicolon character ';' and each subdirectory element should be preceded by a backslash '\'.
In the example you give C: lacks a directory backslash and should read 'C:\NGwnn\Bin\' Dont forget the trailing slash either.
Welcome to the WiBit.net forums! Check out our terms and features:
Annoy your friends
Is this something you think someone else would enjoy? Is it not for you, but do you know someone who is down with this type of content? Well share away:
This blog is a reminder that cheating in software development can get you into big trouble. Sometimes developers get really really lazy, OR are pressured to write something using overly simplified data structures. Almost every time this happens you are bitten in the butt! Sometimes the problems show up immediately and other times it may take months or years (especially in integrated systems).
- 1 of 78