Our professor posted the last assignment for this class. This assignment is about writing an assignment that could potentially be posted as a 30 point assignment for the next semester Unix class. The assignment could be technical programming or just a written assignment. Providing solution was optional. I decided to make a technical programming assignment. I wrote an assignment that required to program that takes a character pointer and returns the character that occurred the most in the array. The main assumptions were that the array could be lower case and if there were more than one character that occurred the most the same number of times than the character that occurred the most first should be returned. I felt that this assignment is a good transition from python to c++. It is a good review of pointers and gets the students familiar to the ASCII table as well. What do you guys think?
As I mentioned earlier for our project we had to finish fixing the ship size and adding the multiplayer feature to the game. We are almost done with fixing the ship size. Once we are done with it, we will start on out next goal is to explore the world of networking. Since I worked on a project in which we programming a desktop game that functioned over the network, I feel somewhat confident that we might be able to use that thought process in this program as well. I think we need to explore chat server programs online. Since our grid is represented by a Array of string it will be easier for us to send data. I think the heart of our multiplayer feature over a network could just be as simple as a chat server. However, adding these features make a program complex. Since we are new to this idea, we are expecting to go through some tough time to figure this out.
I guess I never wrote about my teams final project. Our team is making a battleship game. So far we have the entire game running on the terminal. We have used QT to build our program. We thought of using QT since couple of people in our group are in Soft engineering class. They mainly use QT for all their HWs. So far the only issues we are facing is the size of different ships. Initially we assumed that the ship size would be 1. This helped us make the code modular and simpler. Now we just to need to fix ship sizes etc. Besides this we also have been looking at making the game multiplier over a WiFi network. Some of the classes that we have been looking at is QAbstractSocket. If we figure out how to setup a simple chat server then we could potentially have the game running over a network as well.
Past week we had a unix assignment in which we had to pipe two cpp files. One of the cpp files called “Generator.cpp” counted numbers and printed them to standard out. The other cpp file called “Consumer.cpp” took numbers from standard in took their average and printed it to standard out. Our assignment was to pipe them and also create a make file. Creating a Make file was really easy. The hardest part of this assignment I found was piping the two cpp files. At first I thought if U just use ./generator | ./consumer .. it should work, but I was wrong. The best way to this is to create a seperate cpp file in which you use fork command and also execute ./generator and ./consumer. Everything worked fine then. The key thing was to kill the ./generator using the kill command. One part that I was stuck on was waiting on the ./consumer to end. I used waitpid and wait command; however, it did not work. The generator executable was fine with the waitpid command. But ./consumer was not working. My program would get stuck when I called the wait command twice. If anyone have some thoughts on that then it would be great.
Past week in ECE 2524, we worked on Makefiles. I found it really interesting and a big time saver. Makefiles are basically used to compile c++ code. If you have a couple of files, it becomes tedious to use the g++ command again and again. So the main purpose behind Make files is to make that easier. A couple new terms I learned are target files and dependency. Basically, a target file could be any file that depends on a file. If there is a change in one of the dependency files, then that target file will be compiled again. At first, I was confused about the order. It doesn’t matter that much as long you have all the dependency files. But the order goes from left to right for dependency file. Also one this to note is the commands must go with a Tab character before it. This turns out to be something to be careful because you might put space and think it looks like a tab.
We also had an assignment on Make files. We had a couple of cpp files and header files. The files that were dependent on files were mentioned by the professor. They part that I found somewhat tricky was the bison and flex commands. But I figured out how to deal with it.
Hi everyone, This week we started on C++. We learned about G++ and GCC compilers.
I programmed in C++ before but using MS Visuals. So the commands like -Wall -g were
new to me. However, I found it simple. ‘-Wall’ just turns on the warning when
compiling the c++ code. We also learned about argc and argv. The thing that I was confused on was
that argv is an array of arguments including the name of the executable cpp file. I
thought it was just the arguments. However, it was arguments with the name of the
Hi everyone, Last week I had a midterm in Unix. Some of the stuff we were tested on was grep sed and awk commands. We were also given a python code which had some errors in it. One of the problems I found challenging at the beginning, but later it seemed easy was the change_grade python script. I read in the file correctly and separated stuff correctly, but when I was outputting back to the terminal I was getting an index error. It was really surprising because when I normally printed an array it was printing fine. But when I specified what parts of the array to print then I was getting index error. I am very sure that I specified the right index. One thing that I am doubtful about is that I might have changed the input file (may be an empty line at the end). We were also tested on finding hidden files in a directory. The professor was generous in giving us hints. I was getting extra information than I wanted, but the hints helped me to get to the right command.
Hi everyone, Assignment 4 was due last Wednesday. It was a fun assignment. I got to know about Dictionaries and list. We were suppose to maintain an inventory of parts. All our data was stored in a file called inventory. We had to write a program that would process this data through commands that the user would input such as add remove list etc. All these commands were supposed to be present in an action file. So it wasn’t terribly hard, but fairly challenging at the same time. We also had to design the format in which we wanted to store our data. One of challenging factors I found about this assignments was creating the data structure. I never had programming experience in Python before so the idea of the using a dictionary was a new to me. But after using it I found it somewhat similar to the idea of a struct in C++.
Hey everyone, Assignment 3 was due couple days back. We were suppose to write a program that is supposed to read from a standard input or a file and write to a standard output. The program also had to through standard error if there contained invalid input. We were also given a hint to use arg parse. For this program I used the sys module. It gave me access to the size of the arguments and what the arguments were. So from there I used simple logic to direct the program. When I was using arg parse, I was using the file type so when the user entered the “–ignore-blank” or “–ignore-non–numeric” the program gave error that the “–ignore-blank” or “–ignore-non-numeric” file directory was not found. So I decided to do it the other way. What I had to do was read the input and store the files in an array. I set up flags when the program read “–ignore-blank” or “–ignore-non-numeric” as an argument.
Hi Everyone, I finished the second exercise for python couple days back. There some things that I found different about python. One of them is that variables don’t need to be specified. For example if you are thinking of declaring a string or integer variable you don’t need to specify the word string or int before the variable.
This week we started looking at symbolic links and some commands. One of them is GREP. It stands for globally find regular expression. It searches for a word present in a file. The file name must be specified. We were also introduced to the VI text editor. This week we need to deal with standard input and standard output. We also need to throw a standard error. I need to look at some tutorials which would assist me in dealing with standard input and output.