![]() |
|
[Project] PipCo - Strategy Game to Learn Algorithms and Datastructures - Printable Version +- Sinisterly (https://sinister.li) +-- Forum: Coding (https://sinister.li/Forum-Coding) +--- Forum: Java, JVM, & JRE (https://sinister.li/Forum-Java-JVM-JRE) +--- Thread: [Project] PipCo - Strategy Game to Learn Algorithms and Datastructures (/Thread-Project-PipCo-Strategy-Game-to-Learn-Algorithms-and-Datastructures) |
[Project] PipCo - Strategy Game to Learn Algorithms and Datastructures - Deque - 04-12-2013 Hello HC, I want to introduce to you my ongoing project written in Java. I do this for my professor at university who teaches bachelor computer science students algorithms and datastructures. Idea The idea is to have an incomplete game. Certain datastructures and algorithms are left for the students to implement. Once they did this, the game will behave according to their implementation. I made my own implementations of these algorithms to test the game. The following pictures and the download below will show you the complete game. Game The principle of the game by now is to transport red resources on the map by using pipes. Factories will produce when they get resources. The products are transported by trucks to the flag. There is no real challenging component by now as the project is not finished yet. Screenshots Note: The graphics are not final and I am not a designer at all. I know that some parts look crappy. Algorithms and Datastructures to implement [table] [row] [cell]Sorting Algorithm[/cell] [cell]Sorts the random array of bars under the factory, once sorted a truck will appear and transport the products to the flag [/cell] [/row] [row] [cell]Shortest Path [/cell] [cell]Used by trucks to find the flag [/cell] [/row] [row] [cell]Maximum Flow [/cell] [cell]Calculates the flow of resources in the pipes [/cell] [/row] [row] [cell]Sorted List [/cell] [cell]Highscores [/cell] [/row] [row] [cell]Linked List [/cell] [cell]Map preview [/cell] [/row] [row] [cell]Map [/cell] [cell]Dictionary to change the language in the menu [/cell] [/row] [row] [cell]Graph [/cell] [cell]Used by Maximum Flow and Shortest Path [/cell] [/row] [row] [cell]Breath First Search [/cell] [cell]Used by Maximum Flow algorithm [/cell] [/row] [/table] Download This is the fully implemented game. http://uppit.com/9763u2oau7t9/hcpipco.zip Starting the game This game should work for Windows, MacOS, Solaris and Linux. You need a Java Runtime >= 1.6. Windows users run pipco.bat Linux users run pipco.sh Alternatively run on commandline: Code: java -Djava.library.path=./resources_lib/native/linux -jar resources.jarDeque RE: [Project] PipCo - Strategy Game to Learn Algorithms and Datastructures - Psycho_Coder - 04-12-2013 I just Love Algorithms and Data Structures , thank you , and its great that I can learn while playing . Great Concept ... :ok: RE: [Project] PipCo - Strategy Game to Learn Algorithms and Datastructures - Deque - 04-12-2013 (04-12-2013, 08:42 PM)Psycho_Coder Wrote: I just Love Algorithms and Data Structures , thank you , and its great that I can learn while playing . You can't learn while playing. The students get this project with dummy implementations of the algorithms and datastructures. The game won't work properly when they get it. The trucks won't find the paths, the factories won't produce, the pipes won't transport resources. This only works after the students implemented their algorithms and datastructures. I.e. a student will get this: Code: package logic.sorting;
import java.util.Comparator;
/**
* A sorter for arrays of type T[].
*
* @author Deque
*
* @param <T> the type of the elements that are sorted
*/
public interface Sorter<T> {
/**
* Sorts the array in ascending order using the comparator to compare array
* elements and the swapper to change the position of array elements.
*
* (Doing so in another way won't work. Not the resulting array is used, but
* the steps you take. Steps won't be recognized if you don't use swapper
* and comparator.)
*
* @param array
* @param comparator
* @param swapper
*/
public void sort(T[] array, Comparator<T> comparator, Swapper<T> swapper);
}And might implement a BubbleSort: Code: package logic.sorting;
import java.util.Comparator;
/**
*
* @author Deque
*
* @param <T>
*/
public class BubbleSort<T> implements Sorter<T> {
@Override
public void sort(T[] array, Comparator<T> comparator, Swapper<T> swapper) {
boolean swapped;
do {
swapped = false;
for (int i = 1; i < array.length; i++) {
if (comparator.compare(array[i - 1], array[i]) > 0) {
array = swapper.swap(array, i - 1, i);
swapped = true;
}
}
} while (swapped);
}
}Now if the student runs the project, the factories will produce. Note that the student doesn't need to know anything about the factory code or how the factory works. The interface is all they need. RE: [Project] PipCo - Strategy Game to Learn Algorithms and Datastructures - Psycho_Coder - 04-12-2013 Ok I got it . Th factory codes are like abstraction , I don't need to know on what code does it work , but if I have implement the data structures properly , then they will work as they should . RE: [Project] PipCo - Strategy Game to Learn Algorithms and Datastructures - Deque - 04-13-2013 (04-12-2013, 09:23 PM)Psycho_Coder Wrote: Ok I got it . Th factory codes are like abstraction , I don't need to know on what code does it work , but if I have implement the data structures properly , then they will work as they should . Correct. :yes: RE: [Project] PipCo - Strategy Game to Learn Algorithms and Datastructures - Deque - 04-13-2013 (04-12-2013, 09:23 PM)Psycho_Coder Wrote: Ok I got it . Th factory codes are like abstraction , I don't need to know on what code does it work , but if I have implement the data structures properly , then they will work as they should . Correct. :yes: RE: [Project] PipCo - Strategy Game to Learn Algorithms and Datastructures - Psycho_Coder - 09-16-2013 Ma'am can you fix the download link please ? . I wanna play this game! (which means I will implement the algorithms and complete it.) RE: [Project] PipCo - Strategy Game to Learn Algorithms and Datastructures - Deque - 09-16-2013 Aw, I don't have the version without the algorithms anymore. I will have to recreate it again. The one I provided above is already completed with sample algorithms, so this was not what you where looking for anyways. Let me see what I can do. RE: [Project] PipCo - Strategy Game to Learn Algorithms and Datastructures - Psycho_Coder - 09-16-2013 (09-16-2013, 06:41 PM)Deque Wrote: Aw, I don't have the version without the algorithms anymore. I will have to recreate it again. Well No problem. At your own ease!. I completely forgot about this and today while going through the old threads (I was loitering, he he he) and suddenly this came to my notice. Well I still have previous version but I have to search my messy laptops hard disk, though I am not sure. Let me see if I can make something like this but still a bit different (not a game, I suck at design). Thank you, Sincerely, Psycho_Coder RE: [Project] PipCo - Strategy Game to Learn Algorithms and Datastructures - Deque - 09-16-2013 Now that you mentioned this, I can also provide the algorithms for your compilation ... |