Sunday, December 16, 2007

The Fighters' Universe

This homework is an extension of the last one -- the Simple Text Fighter. It turns out that there are two types of fighters in our imaginary Fighters' Universe. In addition to the ordinary players in the last homework, we also have Boss Players, who are more resistant to attacks on lose and gain more power on win.

Read the rules in detail: Homework 2: The Fighters' Universe

Sample output:
Java Fighters' Universe! v20071112
== Round 1 ==
Justin attacks Boss Janice!
Justin loses
*** Justin: 10 -> 9
*** Boss Janice: 10 -> 12
== Round 2 ==
Boss Janice attacks Justin!
Boss Janice wins
*** Boss Janice: 12 -> 18
*** Justin: 9 -> 6
== Round 3 ==
Boss Janice attacks Boss Florence!
Boss Janice loses
*** Boss Janice: 18 -> 14
*** Boss Florence: 10 -> 26
== Round 4 ==
Boss Janice attacks Justin!
Boss Janice loses
*** Boss Janice: 14 -> 10
*** Justin: 6 -> 14
== Round 5 ==
Boss Florence attacks Justin!
Boss Florence wins
*** Boss Florence: 26 -> 50
*** Justin: 14 -> 2
== Round 6 ==
Boss Florence attacks Justin!
Boss Florence loses
*** Boss Florence: 50 -> 26
*** Justin: 2 -> 50
== Round 7 ==
Boss Janice attacks Justin!
Boss Janice loses
Boss Janice is killed!
*** Boss Janice: 10 -> -10
*** Justin: 50 -> 90
== Game over ==
*** Ho Yin's power = 10
*** Justin's power = 90
*** Boss Janice's power = -10
*** Boss Florence's power = 26

My work:

FightersUniverse.java: http://pastebin.ca/819554

BossPlayer.java: http://pastebin.ca/819550

Player.java: http://pastebin.ca/819556

How to run: Compile the files (javac *.java) and run it (java FightersUniverse).

Students' works (ordered by last name):

I asked the students to put their works in a programming portfolio. Feel free to comment.

Cham Hin Cheung: Lingnan Fighting II

Chau Chung Yin: The Fighters’ Universe(simple verison)

Ching Ho Yee: Fighters Universe

Chow Chun Ho: Not yet uploaded

Chu Ming Hei: Homework2

Chu Po Ling: Java of Fighters' Universe! 20071212

Fung Ting Pong: The Fighters’ Universe

Ho Ka Wai: ISM001 Assignment 2~The Fighters' Universe

Ieong Weng Tat: Not yet uploaded!?

Lau Wing Lok: Fighters Universe

Law Mei Kwan: 2nd Homework-The Fighters’ Universe

Lee Cornwall: ISM001 Homework 2: The Fighters’ Universe

Lok Hey Young: ISM001 FightersUniverse

Ng Ho Lam:Text Fighter Universe

Pang Wing In: Java Fighters’ Universe

Tsoi Chung Him: Not yet uploaded!?

Wu Po Yu: The Fighters’ Universe

Monday, December 10, 2007

Doing something great with Java

Last Friday, our junior programmers from ISM001 presented (for the first time in their life) their Java project to the rest of the class. While some of their works are more outstanding than the others, all of them have spent great effort in the project and I hope they enjoy the process of programming.

The requirements are written in the Project Guideline.

Some of the works are particularly impressive. They are:

gamestart.gif

Java Game—逃出嶺南NAB系列(一) by Fung Ting Pong and Ching Ho Yee:

這遊戲是逃出嶺南NAB系列中的第一隻 → 「脫逃!!!NAB204!!!」...... 遊戲講述一個學生在NAB204下課後覺得疲累﹐但又要等組員討論某科project﹐所以在NAB204睡了一會。當他睡醒﹐發現整個房間烏燈黑火﹐所以他去開燈﹐之後去開門﹐發現門已被鎖﹐然後看鐘,發現自己竟然睡了近兩小時﹗結果他就開始想辦法逃離204了。

and the Matchman Battle (火柴人大戰) by Lau Wing Lok:




I asked the students to put their works in a programming portfolio. A full list is given below. Feel free to comment.

Students' works (ordered by last name):

Cham Hin Cheung: Octopus Simulator System

Chau Chung Yin: Flow-shop problem

Chow Chun Ho: Not yet uploaded

Chu Ming Hei: ism001 project

