Functional Programming
Type Inference
Toss
- (incorporates former Speagram)
Emacs
Kurs Pascala
Artificial General Intelligence
AI:
Algorithmic Game Theory: Prediction Markets (po polsku)
Programming in Java
kurs pracy w systemie Linux
Evolutionary Algorithms
Animation
Data Stores and Data Mining
Language Understanding
Systemy Inteligentnych Agentów
Przetwarzanie Języka Naturalnego
Programowanie Funkcjonalne
PmWiki
pmwiki.org
add user
edit SideBar
|
Primary course material:
See also:
Integrated Development Environments (Java and general):
Run Java code online:
Exercises:
- Due Oct 14: Self-Avoiding Walk Δ; Introduction to Programming in Java: SelfAvoidingWalk.java.
- Due Oct 21: Prime Factors Δ.
- Due Nov 4: Sets and Maps Δ.
- ex3.jar Δ
- DISCLAIMER: this example does not show the right way to implement containers or good programming practice, it is just an exercise in use and limitations of inheritance and interfaces.
- ex3nested.jar Δ — example using nested classes.
- Exercise update:
- implement the
clone() method for MySetImpl and MyMapImpl ;
- don’t forget to add simple demonstration tests for
MySet.intersect , MyMap.union and clone() methods.
- Due Nov 18: Modify the nested Δ implementation of sets and maps (including the interfaces) to use generic types. (Some change to the class structure might be needed.) Remove the unnecessary class casts. Remember to fix all sources of so called unchecked warnings. To get the locations of warnings, compile with
javac -Xlint:unchecked *.java . For bonus points, select one of the exercises:
- Add an iterator (or another form of browsing the elements) to the
MySet interface. In union and intersect methods, use the instanceof operator to switch to a general way of performing these operations in case the argument is not of the MySetImpl class.
- Implement the Java standard library collection interfaces
Set<E> and Map<K,V> using ordered linked lists, subclassing appropriate abstract classes from the library.
- Due Dec 2: Modify the simulation inspired by The Settlers game settlers.jar Δ in one of the following ways. (Select one exercise; the first four exercises are simple, the first three require little work.)
- Write a method to add a road segment between two existing waypoints.
- Add another kind of resources, for example
STONE .
- Make the carriers return to the warehouse they came from after making a delivery, similarly to how they return when they cannot make the delivery; but in case they make the delivery to a warehouse where there is not enough carriers (e.g. less than 3), let them stay. Now, a small number of carriers should still distribute all resources needed.
- Add a terrain: a two-dimensional array of
enum objects that decides which kinds of buildings can be built at which locations. (The terrain can be a field in the Scheduler class.)
- Add another kind of settler: a constructor, add an
underConstruction boolean field to the Building class and modify notFunctional () to account for it. Modify the Building class so that the constructor settler needs to reside in a building for a time proportional to resourcesToBuild().sum() before underConstruction becomes false. Write a method in the Castle class that generates and schedules a task which searches for a building that is underConstruction but does not have a constructor, and sends a constructor there. The constructor should return back to the castle after finishing the job.
- Add another kind of building: sawmill, and another settler: woodcutter. The castle should send a woodcutter and a carrier to a sawmill after it is built. The woodcutter produces the wood and the carrier delivers it periodically to the nearest warehouse.
- Due Dec 9: Modify the simulation inspired by The Settlers game settlers.jar Δ in one of the following ways.
- Configure the simulation by reading a file.
- Modify the program to, instead of printing on the screen, pretty-print the output into a file. Generate a table with rows corresponding to successive time instances and columns corresponding to buildings and settlers. Create either a formatted text table, or an HTML table.
- Add functions to save the state of simulation into a file and restore it from a file, in binary. Hint: use serialization; don’t forget to make all and every class serializable (perhaps even turn the
LookFor interface into a serializable abstract class).
- Due last week before the Christmas break, or if we cannot organize a class, on the first lab in 2012: either
- Write a graphical interface to display results of the Settlers simulation.
- For bonus points, extend it with a graphical interface to set-up the simulation.
- For bonus points, extend it with a stepping mechanism to display the course of the simulation as it evolves.
- Write a graphical interface to a project of your choice; you need to get the project accepted by Dec. 16.
- Concurrency. Select one of the following exercises.
- Write a program that downloads several pages from the internet and computes a joint histogram of words in the pages. Compare the performance when the pages are downloaded sequentially and concurrently.
- Rewrite the “Settlers” example from cooperative concurrency to fully using Java threads.
- I will provide an almost-ready rewrite with only some bits to finish, stand by if you choose this exercise…
- Rewrite (parallelize) a project of your choice into using Java threads.
- You need to get the project accepted on the first lab of January if you choose this exercise.
- Write a “Reminder” graphical application, managing messages to be displayed at scheduled times, perhaps periodically. Use
ScheduledThreadPoolExecutor .
I will post the solution to the Settlers series of exercises in compiled form only not to spoil the fun, but if you’d rather develop new features than redo the assignments above, contact me, and I’ll share the sources.
Lectures:
- Lecture 1 Δ — Introduction to Java.
- Lecture 2 Δ — Classes, objects, inheritance.
- Lecture 3 Δ — Inheritance and interfaces. Nested types and inner classes.
- Lecture 4 Δ — Review: the Java tutorials.
- Lecture 5 Δ — Exceptions. Packages. Generating documentation with
javadoc .
- Lecture 6 Δ — Covariance and Contravariance. Generics. Collections.
- Lec6.jar Δ — selected code examples from Thinking in Java by Bruce Eckel.
- Lecture 7 Δ — Input / Output.
- Lec7.jar Δ — selected code examples from Thinking in Java by Bruce Eckel.
- Graphical user interfaces: Swing, SWT. Event handling.
- Lec8.jar Δ — selected code examples from Thinking in Java by Bruce Eckel.
- Lecture 9 Δ — Concurrency.
- Lec9.jar Δ — selected code examples from Thinking in Java by Bruce Eckel.
- Lecture 10 Δ — Model-View-Controller pattern for Swing applications.
- Lec10.jar Δ — comprehensive example from Head First design patterns By Eric Freeman, Elisabeth Freeman, Kathy Sierra, Bert Bates.
- Lecture 11 Δ — Usable, secure and maintainable code: Effective Java by Joshua Bloch.
|