Ran into a weird error that prevented me from saving....yes, saving. For future reference...if you copy and paste the "π" character into Eclipse, it will not let you save until you remove it, even if it's in a comment.
Well, I encountered many bugs, most of them were null pointer exceptions. I fixed most of my problems by providing null checks at the beginning of functions such as directionAt. The first time directionAt is called, my grid has nothing in it.
Constantly throughout this assignment I found myself wanting a little more explanation about each method. The headers themselves provide information for what they do, but not why/when they're called. This got me into a lot of trouble because the methods are called at times I didn't expect, causing null pointer exceptions. Something simple like..."This method assumes a non-null node, if null then return null" or something to that nature.
On the second map, I ran into a bug. Anytime the ants move to the left, they spin. I'm not sure what's causing that but I don't think it's in my code. The ants don't seem affected though, they still travel in the correct direction, just spinning.
Aside from the bug described above, the project seems to be in perfect working order, I played with it for about an hour. Overall, Dijkstra's Algorithm is fairly straight forward once you convert it to "English", but converting it to code is the real challenge of this assignment. The open-endedness of being able to choose your own data structure is kind of cool, gives you a little satisfaction when you complete it that you made a choice and made it work. I found the given algorithm using u,v,w,Q,S was extremely turse and hard to read. The first thing I did was find a guide that expanded those into words I could get my brain around.
NEXT!
Wednesday, August 5, 2009
Saturday, August 1, 2009
Debugging begins
I have completed the first draft of code and have turned to debugging. I fixed a few minor array bounds errors but I kept getting a persistent error when I tried used destinations.get(0);
I found that destinations.isEmpty() returns true and I'm not sure if I am able to continue if I don't have a destination available.
I found that destinations.isEmpty() returns true and I'm not sure if I am able to continue if I don't have a destination available.
Tuesday, July 28, 2009
Dijkstra's Algorithm - Linked List
I managed to get the Linked List version of the assignment completed. Now that all remains is the challenge of the Hash Set (if I can figure it out). I may need to look into Sets more to see if I can gain a little more understanding before attempting it.
One odd thing I encountered when testing the linked list version I have was that it seemed to clobber the results of other maps. Once I click to select anther map, the error results for the other maps pop up. This could be a serious problem when grading this assignment. Every map after the linked list map was wrong. It's as though I destroyed a resource. After a little poking around, I discovered that if I use the remove method on the destinations list, I permanently remove that coordinate from the destinations list. Apparently that list was passed by reference or something of the sort. Either way, this allows the programmer to clobber the destinations list. If a student, by accident uses the remove method, then the destination is removed from the list for the remainder of the time programmer is running the game. I'm not certain where cache for the route maps are called so I'm not certain if I can fix it. I tried using different search methods (like for SDRouteMap or Cache in the project) but I couldn't find it. Unless I can un-bury it, all I can do is leave a warning of what might happen if the destinations list is tampered with.
Note: Giving in to my mischievous side, I even tried to insert a different destination GridCoordinate into first element of the destinations list. As I predicted, it changed the destination node.
One odd thing I encountered when testing the linked list version I have was that it seemed to clobber the results of other maps. Once I click to select anther map, the error results for the other maps pop up. This could be a serious problem when grading this assignment. Every map after the linked list map was wrong. It's as though I destroyed a resource. After a little poking around, I discovered that if I use the remove method on the destinations list, I permanently remove that coordinate from the destinations list. Apparently that list was passed by reference or something of the sort. Either way, this allows the programmer to clobber the destinations list. If a student, by accident uses the remove method, then the destination is removed from the list for the remainder of the time programmer is running the game. I'm not certain where cache for the route maps are called so I'm not certain if I can fix it. I tried using different search methods (like for SDRouteMap or Cache in the project) but I couldn't find it. Unless I can un-bury it, all I can do is leave a warning of what might happen if the destinations list is tampered with.
Note: Giving in to my mischievous side, I even tried to insert a different destination GridCoordinate into first element of the destinations list. As I predicted, it changed the destination node.
Sunday, July 26, 2009
Dijkstra, first look
Initially the program is a little daunting, but I think I have a clear grasp on what Dijkstra's Algorithm is supposed to be doing....it will just be another story to convert it into code.
I decided that the best data structure I can think of to simply implement for this assignment is an array of arrays, or in this case a list of lists. I chose to make my own type of data container/node to hold all the information that was required for the grid. I found this a little easier since I'm not entirely familiar with the interface of the provided data structures. I was initially confused as to what some of these functions were for, especially in regards to the costFrom() function. But after talking to Dr. Wallace, it turns out that most of the hard work is done for us, this is simply a getter method for printing. I was also confused at first as to what the coordinates of the destination point were, I didn't find it very clear that the first argument of the destinations was the clear and definite choice. (Thanks Soren!)
I spent a fair bit of time exploring the methods provided for retrieving specific attributes from the GridCoordinate object and how I could use those to complete this assignment. I have to say, my Java skills have jumped quite a bit since I started this assignment, I really had to learn a lot to understand how each object knew how to access what. Our class has had very little Java experience, so all of this helps a great deal.
The custom container will store d, pi and a reference to the node it represents. This will make all my information readily available.
To create the grid, I need to know the size of the world we're dealing with. The only way I know of, and it's a hideous one...is to just iterate through the entire list of nodes and take the largest value of both x and y to determine the size. It is terribly inefficient but it does work for the time being until I find a more efficent method.
I decided to create my list of unvisited nodes at the same time as creating the grid to increase efficiency and reduce the chance of a bug implementing it later on another way.
http://renaud.waldura.com/doc/java/dijkstra/ Is a nifty little website I found with a nice rundown of the algorithm with a few examples, ones that I'm sure I'll be using to debug this beast when I get to it.
I decided that the best data structure I can think of to simply implement for this assignment is an array of arrays, or in this case a list of lists. I chose to make my own type of data container/node to hold all the information that was required for the grid. I found this a little easier since I'm not entirely familiar with the interface of the provided data structures. I was initially confused as to what some of these functions were for, especially in regards to the costFrom() function. But after talking to Dr. Wallace, it turns out that most of the hard work is done for us, this is simply a getter method for printing. I was also confused at first as to what the coordinates of the destination point were, I didn't find it very clear that the first argument of the destinations was the clear and definite choice. (Thanks Soren!)
I spent a fair bit of time exploring the methods provided for retrieving specific attributes from the GridCoordinate object and how I could use those to complete this assignment. I have to say, my Java skills have jumped quite a bit since I started this assignment, I really had to learn a lot to understand how each object knew how to access what. Our class has had very little Java experience, so all of this helps a great deal.
The custom container will store d, pi and a reference to the node it represents. This will make all my information readily available.
To create the grid, I need to know the size of the world we're dealing with. The only way I know of, and it's a hideous one...is to just iterate through the entire list of nodes and take the largest value of both x and y to determine the size. It is terribly inefficient but it does work for the time being until I find a more efficent method.
I decided to create my list of unvisited nodes at the same time as creating the grid to increase efficiency and reduce the chance of a bug implementing it later on another way.
http://renaud.waldura.com/doc/java/dijkstra/ Is a nifty little website I found with a nice rundown of the algorithm with a few examples, ones that I'm sure I'll be using to debug this beast when I get to it.
Dijkstra's Algorithm - Helping Stephen
After answering questions for Stephen I realized there were a few things that might be handy for future uses of the assignment.
Useful items that might be useful to add to the assignment:
- The EnumerableGraph could contain the dimensions of the graph.
- Provide a little more documentation on how to get the edges for the GridCoordinate.
- Potentially suggesting on how to store our own data type (though that might take too much away from the assignment).
Useful items that might be useful to add to the assignment:
- The EnumerableGraph could contain the dimensions of the graph.
- Provide a little more documentation on how to get the edges for the GridCoordinate.
- Potentially suggesting on how to store our own data type (though that might take too much away from the assignment).
Thursday, July 23, 2009
Dijkstra's Algorithm - Hash Map
For the time being, I figured I should just attempt the Hast Table problem using a Hash Map. Doing the program again using the Hash Table was fairly easy. All I had to really change was how I handled the nodes in the "data structure" otherwise the rest of the code/algorithm was the same. It functions the same as the other implementation. This took roughly 30 minutes to do. I suppose I should focus on the Hash Set a bit more to see if I can make sense of it.
If I went back to the linked list version, I would have a fair amount of trouble considering the searching and overhead involved with that method. Plus the overall clutter and complexity I created by trying to do a "simple" method of storing my "DNodes."
I believe the most of my time was spent wondering how to store data regarding my Search Algorithm. That consumed the most effort and time. Dijkstra's itself was rather easy to understand after the small lecture by my supervisor, most of the problems I had relating to the assignment were purely design issues.
If I went back to the linked list version, I would have a fair amount of trouble considering the searching and overhead involved with that method. Plus the overall clutter and complexity I created by trying to do a "simple" method of storing my "DNodes."
I believe the most of my time was spent wondering how to store data regarding my Search Algorithm. That consumed the most effort and time. Dijkstra's itself was rather easy to understand after the small lecture by my supervisor, most of the problems I had relating to the assignment were purely design issues.
Sunday, July 19, 2009
Dijkstra's Algorithm - Hash Set
Working on Dijkstra's again with the Hash Set. This time around its learning about Hash Sets rather than understanding the Dijkstra's algorithm. I'm not sure yet how its any different from a hash table, though the set usage idea is strange. I suppose I am wondering if each HashSet has only one key and value or you can hash to each element in the set? It will require more reading.
Tuesday, July 14, 2009
Linked List Assignment
-Could modify data in object. May not want setter for linkedlistnode
Dijkstra's Algorithm
-No clear instructions for set up using Windows and Eclipse
-Managed to get it to work with unorthodox methods
-Start on costFrom, didn't get far
-Wondered if I needed to build my own data structure or did something already exist
-Spent an hour on set up, hour and a half on looking at problem
-Got help on what useful structures I could use for this problem
Continued Problems with AI project
-Destinations can sometimes be empty on start up
-Tried to determine solution to destinations list
Dijkstra's Continued
-Discovered my inital method for creating my data structure was poor
-N search of graph each time I did CostFrom and DirectionAt
-Boss suggested grid or hash table
-Decided to take grid approach first and abandon the linked list
-Discovered graph is 20 x 20 and uses integers from 0 to 19.
-Used old code
Dijkstra's Continued 2
-Progress was slowed by small bugs and errors
-Found that guessing for certain functions to run before others to be irritating and caused bugs
-When program crashed from bad code, window lingered until killed with task manager
-Had troubles getting Eclipse's debugger working with program
-Got costs working, red points were not
-Changed my DNode such that pi was gridcord
-Modified DNode methods
-Program began to work properly
-Planning to start working on Hash Set version next until I get next assignment
-Could modify data in object. May not want setter for linkedlistnode
Dijkstra's Algorithm
-No clear instructions for set up using Windows and Eclipse
-Managed to get it to work with unorthodox methods
-Start on costFrom, didn't get far
-Wondered if I needed to build my own data structure or did something already exist
-Spent an hour on set up, hour and a half on looking at problem
-Got help on what useful structures I could use for this problem
Continued Problems with AI project
-Destinations can sometimes be empty on start up
-Tried to determine solution to destinations list
Dijkstra's Continued
-Discovered my inital method for creating my data structure was poor
-N search of graph each time I did CostFrom and DirectionAt
-Boss suggested grid or hash table
-Decided to take grid approach first and abandon the linked list
-Discovered graph is 20 x 20 and uses integers from 0 to 19.
-Used old code
Dijkstra's Continued 2
-Progress was slowed by small bugs and errors
-Found that guessing for certain functions to run before others to be irritating and caused bugs
-When program crashed from bad code, window lingered until killed with task manager
-Had troubles getting Eclipse's debugger working with program
-Got costs working, red points were not
-Changed my DNode such that pi was gridcord
-Modified DNode methods
-Program began to work properly
-Planning to start working on Hash Set version next until I get next assignment
Dijkstra's Continued 2
I finally have the 2d array method up and running more or less. Most of my problem revolved around silly mistakes and odd bugs that normally comes with programming. One of the problems with the assignment that I found agitating was the fact that I had to anticipate that there would be an iteration through this program in which destinations (the array of grid coordinates) might be null. Another problem I found was when my code caused a crash, the window for the game lingered and couldn't be killed unless I used the Task Manager. Another problem I was having with the program was that I couldn't properly debug with break points at the like. I had to resort to print statements to tell me what was happning.
I have it such that the correct costs are printing out however the direction the red pointers is still wrong. It stalls when it tries to put up the direction to the destination. I'll have to hammer out these bugs. After a little bit of tinkering around, I tweaked my DNode (which held information for pi and d) such that pi was a GridCord rather than another DNode. After I made those modifications, the program worked as expected. There were no performance issues to note (other than the tower didn't shoot anything, that would be fun if it did, maybe that's a later assignment).
With the Grid method done, I may return to my linked list method (which is awful) or move on to working with a hash set. I might do the hash set one since that may be more promising or interesting at least. The linked list verison would be more of a test in patience for debugging than learning about Dijkstra's or Java.
I have it such that the correct costs are printing out however the direction the red pointers is still wrong. It stalls when it tries to put up the direction to the destination. I'll have to hammer out these bugs. After a little bit of tinkering around, I tweaked my DNode (which held information for pi and d) such that pi was a GridCord rather than another DNode. After I made those modifications, the program worked as expected. There were no performance issues to note (other than the tower didn't shoot anything, that would be fun if it did, maybe that's a later assignment).
With the Grid method done, I may return to my linked list method (which is awful) or move on to working with a hash set. I might do the hash set one since that may be more promising or interesting at least. The linked list verison would be more of a test in patience for debugging than learning about Dijkstra's or Java.
Sunday, July 12, 2009
Dijkstra's Continued
I was thinking about this particular program all week. The way I had it set up was bad. Really bad. The short of the long for what I had, it would've done an N long search for the entire graph each time it called costFrom and directionAt. In other words, it was an awful idea. I hate it even though I thought it up. After a little chat with my boss, he imparted words of wisdom on how I could do better. I feel ashamed I didn't think of the first suggested he gave. That would be a 2d array that would store my data (d, pi) in each index corrisponding to the x and y cordinates on the GridCoordinate. The next suggestion was use of a hash table. This was slightly less obvious but still... I should hang my head in shame for not thinking of it. This will use the GridCoordinate as a key and the DNode (my class that will hold d and pi) is the value.
After poking at the x and y coordinates of the gridcor's I found that all the values are greater than or equal to 0 (in this case it was 0 to 19). For now I will set aside my awful (and probably not working) linked list version and do the grid version. It will probably lead me to a working solution faster than my first method. I'll go back to my first iteration later.
Fortuantely, most of the code is the same from my linked list attempt. So not much is truely lost. Time to just sit down and work on it.
Wrote down a majority of the code, but will test it more later. I'm having null pointer exceptions. Figures.
PS: Professor, Stephen has been trying to get in touch with you about the next assignment.
After poking at the x and y coordinates of the gridcor's I found that all the values are greater than or equal to 0 (in this case it was 0 to 19). For now I will set aside my awful (and probably not working) linked list version and do the grid version. It will probably lead me to a working solution faster than my first method. I'll go back to my first iteration later.
Fortuantely, most of the code is the same from my linked list attempt. So not much is truely lost. Time to just sit down and work on it.
Wrote down a majority of the code, but will test it more later. I'm having null pointer exceptions. Figures.
PS: Professor, Stephen has been trying to get in touch with you about the next assignment.
Tuesday, July 7, 2009
Continued problems with AI Project
Making progress on this assignment has been difficult. Other than tackling the part where concept meets code, I am having another issue which may or may not lie within my domain of fixing.
I can't very well make much progress without having a destination node to start from. Otherwise I have no place to start from. After a little bit of trial and error I found out the destination list being handed to me in cashe() is empty. I assume that is very much needed to perform even the first step of Dijkstra's algorithm. No method is coming to mind to start testing unless I can take the first step of the algorithm. Perhaps the relax method, but until I know what is wrong with destinations, I can't make much progress. I could try digging through the robot defense JAR but I don't think there would be much in there that I could understand.
Some of my guesses what the problem is:
- I have an older version that doesn't work.
- My configuration is wrong somehow.
- I need to be doing something with destination (even though its empty) inside of the cashe function. I doubt this possibility.
This program had to have worked at some point for someone else so I figure it must be one of the two likely possibilities. At the very least I'll start laying the ground work for the rest of the algorithm.
I can't very well make much progress without having a destination node to start from. Otherwise I have no place to start from. After a little bit of trial and error I found out the destination list being handed to me in cashe() is empty. I assume that is very much needed to perform even the first step of Dijkstra's algorithm. No method is coming to mind to start testing unless I can take the first step of the algorithm. Perhaps the relax method, but until I know what is wrong with destinations, I can't make much progress. I could try digging through the robot defense JAR but I don't think there would be much in there that I could understand.
Some of my guesses what the problem is:
- I have an older version that doesn't work.
- My configuration is wrong somehow.
- I need to be doing something with destination (even though its empty) inside of the cashe function. I doubt this possibility.
This program had to have worked at some point for someone else so I figure it must be one of the two likely possibilities. At the very least I'll start laying the ground work for the rest of the algorithm.
Wednesday, July 1, 2009
Dijkstra's Algorithm
This game is like a tower defense game but we are supposed to program the search algorithm to find the exit point.
The first thing I started with was setting up the program. The directions being only for linux machines didn't help me at all. So a great deal of time has been spent fumbling around with Eclipse just to make the program run. After finally picking the correct main to run, I found that only Stub was showing up as the method that was available. After must trial and error, mostly error, I managed to get the program to work without having to depend on the terminal instructions.
Here is what I did:
1. Put the Meta-Inf folder into my src folder.
2. Put my new routemap class into the src folder under the default pacakge.
3. Placed the robot defense jar folder in the src folder along with the metadata folder (don't know if that's necessary or not).
4. Renamed my class to LudwigSDRouteMap and modified it in the metadata folder.
5. Ran the game on the method PrjSingleDestinationRoutes.
6. It works!
Now that the set up is out of the way, on to the meat of the assignment, building my search using Dijkstra. For that I will start to look at the comments littering the class file. The first thing I set about doing was looking into building my graph necessary to do Dijkstra's Algorithm. While working on costFrom I was growing frustrated that I couldn't check and see if the node I was on was an end or start.
For the moment I'm giving up on the problem. I suppose one of the things I'm confused on at this point is do I need to create my own type of nodes to calculate the path and should I start on the cashe method first? I'll fiddle with it more later.
I spent about an hour setting up the program and about an hour and a half on looking at the problem and trying to figure out how to tackle it.
The first thing I started with was setting up the program. The directions being only for linux machines didn't help me at all. So a great deal of time has been spent fumbling around with Eclipse just to make the program run. After finally picking the correct main to run, I found that only Stub was showing up as the method that was available. After must trial and error, mostly error, I managed to get the program to work without having to depend on the terminal instructions.
Here is what I did:
1. Put the Meta-Inf folder into my src folder.
2. Put my new routemap class into the src folder under the default pacakge.
3. Placed the robot defense jar folder in the src folder along with the metadata folder (don't know if that's necessary or not).
4. Renamed my class to LudwigSDRouteMap and modified it in the metadata folder.
5. Ran the game on the method PrjSingleDestinationRoutes.
6. It works!
Now that the set up is out of the way, on to the meat of the assignment, building my search using Dijkstra. For that I will start to look at the comments littering the class file. The first thing I set about doing was looking into building my graph necessary to do Dijkstra's Algorithm. While working on costFrom I was growing frustrated that I couldn't check and see if the node I was on was an end or start.
For the moment I'm giving up on the problem. I suppose one of the things I'm confused on at this point is do I need to create my own type of nodes to calculate the path and should I start on the cashe method first? I'll fiddle with it more later.
I spent about an hour setting up the program and about an hour and a half on looking at the problem and trying to figure out how to tackle it.
Monday, June 22, 2009
Linked List Assignment
I thought about certain exploits to try and break the game, but couldn't find any surprising bugs in the assignment.
Somethings I tried were trying to change the data object or mess with the order in the list. Nothing proved very surprising.
One recommendation I might have is to restrict access to the user of LinkedListNode to allowing them to set the data info if possible.
Somethings I tried were trying to change the data object or mess with the order in the list. Nothing proved very surprising.
One recommendation I might have is to restrict access to the user of LinkedListNode to allowing them to set the data info if possible.
Sunday, June 21, 2009
Linked List Project Complete!
Below is my process of going through the assignment.
- I looked over Soren's readme for the StudentLinkedList assignment, it looks pretty good. I modified a couple typos and reworded a few sentences for clarity.
-After installing the files properly to get the assignment working, I started by creating insertAfter(), getHead() and getLast(). After writing those three, when I run the program it "should" build and display and provided that I don't do too much clicking it shouldn't error. The program seems to hang, I haven't been able to resolve this issue yet.
-I decided to work on writing removeRemaining(). It should be easy since all I have to do is chop off the list at the desired point. The problem I have run into is that the SinglyLinkedList.class explains that @param predecessor a reference to the LinkedListNode that will precede the inserted nodes.
when the parameter is actually called "node" and there should not be any inserting in this function, period. I am assuming for the time being that the node is what the user wants to become the new tail and all subsequent nodes will be seperated. The garbage collector should handle that once I set node->next to null.
-The SinglyLinkedList.class also says I am to return the first node of the chopped off nodes. That seems really weird, maybe an explanation of why that would be necessary would keep me from being so confused here. Perhaps the user will be notified of the removed nodes? I have no idea.
-The SinglyLinkedList.class seems to be the victim of copy-paste. There's a lot of referencing to "inserted nodes" in delete/remove functions.
-Implemented the remaining function: findPredecessor, the program still hangs, so I haven't been able to test any of my newer implementations.
-Found out the program was hanging because my implementation of getHead() was not correct.
-Fixed all errors and have the program working really well now, I only found one bug, and that was when I tried to insert shapes "inside" another column. Soren pointed out to me that the insertAfter function also has to account for inserting multiple nodes at once, something I didn't get from the SinglyLinkedList.class.
-Program is complete.
Closing comments:
-The assignment is an excellent way to see a linked list implemented simply and effectively, it's very reassuring to see something as elaborate as this come together after coding something so simple.
-I found it difficult at times to know what each function is doing in relation to the project, that may be intentional on the author's part, however I found that it would have been useful to know. The functions weren't always clear as to what they were supposed to return or what the parameters being pass represented.
-Very clear and detailed descriptions for the functions would greatly increase the student's ability to provide the proper routines to make this project work.
- I looked over Soren's readme for the StudentLinkedList assignment, it looks pretty good. I modified a couple typos and reworded a few sentences for clarity.
-After installing the files properly to get the assignment working, I started by creating insertAfter(), getHead() and getLast(). After writing those three, when I run the program it "should" build and display and provided that I don't do too much clicking it shouldn't error. The program seems to hang, I haven't been able to resolve this issue yet.
-I decided to work on writing removeRemaining(). It should be easy since all I have to do is chop off the list at the desired point. The problem I have run into is that the SinglyLinkedList.class explains that @param predecessor a reference to the LinkedListNode that will precede the inserted nodes.
when the parameter is actually called "node" and there should not be any inserting in this function, period. I am assuming for the time being that the node is what the user wants to become the new tail and all subsequent nodes will be seperated. The garbage collector should handle that once I set node->next to null.
-The SinglyLinkedList.class also says I am to return the first node of the chopped off nodes. That seems really weird, maybe an explanation of why that would be necessary would keep me from being so confused here. Perhaps the user will be notified of the removed nodes? I have no idea.
-The SinglyLinkedList.class seems to be the victim of copy-paste. There's a lot of referencing to "inserted nodes" in delete/remove functions.
-Implemented the remaining function: findPredecessor, the program still hangs, so I haven't been able to test any of my newer implementations.
-Found out the program was hanging because my implementation of getHead() was not correct.
-Fixed all errors and have the program working really well now, I only found one bug, and that was when I tried to insert shapes "inside" another column. Soren pointed out to me that the insertAfter function also has to account for inserting multiple nodes at once, something I didn't get from the SinglyLinkedList.class.
-Program is complete.
Closing comments:
-The assignment is an excellent way to see a linked list implemented simply and effectively, it's very reassuring to see something as elaborate as this come together after coding something so simple.
-I found it difficult at times to know what each function is doing in relation to the project, that may be intentional on the author's part, however I found that it would have been useful to know. The functions weren't always clear as to what they were supposed to return or what the parameters being pass represented.
-Very clear and detailed descriptions for the functions would greatly increase the student's ability to provide the proper routines to make this project work.
Sunday, June 14, 2009
Summary of Adding Instruction to Linked List Game
- Sent copy of modified readme to Stephen
- Added description of linked list
- Added objective of assignment
- Did not modify set up and simulation sections
- Added summary of what functions are supposed to do
- Added how to get to comments on functions
- Included generic programming tips at the end
- Decided not to include details regarding methods for LinkedListNode
- Added comments to code
- Added description of linked list
- Added objective of assignment
- Did not modify set up and simulation sections
- Added summary of what functions are supposed to do
- Added how to get to comments on functions
- Included generic programming tips at the end
- Decided not to include details regarding methods for LinkedListNode
- Added comments to code
Adding Instruction to Linked List Game
I sent a copy of the modified ReadMe (now version 1.6) to my supervisor and Stephen.
Here I will discuss what I added/modified which I thought would help students complete the assignment:
The first thing I added was a description of a Linked List. I had no idea if the students/people this is given to know what a Linked List is. So I included a little description as to what one is and a little about linked lists. After that I included a little objective statement to summarize what the goal of the project was.
I left the set up instructions and the running simulation instructions alone. I didn't feel like they needed to be modified and were clear enough. I did include on how to get to the interface inside the linked list jar (since that java file had the comments needed to understand the assignment in full) and a dumbed down version of what was written in the interface.
At the end of the README I included a few general tips for programmer.
I considered adding methods in LinkedListNode that would be useful/needed but I assumed that the end user would know enough Java to be able to look at the information presented to them by Eclipse or NetBeans. If they really wanted to they could just look at the LinkedListNode class for its methods.
I also added comments to my code just in case it will be used for something later with this project.
Here I will discuss what I added/modified which I thought would help students complete the assignment:
The first thing I added was a description of a Linked List. I had no idea if the students/people this is given to know what a Linked List is. So I included a little description as to what one is and a little about linked lists. After that I included a little objective statement to summarize what the goal of the project was.
I left the set up instructions and the running simulation instructions alone. I didn't feel like they needed to be modified and were clear enough. I did include on how to get to the interface inside the linked list jar (since that java file had the comments needed to understand the assignment in full) and a dumbed down version of what was written in the interface.
At the end of the README I included a few general tips for programmer.
I considered adding methods in LinkedListNode that would be useful/needed but I assumed that the end user would know enough Java to be able to look at the information presented to them by Eclipse or NetBeans. If they really wanted to they could just look at the LinkedListNode class for its methods.
I also added comments to my code just in case it will be used for something later with this project.
Summary of Con. Linked List Assignment
- Discovered comments in interface for linked list game. This would've been helpful had I known about it from the beginning.
- Read I was supposed to have a "dummy" head to my list. I figured that might have been a case. Fixed code for linked list game.
- Fixed code so that it allowed a series of nodes to be inserted.
- nodeOrHeadToInsert parameter was confusing (and really long to type out). Fixed issues had with insertAfter
- Confirmed "search" and "from" parameter usage. Modified code. Discovered specific usage for comparison of data objects and "search".
- "node" parameter in the remove methods may be a confusing name for variable.
- Finished linked list program
- removeNext does not seem to be used in game.
- Read I was supposed to have a "dummy" head to my list. I figured that might have been a case. Fixed code for linked list game.
- Fixed code so that it allowed a series of nodes to be inserted.
- nodeOrHeadToInsert parameter was confusing (and really long to type out). Fixed issues had with insertAfter
- Confirmed "search" and "from" parameter usage. Modified code. Discovered specific usage for comparison of data objects and "search".
- "node" parameter in the remove methods may be a confusing name for variable.
- Finished linked list program
- removeNext does not seem to be used in game.
Con. Linked List Assignment
Feeling frustrated with my program I decided to start digging through the jar file that I was given (the one for the linked list game). I finally found the interface for the different methods that I am supposed to implement, as well as some notes on what each objects. This would have been handy from the beginning.
After reading about getHead, I discovered I was supposed to have a dummy head for this linked list. That's not how I'd do it but I suppose it works. After I did that, then read up on insertAfter, I found out I did another thing wrong. Apparently I was supposed to be able to insert a single node or a list of nodes. Not something I'm used to as far as linked list operations go but it's not too hard to include. Another problem I had was the only parameter (besides predecessor) was the node to insert which was called "nodeOrHeadToInsert" which made me think the node could be a head, but after reading the notes on the function it can't be true. I haven't tested it a whole lot so maybe insertAfter does give me the "special head" node. Finally I moved on to fixing my findPredecessor.
The search object was nonintuative, as well as the from. After reading the interface notes, I discovered I was supposed to compare the data with this Object search. Didn't think you could do that since Java is stricktly typed but I managed to shake it a bit to make it work. My line of code came out to be something like this in the end: if(node.getNext().getData().equals(search)). Another problem I had was I had to guess what the "from" parameter was supposed to be for. I eventually figured out that it was supposed to be the point in the list I was searching from. More notes on the "from" variable would be useful.
Apparently node.getNext().getData() == search doesn't bode well with the compiler for one reason or another. Its the first thing that would come to mind for me, but if the compiler doesn't like it I guess I'll have to do it this way.
Once again, using the comments on the interface, I move on to removeNext and removeRemaining. I question the use of "node" on the interface. I'm not sure if using predecessor instead of node would be more useful. Perhaps it might be more intuative. That aside, I got the last two functions working.
With those last two methods complete, the assignment was done. If a student knows what they are doing, the assignment can be done under an hour. For the next step, I'll take the existing instructions then refine them before passing them on.
Note: After playing a little with the program, I was finding that the game never errored when I commented out removeNext. Is that method even needed?
After reading about getHead, I discovered I was supposed to have a dummy head for this linked list. That's not how I'd do it but I suppose it works. After I did that, then read up on insertAfter, I found out I did another thing wrong. Apparently I was supposed to be able to insert a single node or a list of nodes. Not something I'm used to as far as linked list operations go but it's not too hard to include. Another problem I had was the only parameter (besides predecessor) was the node to insert which was called "nodeOrHeadToInsert" which made me think the node could be a head, but after reading the notes on the function it can't be true. I haven't tested it a whole lot so maybe insertAfter does give me the "special head" node. Finally I moved on to fixing my findPredecessor.
The search object was nonintuative, as well as the from. After reading the interface notes, I discovered I was supposed to compare the data with this Object search. Didn't think you could do that since Java is stricktly typed but I managed to shake it a bit to make it work. My line of code came out to be something like this in the end: if(node.getNext().getData().equals(search)). Another problem I had was I had to guess what the "from" parameter was supposed to be for. I eventually figured out that it was supposed to be the point in the list I was searching from. More notes on the "from" variable would be useful.
Apparently node.getNext().getData() == search doesn't bode well with the compiler for one reason or another. Its the first thing that would come to mind for me, but if the compiler doesn't like it I guess I'll have to do it this way.
Once again, using the comments on the interface, I move on to removeNext and removeRemaining. I question the use of "node" on the interface. I'm not sure if using predecessor instead of node would be more useful. Perhaps it might be more intuative. That aside, I got the last two functions working.
With those last two methods complete, the assignment was done. If a student knows what they are doing, the assignment can be done under an hour. For the next step, I'll take the existing instructions then refine them before passing them on.
Note: After playing a little with the program, I was finding that the game never errored when I commented out removeNext. Is that method even needed?
Summary of Starting on the Linked List Assignment
- Decided to first do the assignment before attemtping to write instructions (I'm glad I did).
- Had problems knowing what to do with GetLast if list is empty.
- Got error with clicking on objects, program couldn't find what I was clicking on.
- Had problems knowing what to do with GetLast if list is empty.
- Got error with clicking on objects, program couldn't find what I was clicking on.
Friday, June 12, 2009
Starting on the Linked List Assignment
My next assignment revolves around the first data structure most computer scientists learn, a linked list. The game, as I understand it, is like Tower of Hanoi except you are supposed to get all the same type of shape in the same column. What the student is supposed to do is to take the empty class of StudentLinkedList and implement the empty methods. If all works well, then the students can play this little game in the end.
My job is to take the existing instructions then refine/add to them. I'm not too sure on what there is to add yet, but I suppose I'll try to think up what to include as I go. I think I may approch this by first doing it myself and writing down a few notes for later just to get an idea of what each function requires, is supposed to do, and to work out any problems I have with the implementation. Then later I will go through a second time to start pulling together instructions for the assignment.
One of the first problems I have encountered is what do I return if the list is empty? For example, on getLast I would figure returning null would be the intuitive action to do if the list was empty, however the linkedlist program gives me an error message telling me I should never do that. Well... What am I supposed to return if there is nothing in the list? Am I to assume that there will always be a head? One that points to either null or a list? Or should I assume head is part of the list?
Ignoring that bit of confusion, I moved on. I first implemented getHead and getLast because they were pretty straight forward. Next I did insertAfter to see if I could tickle the game into at least displaying the objects for the game. Fortunately I managed to do that at least. It still complained about my getLast was returning null. When ever I click on an object on the screen I get this error message: ERROR: Your implementation could not find the selected shape in any linked list. You may have ophaned a link or your findNext method may not be functioning correctly.
I'm given no findNext funciton so I must have an ophand linked. I think that is supposed to be orphaned, not ophaned however. After much fiddling with the code I can't make it be quite. I'll tinker with it later.
My job is to take the existing instructions then refine/add to them. I'm not too sure on what there is to add yet, but I suppose I'll try to think up what to include as I go. I think I may approch this by first doing it myself and writing down a few notes for later just to get an idea of what each function requires, is supposed to do, and to work out any problems I have with the implementation. Then later I will go through a second time to start pulling together instructions for the assignment.
One of the first problems I have encountered is what do I return if the list is empty? For example, on getLast I would figure returning null would be the intuitive action to do if the list was empty, however the linkedlist program gives me an error message telling me I should never do that. Well... What am I supposed to return if there is nothing in the list? Am I to assume that there will always be a head? One that points to either null or a list? Or should I assume head is part of the list?
Ignoring that bit of confusion, I moved on. I first implemented getHead and getLast because they were pretty straight forward. Next I did insertAfter to see if I could tickle the game into at least displaying the objects for the game. Fortunately I managed to do that at least. It still complained about my getLast was returning null. When ever I click on an object on the screen I get this error message: ERROR: Your implementation could not find the selected shape in any linked list. You may have ophaned a link or your findNext method may not be functioning correctly.
I'm given no findNext funciton so I must have an ophand linked. I think that is supposed to be orphaned, not ophaned however. After much fiddling with the code I can't make it be quite. I'll tinker with it later.
The Grand Finale
Continuing on Step4....
-Fixed a near incomprehensible error out of sheer dumb luck. As it turns out, there are two different Vector2D libraries that can be imported. One is import quicktime.qd3d.math.Vector2D; which will give you errors, and the correct one import jig.engine.util.Vector2D;. A phrase distinguishing the two in the wiki would help a lot on this.
-Another error I received was from importing the incorrect library for
-Fixed a near incomprehensible error out of sheer dumb luck. As it turns out, there are two different Vector2D libraries that can be imported. One is import quicktime.qd3d.math.Vector2D; which will give you errors, and the correct one import jig.engine.util.Vector2D;. A phrase distinguishing the two in the wiki would help a lot on this.
-Another error I received was from importing the incorrect library for
- . There were three choices in this case and only one worked.
-After all my code modifying errors were fixed, some taking a while to troublshoot, I ran into one last monster which I luckily had Soren clue me in on. There is a sprite being referenced to named asteroid but it was deleted in a previous step, something that should definitely be modified in the Wiki.
-Compiled the project and it appears to be working great!
-Space Frenzy Tutorial complete.
Overall Impression of the Tutorial:
-The tutorial is actually very close to being complete, all that remains to be corrected are a few minor issues.
-My biggest gripe is the numbering system after each class, it becomes really confusing after a while, it would be better to just explain where in each class to add each code snippet.
-The problem that gave me the most trouble was that there were several "acceptable" libraries available for import but there was only one correct library. This could easily be remedied by adding the libraries to the sample code, OR by adding a simple note about making sure the libraries you import are from JIG.
-Aside from the minor bug/grammar fixes, the tutorial is very good.
Wednesday, June 10, 2009
Summary of posts
Summary of my posts so far
Set up of Blog
- Installed Skype, Eclipse and got headset
- Tried to get account on JIG wiki but couldn’t figure it out
- Created a Live Journal (but later abandoned it)
-Wrote instructions on how to join and post on LJ community
Setting up JIG and starting the Space Frenzy Tutorial
Setting up Jig
- Set up JIG
- Instructions might be slightly outdated regarding versions of Java
- Might be useful to include getting latest JDK
- Might be useful to have instructions for adding JIG to existing programs
Part 1
- Small typing error in Part 1
- Confused slightly about who target audience is
- I like how the tutorial is put in terms of Object Oriented Programming
Part 2
- I messed up and included zip file instead of Jar for JIG
- JIG used up a lot of CPU usage when I ran it (FYI, my CPU is an AMD Athlon XP 3200+, 2.20 GHz)
- Computer slowing has no effect on game performance
Part 3
- Tutorial provided useful descriptions of objects in program
- Used Eclipse to import correct libraries
- Eclipse doesn’t seem to care if I had Override or not
- Found rapid development and results very useful and encouraging
- Wasn’t sure on scope of angularVelocity (public, private, protected?)
- Slightly confused on what source file I was supposed to edit
- Might be useful to note which imports are needed
- When I tried to display fps in this step while the game was running, it didn’t show
Interns vs. JIG vs. Blogger
- Stephen had trouble, I tried to help him
- One of his problems was he included zip instead of jar
- Wasn’t sure about error with constructor
- Had issues with blogger
Continuing with Space Frenzy
- Finished part 3 by adding asteroids class
Part 4
- Might be useful to put world size macros into the first steps
- Added asteroids layer, no problems
Finishing Space Frenzy
- Might be useful to note user needs to add new objects to constructor
- Forgot to new shipLayer
- After adding the last step I found that I got a run time error
- Java was looking for sprite called “asteroid”
- Readded PaintableCanvas.loadDefaultFrames("asteroid", 128, 128, 1, JIGSHAPE.CIRCLE, null);, problem fixed, probably better way to do it
-After problem was fixed, game functioned normally
Last Impressions
- Might be helpful to have some sort of conclusion or ending tips
- Got a good taste of JIG
- Part 4 might be better broken up
- Didn’t need Javadocs
- Didn’t understand super(“somename”) in constructors
- Wrote a section in about suggestion written revisions
- Numbering of classes was confusing
- Bullet5 class doesn’t play sound when bullet shoots unlike the comments in code suggests
Trying to Jar Space Frenzy
- Couldn’t manage to jar the program
- Didn’t understand parts of instructions
- Ultimately couldn’t figure it out
Set up of Blog
- Installed Skype, Eclipse and got headset
- Tried to get account on JIG wiki but couldn’t figure it out
- Created a Live Journal (but later abandoned it)
-Wrote instructions on how to join and post on LJ community
Setting up JIG and starting the Space Frenzy Tutorial
Setting up Jig
- Set up JIG
- Instructions might be slightly outdated regarding versions of Java
- Might be useful to include getting latest JDK
- Might be useful to have instructions for adding JIG to existing programs
Part 1
- Small typing error in Part 1
- Confused slightly about who target audience is
- I like how the tutorial is put in terms of Object Oriented Programming
Part 2
- I messed up and included zip file instead of Jar for JIG
- JIG used up a lot of CPU usage when I ran it (FYI, my CPU is an AMD Athlon XP 3200+, 2.20 GHz)
- Computer slowing has no effect on game performance
Part 3
- Tutorial provided useful descriptions of objects in program
- Used Eclipse to import correct libraries
- Eclipse doesn’t seem to care if I had Override or not
- Found rapid development and results very useful and encouraging
- Wasn’t sure on scope of angularVelocity (public, private, protected?)
- Slightly confused on what source file I was supposed to edit
- Might be useful to note which imports are needed
- When I tried to display fps in this step while the game was running, it didn’t show
Interns vs. JIG vs. Blogger
- Stephen had trouble, I tried to help him
- One of his problems was he included zip instead of jar
- Wasn’t sure about error with constructor
- Had issues with blogger
Continuing with Space Frenzy
- Finished part 3 by adding asteroids class
Part 4
- Might be useful to put world size macros into the first steps
- Added asteroids layer, no problems
Finishing Space Frenzy
- Might be useful to note user needs to add new objects to constructor
- Forgot to new shipLayer
- After adding the last step I found that I got a run time error
- Java was looking for sprite called “asteroid”
- Readded PaintableCanvas.loadDefaultFrames("asteroid", 128, 128, 1, JIGSHAPE.CIRCLE, null);, problem fixed, probably better way to do it
-After problem was fixed, game functioned normally
Last Impressions
- Might be helpful to have some sort of conclusion or ending tips
- Got a good taste of JIG
- Part 4 might be better broken up
- Didn’t need Javadocs
- Didn’t understand super(“somename”) in constructors
- Wrote a section in about suggestion written revisions
- Numbering of classes was confusing
- Bullet5 class doesn’t play sound when bullet shoots unlike the comments in code suggests
Trying to Jar Space Frenzy
- Couldn’t manage to jar the program
- Didn’t understand parts of instructions
- Ultimately couldn’t figure it out
Monday, June 8, 2009
More Space Frenzy Tutorial
-After numerous attempts to ratify the old Space Frenzy Tutorial, I have decided to scrap it and start a new project.
-After repeating the simple steps of creating a project and importing the JIG engine, the program still had numerous exception errors when calling the constructor. Profressor Wallace helped me troubleshoot the problem and found that I did not have the Java JDK installed at all, which resulted in the errors. After downloading JDK 6 update 14, the compile/run errors are no more.
-I'm not sure what level of knowledge the reader is assumed to have, but libraries are not included in the sample code, probably to reduce clutter. If that is intentional, it might be worthwhile to note that the libraries must be included for the code to function properly.
-Completed code samples of Ship1, SpaceFrenzyStep0, SpaceFrenzyStep1, when I run the simulation I get a blank window with a cyan colored ship pointing to the right with a 0 inside it. Everything seems to be going as planned.
-The step to include the ship movement is pretty confusing. I'm not entirely sure which source file to put this code in. Luckily, I guessed right and all seems to be functioning properly. The Wiki probably shouldn't assume the user is going to guess correctly.
- The ship's thrust, momentum and velocity all appear to be working correctly, which is a relief. It is great to see a simple and working model so early in development. The wrap-around of the ship also appears to be working correctly.
-Implemented the asteroid class without any trouble.
-Step 4 opens up with a code snippet referencing a Ship4 class which to my knowledge hasn't been implemented. I just assumed it was referring to Ship1 on the 4th step, renamed and continued on.
-This entire time, the numbers after each class are really starting to snowball. By that I mean that rather than hassle with creating a brand new class and copying the code every time I wanted to just overwrite the existing class. Well, every time I need to copy a new piece of code, there are numbers all over the place that have to be changed and they seem to be causing trouble. The entire concept of those numbers seems to be pointless.
-The last step of step4 is to change the constructor of asteroid, which breaks any previous calling of the constructor without a parameter. Now I'm unsure as to what to put in there. I am also getting a warning in SpaceFrenzyStep# when calling a new VanillaSphereCollisionHandler, saying there are Type Safety issues.
- The last error I'm getting is in breakApart's declaration, it says "The type list is not generic; it cannot be parameterized with arguments"
Possible typos:Step3
Finally, we make use of the fact the our ship has two frames, ...
Step4
However, layers to let us group objects together in a meaningful way.
-- This sentence doesn't make sense to me.
-After repeating the simple steps of creating a project and importing the JIG engine, the program still had numerous exception errors when calling the constructor. Profressor Wallace helped me troubleshoot the problem and found that I did not have the Java JDK installed at all, which resulted in the errors. After downloading JDK 6 update 14, the compile/run errors are no more.
-I'm not sure what level of knowledge the reader is assumed to have, but libraries are not included in the sample code, probably to reduce clutter. If that is intentional, it might be worthwhile to note that the libraries must be included for the code to function properly.
-Completed code samples of Ship1, SpaceFrenzyStep0, SpaceFrenzyStep1, when I run the simulation I get a blank window with a cyan colored ship pointing to the right with a 0 inside it. Everything seems to be going as planned.
-The step to include the ship movement is pretty confusing. I'm not entirely sure which source file to put this code in. Luckily, I guessed right and all seems to be functioning properly. The Wiki probably shouldn't assume the user is going to guess correctly.
- The ship's thrust, momentum and velocity all appear to be working correctly, which is a relief. It is great to see a simple and working model so early in development. The wrap-around of the ship also appears to be working correctly.
-Implemented the asteroid class without any trouble.
-Step 4 opens up with a code snippet referencing a Ship4 class which to my knowledge hasn't been implemented. I just assumed it was referring to Ship1 on the 4th step, renamed and continued on.
-This entire time, the numbers after each class are really starting to snowball. By that I mean that rather than hassle with creating a brand new class and copying the code every time I wanted to just overwrite the existing class. Well, every time I need to copy a new piece of code, there are numbers all over the place that have to be changed and they seem to be causing trouble. The entire concept of those numbers seems to be pointless.
-The last step of step4 is to change the constructor of asteroid, which breaks any previous calling of the constructor without a parameter. Now I'm unsure as to what to put in there. I am also getting a warning in SpaceFrenzyStep# when calling a new VanillaSphereCollisionHandler, saying there are Type Safety issues.
- The last error I'm getting is in breakApart's declaration, it says "The type list is not generic; it cannot be parameterized with arguments
Possible typos:Step3
Finally, we make use of the fact the our ship has two frames, ...
Step4
However, layers to let us group objects together in a meaningful way.
-- This sentence doesn't make sense to me.
Saturday, June 6, 2009
Trying to Jar Space Frenzy
This post will detail my process of packaging my game for distribution and testing the result on another computer.
1. This step is just confusing. The step doesn’t really say where to put this manifest or what to do if my package has no name (mine just calls itself the default package). So I just called it src.SpaceFrenzy for lack of a better idea to call the main class.
2. Opened SpaceFrenzy.
3. Selected export.
4. Selected Java -> Jar
5. Selected all the files I wanted.
6. All I have are my source files so I’m including those I suppose.
7. I’ll put on the desktop for easier access. I’ll call the jar Space Frenzy.
8. Can’t find my manifest. It is in my Space Frenzy folder but it doesn’t show up. I guess I’ll just let it generate one for me.
9. Clicked finish. The exporter complained about some warnings but I already knew that.
10. Put a copy of JIG on the desktop.
11. Double clicked on the jar… and the system gives me a warning sound but no messages.
I suppose I will need to tinker with the manifest file to make it work. After adding a regular file through Eclipse and naming it manifest.mf, I still get the same response from the system as with my other methods. I created a duplicate of my original package, naming it spacefrenzy so that there wouldn’t be an issue with the names but no change in the behavior of the jar. Even changing the Main-Class line from spacefrenzy.SpaceFrenzy to spacepfrenzy\SpaceFrenzy got the same results. I will have to tinker with it more to see if I can make it work, however, no luck so far. I even put in the full file path of the class but no luck. After much tinkering, no luck. I’ll have to try again at another time.
1. This step is just confusing. The step doesn’t really say where to put this manifest or what to do if my package has no name (mine just calls itself the default package). So I just called it src.SpaceFrenzy for lack of a better idea to call the main class.
2. Opened SpaceFrenzy.
3. Selected export.
4. Selected Java -> Jar
5. Selected all the files I wanted.
6. All I have are my source files so I’m including those I suppose.
7. I’ll put on the desktop for easier access. I’ll call the jar Space Frenzy.
8. Can’t find my manifest. It is in my Space Frenzy folder but it doesn’t show up. I guess I’ll just let it generate one for me.
9. Clicked finish. The exporter complained about some warnings but I already knew that.
10. Put a copy of JIG on the desktop.
11. Double clicked on the jar… and the system gives me a warning sound but no messages.
I suppose I will need to tinker with the manifest file to make it work. After adding a regular file through Eclipse and naming it manifest.mf, I still get the same response from the system as with my other methods. I created a duplicate of my original package, naming it spacefrenzy so that there wouldn’t be an issue with the names but no change in the behavior of the jar. Even changing the Main-Class line from spacefrenzy.SpaceFrenzy to spacepfrenzy\SpaceFrenzy got the same results. I will have to tinker with it more to see if I can make it work, however, no luck so far. I even put in the full file path of the class but no luck. After much tinkering, no luck. I’ll have to try again at another time.
Finishing Space Frenzy
The next step in the tutorial is for building the bullet class and functionality. The explanation of the setActivation and isActive was a bit difficult to follow. After thinking it over a little I finally understood what it was supposed to do. From what I understand, the object can be “removed or added” from the world the user sees rather easily.
I copied the code into the Bullet class. Once I was satisfied with it, I moved on to modifying the constructor for Space Frenzy. It may be helpful to note the user will need to create new objects for their constructor (such as the bullet). However, after modifying my code as I thought the tutorial suggested at the end of adding the bullet to the whole game, I got a null pointer exception. After looking at the code, I noticed I forgot to create new my shipLayer object. Having fixed that, I saved and ran the program. It allows me to shoot a bullet across the screen (at the moment, it does little else).
Finally I move on to the section involving breaking apart the asteroids and invoke the collision detection. I copied the code provided to make the bullet break apart the asteroid but found myself getting null pointer exceptions. After a bit of testing, I discovered that compiler was looking for a sprite called “asteroid” still. The easy fix for this I found was simply to add to the SpaceFrenzy constructor: PaintableCanvas.loadDefaultFrames("asteroid", 128, 128, 1, JIGSHAPE.CIRCLE, null); There might be a way that is more desirable to fix this problem.
After I input that line of code, the program worked as expected. I could fly around in my triangle ship and shoot bullets at things. If either my ship or bullet collided with an asteroid it broke apart into smaller asteroids. If the asteroid was already the smallest, it would vanish if hit. This concludes the instructions on the tutorial.
Last Impressions:
It would have been helpful if the tutorial had some sort of conclusion or section on adding features to it like custom-made sprites, sounds, or other features. Perhaps suggestions on how you could improve what we have at the end of the tutorial.
Overall however, I feel like I have a decent taste of what JIG can do and its basic features. Part four is a little overwhelming to read. It may benefit from being broken up into two pages/parts. I didn’t really need the javadocs for this tutorial since the explanation of the objects, their methods, and the code over all made sense. However what didn’t quite make sense was why I needed to call super(“somename”); in the constructor of the object. I understand it had something to do with labeling the sprite, however what it does beyond that is unknown to me.
Unless there is more needed to be done for this tutorial or more feedback needed, I am done with this project.
Written Revisions in Part 4:
- “Nothing new here, except that initially the bullet is inactive, and we'll change its state from active to inactive in the update method when we detect it leaving the screen.” There is something strange about the sentence. The bullet is inactive, and then you’ll change the state from active to inactive? Wouldn’t it need to become active before it can be inactive again?
-There is an extra indentation in Bullet 5 next to velocity.translate(s.getVelocity());
-I have been always told in my English courses and proof reading sessions to avoid the use of we, I, and you in reports and other documents. It may be beneficial to remove those references from the document.
Additional notes:
-I found the numbering of the different classes slightly annoying. If anything, I found them confusing than helpful. For example: Bullet5. Why is it called Bullet5? There was no Bullet 1, 2, 3, or 4. It doesn’t really correspond to the step we are on in any way that is obvious to me.
-The comments in the code for the Bullet5 class mentions that a sound will be played when the bullet is launched. From my understanding of the code (and actual testing of the program) does not do this. There is no code in there that explicitly causes the program to make a sound.
I noticed a list of instructions for packaging my game for distribution. My next post will more than likely involve testing these instructions.
I copied the code into the Bullet class. Once I was satisfied with it, I moved on to modifying the constructor for Space Frenzy. It may be helpful to note the user will need to create new objects for their constructor (such as the bullet). However, after modifying my code as I thought the tutorial suggested at the end of adding the bullet to the whole game, I got a null pointer exception. After looking at the code, I noticed I forgot to create new my shipLayer object. Having fixed that, I saved and ran the program. It allows me to shoot a bullet across the screen (at the moment, it does little else).
Finally I move on to the section involving breaking apart the asteroids and invoke the collision detection. I copied the code provided to make the bullet break apart the asteroid but found myself getting null pointer exceptions. After a bit of testing, I discovered that compiler was looking for a sprite called “asteroid” still. The easy fix for this I found was simply to add to the SpaceFrenzy constructor: PaintableCanvas.loadDefaultFrames("asteroid", 128, 128, 1, JIGSHAPE.CIRCLE, null); There might be a way that is more desirable to fix this problem.
After I input that line of code, the program worked as expected. I could fly around in my triangle ship and shoot bullets at things. If either my ship or bullet collided with an asteroid it broke apart into smaller asteroids. If the asteroid was already the smallest, it would vanish if hit. This concludes the instructions on the tutorial.
Last Impressions:
It would have been helpful if the tutorial had some sort of conclusion or section on adding features to it like custom-made sprites, sounds, or other features. Perhaps suggestions on how you could improve what we have at the end of the tutorial.
Overall however, I feel like I have a decent taste of what JIG can do and its basic features. Part four is a little overwhelming to read. It may benefit from being broken up into two pages/parts. I didn’t really need the javadocs for this tutorial since the explanation of the objects, their methods, and the code over all made sense. However what didn’t quite make sense was why I needed to call super(“somename”); in the constructor of the object. I understand it had something to do with labeling the sprite, however what it does beyond that is unknown to me.
Unless there is more needed to be done for this tutorial or more feedback needed, I am done with this project.
Written Revisions in Part 4:
- “Nothing new here, except that initially the bullet is inactive, and we'll change its state from active to inactive in the update method when we detect it leaving the screen.” There is something strange about the sentence. The bullet is inactive, and then you’ll change the state from active to inactive? Wouldn’t it need to become active before it can be inactive again?
-There is an extra indentation in Bullet 5 next to velocity.translate(s.getVelocity());
-I have been always told in my English courses and proof reading sessions to avoid the use of we, I, and you in reports and other documents. It may be beneficial to remove those references from the document.
Additional notes:
-I found the numbering of the different classes slightly annoying. If anything, I found them confusing than helpful. For example: Bullet5. Why is it called Bullet5? There was no Bullet 1, 2, 3, or 4. It doesn’t really correspond to the step we are on in any way that is obvious to me.
-The comments in the code for the Bullet5 class mentions that a sound will be played when the bullet is launched. From my understanding of the code (and actual testing of the program) does not do this. There is no code in there that explicitly causes the program to make a sound.
I noticed a list of instructions for packaging my game for distribution. My next post will more than likely involve testing these instructions.
Friday, June 5, 2009
Continuing with Space Frenzy
Now for the step of adding asteroids. I first start by looking at the code and copying it into my newly created class Asteroid class. Once satisfied with the code, I compiled and got no errors. No particular issues in this last section of the tutorial
Part 4: Space Frenzy Layers and Physics
Finally moving on to the last part of the tutorial in which we create several asteroids and put them into layers which interact with the ship and its missile.
One note that maybe useful is it might be better to put the world size macros at the very first step of building the screen. It makes the code a little more readable earlier on and there aren’t magic numbers in there.
After adding the asteroids and their layer I ran the game. A bunch of asteroids spawned and floated around the window. No performance problems other than what I already noted before.
Part 4: Space Frenzy Layers and Physics
Finally moving on to the last part of the tutorial in which we create several asteroids and put them into layers which interact with the ship and its missile.
One note that maybe useful is it might be better to put the world size macros at the very first step of building the screen. It makes the code a little more readable earlier on and there aren’t magic numbers in there.
After adding the asteroids and their layer I ran the game. A bunch of asteroids spawned and floated around the window. No performance problems other than what I already noted before.
First attempt
-Eclipse successfully installed.
-I wound up using a guide from http://ai.vancouver.wsu.edu/~jige/downloads/CCSC-NW-2007.pdf to import the JIG engine, which I don't believe was intended to be used in this way. After reading these slides though, I think I have a better understanding of how Eclipse handles external libraries.
-I used http://ai.vancouver.wsu.edu/jig/wiki/index.php/SpaceFrenzy to work on the SpaceFrenzy tutorial, I'm not sure if that was the place I was supposed to find it or not.
-I have imported the library through Eclipse (something the pdf didn't mention) it was just something I remembered from CS355.
-I like the introduction, the description of how each object is a part of the overall project. It makes a good warmup to get people thinking about what it is they're about to do. This is a process that should be engrained into every programmer's head.
-After copy-pasting the first few snippets of sample code, I'm being overrun by errors. While reading along in the tutorial, it sounds as if this shouldn't be the case and I should be able to test the program as I go to see progress
-Figured out that I imported the jig.zip file instead of the actual JAR inside. I unzipped JIG, then I imported the jig.jar, that fixed some errors and paved the way to fix the others. There was no mention in the Wiki about having to import libraries either, that might help clarify some things.
-After importing JIG properly AND importing the necessary libraries...I still had numerous errors that didn't even make sense. I found that saving each class made them go away.
-After these setbacks, I attempted to run the SpaceFrenzyStep0 and resulted in an exception error each time I attempted to call the constructor.
-Soren has looked over my code and he has been unable to replicate the problem.
Possible Typos:
Step 1
-User interface elements (things that indicate the state of the game, like the number of lives remaining or the score this far).
-The background in Asteroids is a simple black surface, but its easy to imagine something a bit more interesting like an image that has pin points of light to represent distance stars.
Step 3
-We can do this simply by making adding a Ship instance as a member of the SpaceFrenzy game and overriding the render method so that the Ship's own render method is called...
-The code below does just that; it works, but it's not the approach will want to use in the end...
-I wound up using a guide from http://ai.vancouver.wsu.edu/~jige/downloads/CCSC-NW-2007.pdf to import the JIG engine, which I don't believe was intended to be used in this way. After reading these slides though, I think I have a better understanding of how Eclipse handles external libraries.
-I used http://ai.vancouver.wsu.edu/jig/wiki/index.php/SpaceFrenzy to work on the SpaceFrenzy tutorial, I'm not sure if that was the place I was supposed to find it or not.
-I have imported the library through Eclipse (something the pdf didn't mention) it was just something I remembered from CS355.
-I like the introduction, the description of how each object is a part of the overall project. It makes a good warmup to get people thinking about what it is they're about to do. This is a process that should be engrained into every programmer's head.
-After copy-pasting the first few snippets of sample code, I'm being overrun by errors. While reading along in the tutorial, it sounds as if this shouldn't be the case and I should be able to test the program as I go to see progress
-Figured out that I imported the jig.zip file instead of the actual JAR inside. I unzipped JIG, then I imported the jig.jar, that fixed some errors and paved the way to fix the others. There was no mention in the Wiki about having to import libraries either, that might help clarify some things.
-After importing JIG properly AND importing the necessary libraries...I still had numerous errors that didn't even make sense. I found that saving each class made them go away.
-After these setbacks, I attempted to run the SpaceFrenzyStep0 and resulted in an exception error each time I attempted to call the constructor.
-Soren has looked over my code and he has been unable to replicate the problem.
Possible Typos:
Step 1
-User interface elements (things that indicate the state of the game, like the number of lives remaining or the score this far).
-The background in Asteroids is a simple black surface, but its easy to imagine something a bit more interesting like an image that has pin points of light to represent distance stars.
Step 3
-We can do this simply by making adding a Ship instance as a member of the SpaceFrenzy game and overriding the render method so that the Ship's own render method is called...
-The code below does just that; it works, but it's not the approach will want to use in the end...
Interns vs. JIG vs. Blogger
Stephen asked me a few questions about Space Frenzy, one of the two I was able to answer and solve (hopefully). The first problem was the jar file. I’ll go ahead and admit I did the same thing. We tried to import the zip file instead of the jar file inside the lib file in the zip. It may useful to instruct users where the jar file is inside of the zip folder to drop the hint that the zip isn’t the jar.
His second problem was SpaceFrenzyStep0 was blowing up on the constructor. After posing several questions (like did have his jar imported correctly, were there other source code files interfering, etc.) I decided I couldn’t figure it out. I went so far as asking for his code and running it on my setup. So far as I understand, it runs fine. My only guess is something is setup wrong. For the time being, I’m at a loss at how to help him. I’ll muse on it some more later.
I found out that I don’t like Blogger. Sure it was an easy set up and you can add all sorts of features to it but there are two things that have been nagging at me. One, I am not too sure how to change the width of the field for the blog entries. I probably could muck around in the template and hope for the best but I’m not optimistic since it seemed other blogs had pretty much the same width. Another thing that irritates me is the fact copy/pasting from Word into the blog is a crime against nature apparently. Blogger errors and scolds you for putting in HTML code that is invalid. Mind you I never touched the HTML. Once I do a copy/paste/save of my text into a notepad document that seems to strip it of whatever formatting it was unhappy about. I guess that’s a brute force way of dealing with it but I kind of don’t want to process my posts that way. I’ll deal for the moment and hopefully find a way around that.
His second problem was SpaceFrenzyStep0 was blowing up on the constructor. After posing several questions (like did have his jar imported correctly, were there other source code files interfering, etc.) I decided I couldn’t figure it out. I went so far as asking for his code and running it on my setup. So far as I understand, it runs fine. My only guess is something is setup wrong. For the time being, I’m at a loss at how to help him. I’ll muse on it some more later.
I found out that I don’t like Blogger. Sure it was an easy set up and you can add all sorts of features to it but there are two things that have been nagging at me. One, I am not too sure how to change the width of the field for the blog entries. I probably could muck around in the template and hope for the best but I’m not optimistic since it seemed other blogs had pretty much the same width. Another thing that irritates me is the fact copy/pasting from Word into the blog is a crime against nature apparently. Blogger errors and scolds you for putting in HTML code that is invalid. Mind you I never touched the HTML. Once I do a copy/paste/save of my text into a notepad document that seems to strip it of whatever formatting it was unhappy about. I guess that’s a brute force way of dealing with it but I kind of don’t want to process my posts that way. I’ll deal for the moment and hopefully find a way around that.
Setting up JIG and starting the Space Frenzy Tutorial
Setting up JIG on Eclipse:
I’m going to do the majority of my projects in Eclipse as opposed to NetBeans. I may later try doing the projects in NetBeans to test the instructions for setting up JIG, but for now I’ll stick to Eclipse.
Getting JIG up and running with Eclipse
1. Now that the most recent version of JIG is up, I’ve downloaded the jar file just fine.
2. Started Eclipse.
3. Selected my workspace.
4. Moved past the welcome window.
5. Created a new project.
6. I’m going to name my project SpaceFrenzy, as that is going to be my first project.
7. The instructions here may be a little outdated. The instructions say I need the JRE of 1.5, though I was instructed to use Java 1.6, I’m not sure if the instructions need to be updated or not. Fortunately, Eclipse has a default of JRE 1.6 I believe. It calls it jre6 which I can assume is the same thing. Overall, a detail not really critical detail.
8. Included my library just fine from an external source. Since I’m going to be using the JIG engine a lot over the course of this summer, I put it in a lib folder inside of my workspace. It may or may not be helpful to suggest this. Another option may to suggest adding it later into a lib folder inside the project that way it’s not dependant on something outside the folder. If you like, I could figure out how to add a library in an existing project and write instructions for that.
9. Clicked finished. Eclipse has offered no complaints (yet), so by following the instructions listed I am done starting a project with the JIG library.
I’ll make note of any problems I may have with this when I start on the Space Frenzy tutorial.
Space Frenzy Project:
Once again, I’m not sure if this is true or not. The tutorials page explains that in order to run the tutorials 1.5 SDK. I was told to use Java 1.6, so I’m not too sure if it needs to be updated or not. Just a minor note regarding the documentation on the Tutorial’s page.
Part 1: Space Frenzy Design
Third bulleted item in Anatomy of a Computer Game, there is a segment of text as follows: “User interface elements (things that indicate the state of the game, like the number of lives remaining or the score this far).” I think you mean “(things that indicate the state of the game, like the number of lives remaining or the score thus far).” A minor wording change.
There doesn’t seem much here for me to offer any insight on other than I’m confused who the end user is of the tutorial is. Part of it seems aimed towards students such as the explanation of the objects in the game. However some information on that page, like the basic description of the JIG API, seems more aimed towards educators. It works for both in this instance, but I suppose I would be expecting the tutorial (or maybe just future documents) to be worded differently if it were focused on a student or a professor.
I do like how the game was put into terms of the Object Oriented paradigm. Thinking of a game in terms of an object with certain actions it performs appeals to people easier, especially to students in the Freshmen and Sophomores whom are more than likely being introduced to the concept of OOP (object oriented programming). For example, this would he handy in teaching WSUV students OOP in the Advanced Databases class when learning about objects.
Part 2: Space Frenzy Getting Started
Finally time to find out if I included the JIG library correctly and follow the tutorial. Seeing as the code to make a window and run it is fairly straight forward, I went ahead and copied most of it (except for the name, I’m just going to build off the same program between steps). With a few problems involving my own zip program, I get the jar running and managed to import the StaticScreenGame. Once that was done, I had no problems with the compiler. The code looks something like this: http://tinypic.com/r/hupr8l/5.
Feeling optimistic, I went ahead and ran it. As expected, I got a blank screen that did nothing. Remembering that JIG had a command prompt, I hit the` key to get to the “terminal” and typed in “help”. The terminal replied with a list of commands I could run. I typed in fps (frames per second) to see my speed and I was a little disappointed. The frame rate was around 68 fps. This was far less than any demonstration I had seen on other machines (I think I ran the physics demo on my new machine and it was several times faster). This (http://tinypic.com/r/6iwtx4/5) is an image of the window while the program is running. Also, my computer had performance issues while the program is being executed. The game was using the majority of the CPU usage, when exiting the game, the CPU usage went from 100% to 7% roughly. A picture of my CPU usage can be found here: http://tinypic.com/r/dlqjyp/5. My computer is fairly old, but I didn’t believe old enough to run that slow on a simple java program. It still can run processor and memory intensive programs such as Guild Wars (an online role-playing game) fairly well.
I’m not sure yet if this memory consumption affects the performance of the game itself. I’ll note more on this in the next part of the tutorial.
Part 3: Creating Game Objects
Finally I move on to the creation of objects on the screen. In reading the introduction paragraph for this part of the tutorial, I felt a little overwhelmed by the wall of text. Despite the mass of text to digest, the concepts were easy to understand. A Viewable object is something that you can see on the screen (like the ship), the Sprite is the most basic level of a viewable object (like a painting) and a Body is something with mass and velocity (like a body of mass, it weighs something and can move around).
Moving on to the coding section just below, I once again copy what is written there. To ensure I have the correct packages included, I use Eclipse’s tools to import a package for an object if it can find it in a library that is included. I do this for the VanillaSphere and Vector 2D. After filling in the code provided into my own classes, I continue on to rendering the ship in the next step.
I start by filling in the code given to me by the tutorial. This was the part in which I added rendered objects. The only one so far was just the ship, so I went ahead and added the lines of code into the constructor and added the render method. However, the compiler didn’t seem to care if I had the @Override or not. I left it in just in case. The result displayed a little blue triangle facing to the left on my screen.
I found the ability to put a visual object onto my screen within seconds to be extremely useful. Having the ability to put up some basic object to represent the objects on my screen was rather encouraging. There are many computer science projects that involve creating something that doesn’t produce immediately obvious results. The JIG engine, thus far, has been able to show to me that I can create a visual object on my screen in minutes. With the regular java libraries open to 1.6 Java, creating a triangle on a screen is a little more involved. It is even more involved to make it move around the screen.
Next I moved on to the section focusing on giving control of the ship to the user. I found the inclusion of the two new attributes to the ship class slightly confusing. I assume, at this point, that angularVelocity is public since it doesn’t have a keyword in front of it. It may be useful to include the word public in front of it, just to be explicit.
Now that the ship had those two new attributes, I went about adding the update method to the SpaceFrenzy class as well as the macros incorporated with it. Then finally I added in the thrust method for the ship and modified the update rule for the ship. These steps were a little difficult to follow since there was no explicit label or note as to which source file the new code was to be added to. Also it may be useful to note which imports may be desired.
Once the code was all input into their respected classes, I ran the program. As expected, the program ran smoothly. The triangle was able to turn around and thrust forward, then wrap around the screen when it went off the edge of the screen. There did not seem to be any performance issues inside the program. However, when I tried to prompt the JIG terminal for the frames per second, it would not display the FPS at the bottom right hand corner as it usually did. I tried typing the command in several times, but it would not display. While the triangle was “thrusting” forward, the number in the center would change from a 0 to a 1. Once I released the forward key, the number would return to 0 and the triangle would stop accelerating. The performance of my computer outside of the game is still somewhat slow.
I'll write more on part 3 later.
I’m going to do the majority of my projects in Eclipse as opposed to NetBeans. I may later try doing the projects in NetBeans to test the instructions for setting up JIG, but for now I’ll stick to Eclipse.
Getting JIG up and running with Eclipse
1. Now that the most recent version of JIG is up, I’ve downloaded the jar file just fine.
2. Started Eclipse.
3. Selected my workspace.
4. Moved past the welcome window.
5. Created a new project.
6. I’m going to name my project SpaceFrenzy, as that is going to be my first project.
7. The instructions here may be a little outdated. The instructions say I need the JRE of 1.5, though I was instructed to use Java 1.6, I’m not sure if the instructions need to be updated or not. Fortunately, Eclipse has a default of JRE 1.6 I believe. It calls it jre6 which I can assume is the same thing. Overall, a detail not really critical detail.
8. Included my library just fine from an external source. Since I’m going to be using the JIG engine a lot over the course of this summer, I put it in a lib folder inside of my workspace. It may or may not be helpful to suggest this. Another option may to suggest adding it later into a lib folder inside the project that way it’s not dependant on something outside the folder. If you like, I could figure out how to add a library in an existing project and write instructions for that.
9. Clicked finished. Eclipse has offered no complaints (yet), so by following the instructions listed I am done starting a project with the JIG library.
I’ll make note of any problems I may have with this when I start on the Space Frenzy tutorial.
Space Frenzy Project:
Once again, I’m not sure if this is true or not. The tutorials page explains that in order to run the tutorials 1.5 SDK. I was told to use Java 1.6, so I’m not too sure if it needs to be updated or not. Just a minor note regarding the documentation on the Tutorial’s page.
Part 1: Space Frenzy Design
Third bulleted item in Anatomy of a Computer Game, there is a segment of text as follows: “User interface elements (things that indicate the state of the game, like the number of lives remaining or the score this far).” I think you mean “(things that indicate the state of the game, like the number of lives remaining or the score thus far).” A minor wording change.
There doesn’t seem much here for me to offer any insight on other than I’m confused who the end user is of the tutorial is. Part of it seems aimed towards students such as the explanation of the objects in the game. However some information on that page, like the basic description of the JIG API, seems more aimed towards educators. It works for both in this instance, but I suppose I would be expecting the tutorial (or maybe just future documents) to be worded differently if it were focused on a student or a professor.
I do like how the game was put into terms of the Object Oriented paradigm. Thinking of a game in terms of an object with certain actions it performs appeals to people easier, especially to students in the Freshmen and Sophomores whom are more than likely being introduced to the concept of OOP (object oriented programming). For example, this would he handy in teaching WSUV students OOP in the Advanced Databases class when learning about objects.
Part 2: Space Frenzy Getting Started
Finally time to find out if I included the JIG library correctly and follow the tutorial. Seeing as the code to make a window and run it is fairly straight forward, I went ahead and copied most of it (except for the name, I’m just going to build off the same program between steps). With a few problems involving my own zip program, I get the jar running and managed to import the StaticScreenGame. Once that was done, I had no problems with the compiler. The code looks something like this: http://tinypic.com/r/hupr8l/5.
Feeling optimistic, I went ahead and ran it. As expected, I got a blank screen that did nothing. Remembering that JIG had a command prompt, I hit the` key to get to the “terminal” and typed in “help”. The terminal replied with a list of commands I could run. I typed in fps (frames per second) to see my speed and I was a little disappointed. The frame rate was around 68 fps. This was far less than any demonstration I had seen on other machines (I think I ran the physics demo on my new machine and it was several times faster). This (http://tinypic.com/r/6iwtx4/5) is an image of the window while the program is running. Also, my computer had performance issues while the program is being executed. The game was using the majority of the CPU usage, when exiting the game, the CPU usage went from 100% to 7% roughly. A picture of my CPU usage can be found here: http://tinypic.com/r/dlqjyp/5. My computer is fairly old, but I didn’t believe old enough to run that slow on a simple java program. It still can run processor and memory intensive programs such as Guild Wars (an online role-playing game) fairly well.
I’m not sure yet if this memory consumption affects the performance of the game itself. I’ll note more on this in the next part of the tutorial.
Part 3: Creating Game Objects
Finally I move on to the creation of objects on the screen. In reading the introduction paragraph for this part of the tutorial, I felt a little overwhelmed by the wall of text. Despite the mass of text to digest, the concepts were easy to understand. A Viewable object is something that you can see on the screen (like the ship), the Sprite is the most basic level of a viewable object (like a painting) and a Body is something with mass and velocity (like a body of mass, it weighs something and can move around).
Moving on to the coding section just below, I once again copy what is written there. To ensure I have the correct packages included, I use Eclipse’s tools to import a package for an object if it can find it in a library that is included. I do this for the VanillaSphere and Vector 2D. After filling in the code provided into my own classes, I continue on to rendering the ship in the next step.
I start by filling in the code given to me by the tutorial. This was the part in which I added rendered objects. The only one so far was just the ship, so I went ahead and added the lines of code into the constructor and added the render method. However, the compiler didn’t seem to care if I had the @Override or not. I left it in just in case. The result displayed a little blue triangle facing to the left on my screen.
I found the ability to put a visual object onto my screen within seconds to be extremely useful. Having the ability to put up some basic object to represent the objects on my screen was rather encouraging. There are many computer science projects that involve creating something that doesn’t produce immediately obvious results. The JIG engine, thus far, has been able to show to me that I can create a visual object on my screen in minutes. With the regular java libraries open to 1.6 Java, creating a triangle on a screen is a little more involved. It is even more involved to make it move around the screen.
Next I moved on to the section focusing on giving control of the ship to the user. I found the inclusion of the two new attributes to the ship class slightly confusing. I assume, at this point, that angularVelocity is public since it doesn’t have a keyword in front of it. It may be useful to include the word public in front of it, just to be explicit.
Now that the ship had those two new attributes, I went about adding the update method to the SpaceFrenzy class as well as the macros incorporated with it. Then finally I added in the thrust method for the ship and modified the update rule for the ship. These steps were a little difficult to follow since there was no explicit label or note as to which source file the new code was to be added to. Also it may be useful to note which imports may be desired.
Once the code was all input into their respected classes, I ran the program. As expected, the program ran smoothly. The triangle was able to turn around and thrust forward, then wrap around the screen when it went off the edge of the screen. There did not seem to be any performance issues inside the program. However, when I tried to prompt the JIG terminal for the frames per second, it would not display the FPS at the bottom right hand corner as it usually did. I tried typing the command in several times, but it would not display. While the triangle was “thrusting” forward, the number in the center would change from a 0 to a 1. Once I released the forward key, the number would return to 0 and the triangle would stop accelerating. The performance of my computer outside of the game is still somewhat slow.
I'll write more on part 3 later.
Set up of Blog
This entry is outdated , but I'll post it for the record:
As for the first entry on this live journal community, I’ll report my set up progress as a test post.
After finishing my paperwork with my supervisor, I went about getting Skype and Eclipse established on my PC. I ran a little hello world program just to test out to see if Eclipse was working. I have selected a set of head phones that I plan to purchase for the sake of using Skype. They should arrive sometime in the next week.
This segment will discuss the steps in which I try to create a log in for the JIG wiki and possibly log in.
1. Went to the main JIG wiki page.
2. Clicked on “log in / create account” link in the upper right hand corner of the screen.
3. Tried to enter a new user name and password into fields.
4. Error. The site warns me that I have input an invalid username.
There is no obvious way to create an account on the wiki other than asking the wiki’s maintainers for a log-in. I will have to ask the professor about an account.
For those who wish to join the JIG Live Journal community, you need to register a Live Journal account to be able to comment on blog entries in the community (this can be changed to allow anonymous comments to be allowed if desired). To post journal entries to the community, you have to be registered and join the community.
To join the community, be logged into Live Journal. Go to this link: http://community.livejournal.com/jig_project/profile Then click Join under the jig_project heading. It will take you to a new page in which you can click Join Community. Then you wait until the community’s moderator has accepted you, then you are welcome to post.
To post to the community in Live Journal: Click on the post link to take you to a page with blank text fields. Click the drop down box next to the Post To text and select jig_project. Once you post your entry, that entry will be added to the community.
As for the first entry on this live journal community, I’ll report my set up progress as a test post.
After finishing my paperwork with my supervisor, I went about getting Skype and Eclipse established on my PC. I ran a little hello world program just to test out to see if Eclipse was working. I have selected a set of head phones that I plan to purchase for the sake of using Skype. They should arrive sometime in the next week.
This segment will discuss the steps in which I try to create a log in for the JIG wiki and possibly log in.
1. Went to the main JIG wiki page.
2. Clicked on “log in / create account” link in the upper right hand corner of the screen.
3. Tried to enter a new user name and password into fields.
4. Error. The site warns me that I have input an invalid username.
There is no obvious way to create an account on the wiki other than asking the wiki’s maintainers for a log-in. I will have to ask the professor about an account.
For those who wish to join the JIG Live Journal community, you need to register a Live Journal account to be able to comment on blog entries in the community (this can be changed to allow anonymous comments to be allowed if desired). To post journal entries to the community, you have to be registered and join the community.
To join the community, be logged into Live Journal. Go to this link: http://community.livejournal.com/jig_project/profile Then click Join under the jig_project heading. It will take you to a new page in which you can click Join Community. Then you wait until the community’s moderator has accepted you, then you are welcome to post.
To post to the community in Live Journal: Click on the post link to take you to a page with blank text fields. Click the drop down box next to the Post To text and select jig_project. Once you post your entry, that entry will be added to the community.
Subscribe to:
Posts (Atom)