Chu Po Ling: Java of Fractal Generator! 20071207

Fung Ting Pong, Ching Ho Yee: Java Game—逃出嶺南NAB系列(一)

Ho Ka Wai: ISM001 Project~Fractal generator

Ieong Weng Tat: Java Project

Lau Wing Lok: Matchman Battle (Advance Text Fighter)

Law Mei Kwan: MY JAVA PROJECT-Fractal

Lee Cornwall: ISM001 Project One (井字過三關)

Lok Hey Young: Final Project Puzzle

Ng Ho Lam: ISM001 Project- Fractal

Pang Wing In: My Presentation of Fractal

Tsoi Chung Him: Presentation:JAVA GA (Points.java)

Wu Po Yu: Fractal

Enjoy!

Friday, October 19, 2007

Text Fighter

Programming is fun, especially when programming games. Yet game programming often involves advanced graphics and complicated techniques, making it formidable to beginners.

So here comes the Text Fighter, the first homework assignment for our junior programmers in our introductory Java programming course ISM001. It is text-based with no fancy graphics at all, but (I hope) students still find it funny and inspiring.

The rules: [Read full text]

There are two players, each with an initial power of 100. One player attacks the other. The winner, determined by random, receives the difference between the power of the players before the attack. The loser, on the other hand, loses the same amount. If the difference is zero before the attack (i.e. both players have the same power), then use 1 as the difference. The process is repeated until one player is dead, which occurs when the power becomes negative. End the game and display the power of all the users.

Sample output:

Java Simple Text Fighter! v20070928

== Round 1 ==
Player Ho Yin's power = 100
Player Justin's power = 100
Justin attacks Ho Yin!
Justin wins
== Round 2 ==
Player Ho Yin's power = 99
Player Justin's power = 101
Justin attacks Ho Yin!
Justin wins
...
[Read more in the instructions]

Two players are not funny enough, so I've also included a challenge to add more players with human and computer interaction.

My works:

The simple Text Fighter:
Player.java: http://pastebin.ca/742515
How to run:
Compile the file (javac Player.java) and run it (java Player).

The advanced Text Fighter with 4 players:
TextFighter.java: http://pastebin.ca/739752
Player.java: http://pastebin.ca/739756
How to run:
Compile both files (javac *.java) and run TextFighter.java (java TextFighter).
Sample output: http://docs.google.com/Doc?id=dgn28fpv_64c6rhrx

You may also download all the source code as a zip file.

Students' works (ordered by last name):

I asked the students to put their works in a programming portfolio. Feel free to comment.
  1. Cham Hin Cheung: Java - Programming
  2. Chau Chung Yin: 不雨錄
  3. Ching Ho Yee: Works Portfolio
  4. Chu Ming Hei: http://tonycmh.blogspot.com
  5. Chu Po Ling: java_share_area's Xanga Site
  6. Fung Ting Pong: Fungtingpong’s Weblog
  7. Ho Ka Wai: Tom Ho's Program Blog
  8. Ieong Weng Tat: Testplayer (小字頭)
  9. Lau Wing Lok: CIT
  10. Law Mei Kwan: Likefunny2007’s Weblog
  11. Lee Cornwall: Lee Cornwall
  12. Lok Hey Young: http://lokhy-ism001.blogspot.com
  13. Ng Ho Lam: ngholam2007's Xanga Site
  14. Pang Wing In: Joey Pang’s Weblog
  15. Tsoi Chung Him: Yworkshop’s Weblog
  16. Wu Po Yu: Drara's Weblog
That's all. Enjoy the fighting!

Friday, August 24, 2007

What is a Programming Portfolio?

A Programming Portfolio is basically a showcase of all your significant programming works. It can be made the form of a blog (e.g. WordPress.com, Xanga, Blogger.com), a wiki (e.g. wikidot), or just an old-style personal website. Keeping a Programming Portfolio and showing it to the public has several advantages:
  1. You understand more about your own work and learn more about programming.
  2. You learn more about your weaknesses by comparing with others' works.
  3. Your works may be challenged or criticized by someone on the web. That helps you learn.
  4. You may share your masterpieces with other people.
  5. You keep track of your own learning path.
  6. You may use this as part of your C.V..
  7. You may attract other potential career opportunities.
  8. You can show off your works to your friends.
Google knows more about Programming Portfolio. Do a search for more ideas and examples.