This Object Oriented Programming project/application required the creation of two pages
that configure and run a simulated battle between two characters from the game Final Fantasy IV
(a.k.a. Final Fantasy II, in the U.S.).
The project details/specifications follow:
Configuration page: A static HTML configuration page that allows the user to name each of the
two characters, as well as decide on the characters' maximum initial HP and attack power. This page
contains a form that submits the configuration data to the battle script (below).
Battle script: A PHP script that receives input from a form on the configuration page, and displays
a “battle” between the two characters.
For each character there are images representing six different states: normal, attack, defend, victory,
weak, and dead.
The configuration page uses a form to get:
the characters' names
a ceiling for the randomly generated initial Health Power (HP) of each character
a ceiling for the amount of HP that each character might deduct from the other while attacking
The PHP script page does all of the following:
Randomly chooses original FFIV characters to represent each of the two players in the battle. The
possible original character names are Cecil, Edge, Kain,
Rosa, and Rydia.
Uses the names received from the configuration page to represent each player.
Randomly chooses initial HP values for each of the two players using the maxhp value
from the configuration page's form in the range [maxhp/2, maxhp].
Randomly chooses which of the two players will attack first.
Displays the characters in their normal images, as well as the names chosen by the user.
Once the above are complete, the script repeatedly:
Simulates each of the two players alternately taking turns attacking the other.
In each attack round:
The attacking player deducts a random amount of HP from the defending player
in the range [1, maxattack].
HP is never negative.
Display the current HP of each player in a span element with id attributes
of roundXp1hp or roundXp2hp, respectively, where X is the
number of the attack round (starting from 1).
The attacking player is depicted using one of the following images:
If the attacker has not defeated the defender following the attack, the attack image
is used.
Otherwise, the victory image is used.
The defending player is depicted using one of the following:
If the defender has died following the attack, the dead image is used.
If the defender has 5 or fewer HP remaining after the attack, the weak image is used.
Otherwise, the defend image is used.
Descriptive alt attributes are used for the player images (i.e. the action each image
represents is explained)
Once the battle has ended, the script announces the victor using the phrase “Victory for X”, where “X” is the name of the victorious player.
Pascals'a triangle
is a a simple arrangement of numbers all forming the shape of a triangle that contains many interesting patterns.
The triangle is formed by starting with the value 1, and forming rows of the triangle below such that each subsequent row contains 1
more element than the row above it, and each element of a row is the sum of the elements above it and to the left and right, treating
blank entries as 0. All odd-numbered values in the triangle are specially colored, thus generating a fractal called
the Sierpinksi triangle.
Although guestbooks are not as common any more, the application remains interesting still. This specific one records the comments entered
by the user on the simple form and are displayed on a table, along with the user's IP address, the host name, and the date in reverse
chronological order. Running application coming soon.
User Accounts – Create Account & User Login/Logout
The application is used to create accounts and securely store passphrases in a database. Also, the application allows users to log in
using password-based authentication – in which case they are presented with a "log out" button that can be used to end the rudimentary
session. Running application coming soon..