Aug/100
Tic Tac Toe
Since I made my student make a Tic Tac Toe game in Java, I decided to make a Tic Tac Toe in… jQuery!
I know, i had a much easier time (maybe).
Aug/100
Dota Renew: 4-man team lineups
Dec/090
String Library for PHP
I am just creating string functions for PHP that I tend to need. If you want to use it feel free to.
<?php
/************************************************
Programmer: Robin Chang
Date: 12/26/09
Description:
String library
************************************************/// $content = haystack; $start = needle; $stop = ending needle
// returns string starting from the end of $start until the beginning of $stop
// substrR(”what now”,”h”,”w”) returns “at no”
function cut($content,$start,$stop)
{
$cutOff = strlen($start);
$strStart = strpos($content,$start);
$content2 = substr($content,$strStart);
return substr($content,$strStart+$cutOff,strpos($content2,$stop)-$cutOff);
}// $content = haystack; $start = needle
// returns string starting from the end of $start until the end
// substrR(”what”,”h”) returns “at”
function substrR($content,$start)
{
return substr($content,strpos($content,$start)+strlen($start));
}?>
Dec/090
Where v.2
Updated http://where.isrobin.com with new code, same design. Implemented two string functions I created.
<?php
/************************************************
Programmer: Robin Chang
Date: 12/26/09
Description:
A program that uses a TWITTER account
and the format “w:*” where * is a place
************************************************/include “../lib/stringR.php”;
// change this information
$site = “http://twitter.com/rchang4/”;
$keyword = ‘W:’;
$current = “ROBIN IS”;
// stop editing$read = file_get_contents($site); // reads from the website
$read = stristr($read,$keyword); // searches for W:
$time = cut($read,’<span data=”‘,’</span>’);
$time = substrR($time,’”>’);
$location = cut($read,’W:’,'</span>’);echo “<div id=’message’>$current</div>”;
echo “<div id=’where’>$location</div>”;
echo “<div id=’when’>$time</div>”;
?>
Dec/090
Where is Robin?
You can find WHERE I AM (as long as I have updated my last location via twitter)
code to grab where and when from twitter…
<?php
/************************************************
Programmer: Robin Chang
Date: 12/25/09
Description:
A program that uses a TWITTER account
and the format “w:*” where * is a place
************************************************/// change this information
$site = “http://twitter.com/rchang4/”;
$current = “ROBIN IS”;
// stop editing$read = file_get_contents($site); // reads from the website
$location = stristr($read,’W:’); // searches for W:
$time = substr($location,0,strpos($location,”</a>”)); // grabs the time
$time = substr($time,strpos($time,’<span data=”‘));
$time = substr($time,strpos($time,’”>’));
$time = substr($time,2);
$time = substr($time,0,strpos($time,”</span>”));
$location = substr($location,0,strpos($location,”</span>”)); // gets rid of the rest of the info after the first <span> containing the location
$location = substr($location,2); // gets rid of the W:echo “<div id=’message’>$current</div>”;
echo “<div id=’where’>$location</div>”;
echo “<div id=’when’>$time</div>”;
?>
Also did vertical alignment stuff, NOTE TO SELF…
<style type=’text/css’>#floater { float:left; height:30%; margin-bottom:-50px; }</style>
<div id=”floater”></div>
is magical. Can do center with changing height:50%! Very neat-o.
Dec/090
basic include + require files
totally forgot about SQL injection but ya, here’s a quick fix
also has stuff for mysql database connect + disconnect
required.php
<?php
/************************************************
Programmer: Robin Chang
Date: 12/24/09
Description:
Required for several things
** Filters form input
** (Dis)Connects to MySQL DB
** Grabs SESSION information
************************************************/// connects to the database
// returns the link
function ConnectDatabase($server,$user,$pass)
{
$link = mysql_connect($server, $user, $pass);
if (!$link) {
die(’Could not connect: ‘ . mysql_error());
}
return $link;
}// closes a connection to the MySQL DB
// VOID
function CloseConnect($link)
{
mysql_close($link);
}// stores into global the session variables
// VOID
function GrabSession()
{
global $playerID = $_SESSION['playerID'];
global $playerName = $_SESSION['playerName'];
global $playerPass = $_SESSION['password'];
}// VOID
// returns 0 if failed
function CheckLogin()
{
if (!$playerID || !$playerName || !$playerPass) return 0;
$result = mysql_query(”SELECT password FROM Players WHERE userID=$playerID”);
$result = mysql_fetch_row($result);
if ($result[0]!=$playerPass) return 0;
return 1;
}// where $input is a string
// returns a string with escape characters, ‘ = \’, ” = \”, \=\\, etc.
function FilterInput($input)
{
return preg_quote($input);
}?>
include.php
<?php
/************************************************
Programmer: Robin Chang
Date: 12/24/09
Description:
Required for startup
** MySQL Databasee Connect
** Session info
************************************************/include “required.php”;
session_start();
GrabSession();
ConnectDatabase($server,$user,$pass);
if (CheckLogin()==0) die(”Error”);?>
And that’s it so far. Continuing on sometime soon.
Dec/090
working on a turn-based game generator in PHP
objects.php
<?php
/************************************************
Programmer: Robin Chang
Date: 12/23/09
Description:
Allows for objects to
be created and edited
************************************************/function CreateObject($name,$value)
{
mysql_query(”INSERT INTO Objects(Name) VALUES (’$name’)”);
mysql_query(”ALTER TABLE Players ADD COLUMN $name VARCHAR(128)”);
mysql_query(”UPDATE players SET $name=$value”);
}function AddRequirement($id,$required_id,$value,$consume)
{
mysql_query(”UPDATE Objects SET requirements=’$required_id:$value:$consume;’ WHERE id=$id”);
}?>
buy.php
<?php
/************************************************
Programmer: Robin Chang
Date: 12/23/09
Description:
Allows for objects to
be bought
**REQUIRES**
global $playerID for current player
************************************************/// requires object ID that is being bought
// returns 0 if requirements have been met, otherwise the ID that is needed
function Buy($id)
{
$result = CheckRequirements($id);
if (!is_array($result)) return $result;
ConsumeRequirements($result);
AddObject($id)
return 0;
}// requires object ID
// returns list of requirements
function CheckRequirements($id) {
$result = mysql_query(SELECT requirements FROM Objects WHERE id=$id);
$result = mysql_fetch_row($result);
$result = $result[0];
$result = explode(’;',$result);
for ($i=0;$i<count($result);$i++)
{
$requirementInfo = explode(’:',$result[$i]);
for ($j=0;$j<count($requirementInfo);$j++)
{
$result2 = mysql_query(”SELECT $requirementInfo[0] FROM Players WHERE playerID=$playerID”);
$result2 = mysql_fetch_row($result2);
if ($result2[0] < $requirementInfo[1])
return $requirementInfo[1];
}
}
return $result;
}// requires list of requirements
// VOID
function ConsumeRequirements($result)
{
for ($i=0;$i<count($result);$i++)
{
$requirementInfo = explode(’:',$result[$i]);
for ($j=0;$j<count($requirementInfo);$j++)
{
$result2 = mysql_query(”SELECT $requirementInfo[0] FROM Players WHERE playerID=$playerID”);
$result2 = mysql_fetch_row($result2);
$newValue = $result2 – $requirementInfo[2];
mysql_query(”UPDATE Players SET $requirementInfo[0]=$newValue WHERE playerID=$playerID”);
}
}
}// requires object ID, player ID
// VOID
function AddObject($id,$playerID)
{
$result = mysql_query(”SELECT $id FROM Players WHERE playerID=$playerID”);
$result = mysql_fetch_row($result);
$newValue = $result[0] + 1;
mysql_query(”UPDATE Players SET $id=$newValue WHERE playerID=$playerID”);
}?>
Aug/091
Dota Renew Pudge!
Basic
Pudge, the hero name of Butcher, is one of the lower tier heroes. In a normal game, his pick priority would be low as his main job is to act as a tank and Mannorth (Pit Lord) is a much better choice. Pudge is good to kill noobs, however. He’s more for looks than actual play-ability. He has medium->high HP but slow attack. He has a slow move speed. Without his disease and hook, it would be impossible for him to get the jump on a hero. He is a strength character.
Hook
Hook is hard to land on a good player, easy to land on a new player. This skill does not home. You have to click the ground where you think the unit that you desire will be by the time this lands. Most veterans that play against Pudge will know how to properly move so be wary. To avoid being hook make sure you have units surrounding you so they can’t hook you from the side. If that’s not a possibility then always move around, never stop. The second you stop is the second you can be grabbed. Also, even if you are not in range, if you cast the hook it will cast in that direction. That means even though you are 4 screens away and you cast it, it will attempt to hook. The way I use hook is to wait for a player to stop moving and use it, or if the person is moving in a linear fashion then hook the spot he will be at. Hook will land even in fog of war if it finds the target. You can attempt blind hooks. BE WARY, THIS SKILL DOES NOT LAND WHERE YOU ARE AFTER IT HOOKS, BUT WHERE YOU STARTED WHEN THE HOOK STARTED.
Disease
Disease is an AOE damage per second. It is for anyone within 20 or so units around you. Basically you have to stand near them. It deals 75% damage to yourself so be wary. You can use this skill to commit suicide to deny them. The reason this skill is good is not the damage, but the fact that it slows the movement of all those in the area. This skill also helps you farm against summoners such as Lich as it will deplete skeleton soldiers of their hp rapidly.
Heap Flesh
This skill is a passive that just gives you additional strength. This effectively gives you more health, health regeneration, and damage as Pudge is a strength character.
Deep Bite
This disease has nearly no damage in the beginning but doubles up rapidly after leveling the skill. It’s main usage is to incapitate a hero by slowing it down. This skill will slow the movement speed of a hero. This will stack on to Disease if you have it on. This basically immobilizes the hero. It would be proper to use hook since by the time you use this skill, they should be in nearly melee range and you can hit for the full damage of hook.
Skill Build
Hook – Disease – Hook – Disease – Hook – Deep Bite – Hook – Flesh – Flesh – Flesh- Flesh – Deep Bite – x – x – x – Deep Bite
(x is the +2 to all stats)
Support Tank
You will be the tank if your team is built mainly of casters or low->medium health units. Make use of your slots of being a support as well.
Starting Build
Ring of Basilius – Scroll of Teleportation
Depending on what you need, get 2 Circlets or 1 Gauntlet and 1 Ring of Regeneration. All of these items can be combined later on to form the items you will be using for the rest of the game.
Get a Strength Bracer or Staff of Radiance. Then get a Wraith Band. It is also recommended to get a Rod of Power if you can afford one, and assuming you built the Staff of Radiance beforehand.
Ideal Ending Items:
Horn of Battle
Ring of Basilius
Staff of Radiance
Rod of Power
Theron’s Cloak
Treads
If you can afford it, the Asssault Currais is a very good item to buy. Drop the Staff of Radiance as the 2 HP/second is the least necessary at this point.
Sieger Build
Same Starting Build items, splits around the end.
Assault Currais is a top priority.
Ideal Ending Items:
Assault Currais
Horn of Battle
Hyperstone
Hyperstone
Hyperstone
Treads
Of course, having that much gold to buy all the hyperstones is pretty out there, so in most games just stick with Belt of Strength + Gloves of Haste and combine to make them in the Weapons of Chieftain.
Early Game
get hero kills and gold advantage. If you have a good team, get your team to let you get the last hit on every hero after you get Flesh as it will give you more strength (1.6 strength/hero at max). That’s a lot. 10 hero kills and you get 16 strength. That’s an additional 256 hp! The gold gain will also pave way to you becoming an effective support Tank hero or all out sieger, depending on the need of the game.
Late Game
You will either be in the position as losing in which case you should just farm unless your whole team is pushing. If you are winning, I would recommend going all-out siege. Get attackspeed as you should already have high damage. If you need to be the team’s tank, then do so.
Laning
Against Ranged
Stay in the back of the creeps but within EXP range. If you get pushed out of EXP range also come back whenever a unit is about to die so you receive the EXP. If possible, get the last hit on units to receive the gold. But don’t be alarmed if you find yourself not getting too much gold. Wait until level 5 or so before attempting to strike. By level 5 you should have level 3 harpoon and level 2 disease. That will be very effective in snatching the hero and killing him. Most ranged heroes do not have enough HP to withstand this combination, along side 3 or your normal attacks. However, if you don’t damage the hero enough just let him be until the cooldown on hook is up and give it another shot.
Against Melee
Stay along side or close to the wave. Don’t tank damage. Get the last hit. It is particularly easy to also deny your own units. Most Melee heroes will have enough hp to be hooked once and maybe twice. You will have to be wary not to lose too much health to be in a critical point. You should be dominating the lane, however.
Sieging
Your hero can effectively rip a building out. He deals a decent amount of damage. Give him a piece of armor and let him tank the damage so creep waves rip the building, however. You could also get Attackspeed to siege. He is good siege and decent hero kill.
Hero Killing
This is reliant on how good you are with timing the hook. If you land the hook, you get the kill in most cases. Always turn on disease after you hook, no matter if you miss or not. If you wait, a hero may run away or escape the disease range in some cases.
Defending
You can also be a defender, but it is less likely. Your priority on being a defender is one of the lowest unless it has become a long game. If it’s a long game, you are the best farmer as you are the only hero with the ability to grow endlessly. IF the game is going to end in another push, you should join that push as acting as a tank for the team is better.
Aug/090
Dota Renew Sidereal Engine
http://hubpages.com/hub/Dota-Renew-Sidereal-Engine
Basic:
His nickname sums up what he is, Tank. He is a tank because he’s durable, and because he looks like one. He can serve two purposes, high damage to buildings and AOE destruction to both heroes, creeps, and buildings all in one blow. He has high damage, high strength (high health and regeneration).
He requires little if any mana regeneration. His attackspeed is relatively slow, only being “average”. He attacks slow while in siege mode, however. This is a trade off for chaos damage, which is one of his best skills. His agility gain is very low, being a 1 digit number for his first few levels. Getting a Blade of Alacritiy basically doubles his base agility for most of the game. Not advisable, however.
There are two methods of playing Tank. One is the invulernable Tank which never dies. To do so you stack as much armor and health bonuses as you can. This Tank is effective to annoying people. The second, and much better Tank build which one should always focus are getting, is the machine gun tank. Getting him to do 1 attack/second would strip any building of it’s HP in less than 15 seconds (except for the main). That’s a pretty neat thing if I do say.
Skills:
Astral Protection:
Passive. Get this skill always. This is very helpful in killing enemies and warding heroes from attacking you while you’re in siege mode or just walking. It gets you a lot of gold in lane as it gets last hits frequently. Top priority. Low mana cost for it’s duration. It also helps you from getting harassed in lane as it has more range than you. You can use it to chase down heroes so you don’t stop to attack them. Just keep walking by them. It also makes creeps and towers from not attacking you while you’re damaging the hero with this skill. You cannot control the target.
Energy Surge:
Gives you bonus armor and an active mana to health conversion. Only get when necessary. Sometimes you will find that you will need it early on while other times you won’t need it until later. I usually get it later on unless being extremely harassed.
Siege Mode:
The main reason Tank is a kick ass hero! In this form, he is immobile but can chaos damage. That means armor on buildings are useless! They take full damage. That’s at least 100 per hit. You have a minimum range that you have to be wary of, however. You cannot attack things within 50 distance of you.
Collapse:
Very good ultimate. High AOE. The cooldown is nearly as long as it takes for your mana to regenerate so it’s fine. It also does a decent amount of damage. Good against heroes, normal units, and even buildings! Get this when possible and spam it.
Skill Build:
No matter which one you get, I advice the same route unless you are requiring that extra dose of health, in which case just get siege mode later on.
Level 1: Astral Protection
Level 2: Energy Surge
Level 3: Astral Protection
Level 4: Energy Surge
Level 5: Astral Protection
Level 6: Collapse
Level 7: Astral Protection
———
From there, just pick your own skills as required. I would get siege mode next if I was coming up to a tower or so.
Invulernable Tank:
Okay, he’s not invulernable, but he’s nearly impossible to kill. With his mana to hp conversation, he is effectively indestructible.
Most beginners go this mode. This makes him a permanent nuisance, however, disables him from his more effective skill which is to siege. He must stay outside of siege mode in order to use his conversion skill and for his mobility.
Item Build (Invulernable):
I would suggest getting any armor you can afford. For example, begin the game with a Ring of Basilius to help push creeps and get the armor.
The ideal armor to get would be shadowplates, but those are ridiculously expensive. So you can just get Plate Mails. If you can’t afford that, you can go with the lower costing mana.
Opening Build:
Ring of Basilius, Gauntlet of Strength
Mid-Game:
Ring of Basilius, Plate Mail, Plate Mail, Power Treads (str)
Late-Game:
Theron’s Magical Cloak (made from the ring of basilius), Plate Mail, Plate Mail, Power Treads (str), Shadowplate, Shadowplate
Machine Gun Tank:
This is the attackspeed build. This pushes the siege mode skill’s main advantage: chaos damage. To utilize it to the max, get attackspeed. Power treads, Weapons of the Chieftains, and hyperstone are good items to go for. Horn of Battle can be helpful as well.
Item Build (Machine Gun)
This route is more determined as there are a more limited number of items that aids in attack speed.
But again, if you can’t afford a certain item you can substitute it for something of worthy cost.
Opening Build:
Ring of Basilius
Next, get a Belt of Strength. After getting a Belt get Gloves of Haste. Get Boots of Speed and get your Power Treads (str).
Early Mid-Game:
Ring of Basilius, Power Treads (Str), Gloves of Haste, Belt of Strength
Mid-Game:
Ring of Basilius, Power Treads (str), Weapons of Chieftain (from the Gloves of Haste and Ogre Axe), Gloves of Haste
Late Game:
Power Treads (str), Weapons of Chieftain, Weapons of Chieftain, Hyperstone, Hyperstone, Hyperstone
Remember, if you can’t afford certain items, get substitutes. For example, if you want to make use of that final slot but can’t afford a hyper quite yet, get gloves of haste. Just sell it later on.