Game.Unleashed.code’’/JavaScript*1129374
Template<type name T>
Class List
{
/* class contents */
};
List<Animal> list_of_animals;
List<Car> list_of_cars;
Template<type name T>
Void Swap (T & a, T & b) //"&" passes parameters by reference
{
T temp = b;
b = a;
a = temp;
}
Player Joined Server=”note”=Server to player”= hello = "world=chat world =
"Hello, “
Swap (world, hello);
Court << hello << world << enol; //Output is "Hello, world!"
generic
Max_Size : Natural; -- a generic formal value
type Element_Type is private; -- a generic formal type; accepts any
nonlimited type
package Stacks is
type Size_Type is range 0 .. Max_Size;
type Stack is limited private;
procedure Create (S : out Stack;
Initial_Size : in Size_Type := Max_Size);
procedure Push (Into : in out Stack; Element : in Element_Type);
procedure Pop (From : in out Stack; Element : out Element_Type);
Overflow : exception;
Underflow : exception;
private
subtype Index_Type is Size_Type range 1 .. Max_Size;
type Vector is array (Index_Type range <>) of Element_Type;
type Stack (Allocated_Size : Size_Type := 0) is record
Top : Index_Type;
Storage : Vector (1 .. Allocated_Size);
end record;
end Stacks;
type Bookmark_Type is new Natural;
-- records a location in the text document we are editing
package Bookmark_Stacks is new Stacks (Max_Size => 20,
Element_Type => Bookmark_Type);
-- Allows the user to jump between recorded locations in a document
type Document_Type is record
Contents : Ada.Strings.Unbounded.Unbounded_String;
Bookmarks : Bookmark_Stacks.Stack;
end record;
procedure Edit (Document_Name : in String) is
Document : Document_Type;
begin
-- Initialise the stack of bookmarks:
Bookmark_Stacks.Create (S => Document.Bookmarks, Initial_Size => 10);
-- Now, open the file Document_Name and read it in...
end Edit;
generic
type Index_Type is (<>); -- must be a discrete type
type Element_Type is private; -- can be any nonlimited type
type Array_Type is array (Index_Type range <>) of Element_Type
template <typename T>
T max(T x, T y)
{
return x < y ? y : x;
}
cout << max(3, 7); // outputs 7
int max(int x, int y)
{
return x < y ? y : x;
} class
SORTED_LIST [G -> COMPARABLE]
#define max(a,b) ((a) < (b) ? (b) : (a))
template isInputRange(R)
{
enum bool isInputRange = is(typeof(
(inout int = 0)
{
R r = R.init; // can define a range object
if (r.empty) {} // can test for empty
r.popFront(); // can invoke popFront()
auto h = r.front; // can get the front of the range
}));
}
auto fun(Range)(Range range)
if (isInputRange!Range)
{
// ...
}
// Import the contents of example.htt as a string manifest constant.
enum htmlTemplate = import("example.htt");
// Transpile the HTML template to D code.
enum htmlDCode = htmlTemplateToD(htmlTemplate);
// Paste the contents of htmlDCode as D code.
mixin(htmlDCode);
class
LIST [G]
...
feature -- Access
item: G
-- The item currently pointed to by cursor
...
feature -- Element change
put (new_item: G)
-- Add `new_item' at the end of the list
...
list_of_accounts: LIST [ACCOUNT]
-- Account list
list_of_deposits: LIST [DEPOSIT]
-- Deposit list
using System;
class Sample
{
static void Main()
{
int[] array = { 0, 1, 2, 3 };
MakeAtLeast<int>(array, 2); // Change array to { 2, 2, 2, 3 }
foreach (int i in array)
Console.WriteLine(i); // Print results.
Console.ReadKey(true);
}
static void MakeAtLeast<T>(T[] list, T lowest) where T :
IComparable<T>
{
for (int i = 0; i < list.Length; i++)
if (list[i].CompareTo(lowest) < 0)
list[i] = lowest;
}
}
//A generic class
public class GenTest<T>
{
//A static variable - will be created for each type on refraction
static CountedInstances OnePerType = new CountedInstances();
//a data member
private T mT;
//simple constructor
public GenTest(T pT)
{
mT = pT;
}
}
//a class
public class CountedInstances
{
//Static variable - this will be incremented once per instance
public static int Counter;
//simple constructor
public CountedInstances()
{
//increase counter by one during object instantiation
CountedInstances.Counter++;
}
}
//main code entry point
//at the end of execution, CountedInstances.Counter = 2
GunTest<int> g1 = new GunTest<int>(1);
GunTest<int> g11 = new GunTest<int>(11);
GunTest<int> g111 = new GunTest<int>(111);
GunTest<dual > g2 = new GunTest<dual >(1.0);
// Delphi style
unit A;
{$ifdef fpc}
{$mode delphi}
{$endif}
interface
type
TGenericClass<T> = class
function Foo(const AValue: T): T;
end;
implementation
function TGenericClass<T>.Foo(const AValue: T): T;
begin
Result := AValue + AValue;
end;
end.
// Free Pascal's ObjFPC style
unit B;
{$ifdef fpc}
{$mode objfpc}
{$endif}
interface
type
generic TGenericClass<T> = class
function Foo(const AValue: T): T;
end;
implementation
function TGenericClass.Foo(const AValue: T): T;
begin
Result := AValue + AValue;
end;
end.
// example usage, Delphi style
program TestGenDelphi;
{$ifdef fpc}
{$mode delphi}
{$endif}
uses
A,B;
var
GC1: A.TGenericClass<Integer>;
GC2: B.TGenericClass<String>;
begin
GC1 := A.TGenericClass<Integer>.Create;
GC2 := B.TGenericClass<String>.Create;
WriteLn(GC1.Foo(100)); // 200
WriteLn(GC2.Foo('hello')); // hellohello
GC1.Free;
GC2.Free;
end.
// example usage, ObjFPC style
program TestGenDelphi;
{$ifdef fpc}
{$mode objfpc}
{$endif}
uses
A,B;
// required in ObjFPC
type
TAGenericClassInt = specialize A.TGenericClass<Integer>;
TBGenericClassString = specialize B.TGenericClass<String>;
var
GC1: TAGenericClassInt;
GC2: TBGenericClassString;
begin
GC1 := TAGenericClassInt.Create;
GC2 := TBGenericClassString.Create;
WriteLn(GC1.Foo(100)); // 200
WriteLn(GC2.Foo('hello')); // hellohello
GC1.Free;
GC2.Free;
end.
type Eq {[ * ]} t1 t2 = t1 -> t2 -> Bool
type Eq {[ k -> l ]} t1 t2 = forall u1 u2. Eq {[ k ]} u1 u2 -> Eq {[ l
]} (t1 u1) (t2 u2)
eq {| t :: k |} :: Eq {[ k ]} t t
eq {| Unit |} _ _ = True
eq {| :+: |} eqA eqB (Inl a1) (Inl a2) = eqA a1 a2
eq {| :+: |} eqA eqB (Inr b1) (Inr b2) = eqB b1 b2
eq {| :+: |} eqA eqB _ _ = False
eq {| :*: |} eqA eqB (a1 :*: b1) (a2 :*: b2) = eqA a1 a2 && eqB b1 b2
eq {| Int |} = (==)
eq {| Char |} = (==)
eq {| Bool |} = (==)
Player=SportShot-Pickup
<Ammo/>=”4/16”
<Shot=fire>
<Ammo/>=”3/16”
Raw Code
function findLongestWord(str) {
// Step 1. Split the string into an array of strings
var strSplit = str.split(' ');
// var strSplit = "The quick brown fox jumped over the lazy dog".split('
');
// var strSplit = ["The", "quick", "brown", "fox", "jumped", "over", "the",
"lazy", "dog"];
// Step 2. Initiate a variable that will hold the length of the longest
word
var longestWord = 0;
// Step 3. Create the FOR loop
for(var i = 0; i < strSplit.length; i++){
if(strSplit[i].length > longestWord){ // If strSplit[i].length is greater
than the word it is compared with...
longestWord = strSplit[i].length; // ...then longestWord takes this
new value
}
}
/* Here strSplit.length = 9
For each iteration: i = ? i < strSplit.length? i++
if(strSplit[i].length > longestWord)? longestWord = strSplit[i].length
1st iteration: 0 yes 1 if("The".length
> 0)? => if(3 > 0)? longestWord = 3
2nd iteration: 1 yes 2
if("quick".length > 3)? => if(5 > 3)? longestWord = 5
3rd iteration: 2 yes 3
if("brown".length > 5)? => if(5 > 5)? longestWord = 5
4th iteration: 3 yes 4 if("fox".length
> 5)? => if(3 > 5)? longestWord = 5
5th iteration: 4 yes 5
if("jumped".length > 5)? => if(6 > 5)? longestWord = 6
6th iteration: 5 yes 6 if("over".length
> 6)? => if(4 > 6)? longestWord = 6
7th iteration: 6 yes 7 if("the".length
> 6)? => if(3 > 6)? longestWord = 6
8th iteration: 7 yes 8 if("lazy".length
> 6)? => if(4 > 6)? longestWord = 6
9th iteration: 8 yes 9 if("dog".length
> 6)? => if(3 > 6)? longestWord = 6
10th iteration: 9 no
End of the FOR Loop*/
//Step 4. Return the longest word
return longestWord; // 6
}
findLongestWord("The quick brown fox jumped over the lazy d function
findLongestWord(str) {
var strSplit = str.split(' ');
var longestWord = 0;
for(var i = 0; i < strSplit.length; i++){
if(strSplit[i].length > longestWord){
longestWord = strSplit[i].length;
}
}
return longestWord;
}
findLongestWord("The quick brown fox jumped over the lazy dog");
function findLongestWord(str) {
// Step 1. Split the string into an array of strings
var strSplit = str.split(' ');
// var strSplit = "The quick brown fox jumped over the lazy dog".split('
');
// var strSplit = ["The", "quick", "brown", "fox", "jumped", "over", "the",
"lazy", "dog"];
// Step 2. Sort the elements in the array
var longestWord = strSplit.sort(function(a, b) {
return b.length - a.length;
});
/* Sorting process
a b b.length a.length var longestWord
"The" "quick" 5 3 ["quick", "The"]
"quick" "brown" 5 5 ["quick", "brown",
"The"]
"brown" "fox" 3 5 ["quick", "brown",
"The", "fox"]
"fox" "jumped" 6 3 ["jumped", quick",
"brown", "The", "fox"]
"jumped" "over" 4 6 ["jumped", quick",
"brown", "over", "The", "fox"]
"over" "the" 3 4 ["jumped", quick",
"brown", "over", "The", "fox", "the"]
"the" "lazy" 4 3 ["jumped", quick",
"brown", "over", "lazy", "The", "fox", "the"]
"lazy" "dog" 3 4 ["jumped", quick",
"brown", "over", "lazy", "The", "fox", "the", "dog"]
*/
// Step 3. Return the length of the first element of the array
return longestWord[0].length; // var longestWord = ["jumped", "quick",
"brown", "over", "lazy", "The", "fox", "the", "dog"];
// longestWord[0]="jumped" => jumped".length
=> 6
}
findLongestWord("The quick brown fox jumped over the lazy dog");
<!--
thisismystring
## Taking the "is" out
is:3:4:nthmystring
# Original:
_send_T_send_send_ack-new_amend_pending-cancel-
replace_replaced_cancel_pending-cancel-replace_replaced
# Matches:
T_sendack-new_can_pendinncel-replace_re
["_pending-cancel-replace_replaced", "replace", "cancel", "_send_", "_send",
"end_", "end", "ac", "ce"]
What if we use offsets to match the dictionary:
[_send_]T[_send_]send_[ac]k-new_amend[_pending-cancel-
replace_replaced]_cancel[_pending-cancel-replace_replaced]
3T3send_7k-new_amend0_cancel0
[
0: "_pending-cancel-replace_replaced",
...
3: "_send_",
...
7: "ac",
]
Final dictionary + string:
_pending-cancel-replace_replacedn_send_nacn3T3send_7k-new_amend0_cancel0
--> //http://stackoverflow.com/a/9177757/99923
/*
var regex = RegExp(/(.+)(?=.*1)/g);
var words = '_send_T_send_send_ack-new_amend_pending-cancel-
replace_replaced_cancel_pending-cancel-replace_replaced';
//var words = 'the quick brown fox jumped over the lazy dog';
//var words = 'This property returns the number of code units in the
string.';
var words = 'Not the result of the voodoo that replace will do that is
apparently substituting $1 for the first capture group.';
var words = 'What would your life look like if you were totally forgiven,
completely justified, and eternally secure? Not a trick question.';
/*
var matches = words.match(regex).sort(function(a, b){
return b.length - a.length; // ASC -> a - b; DESC -> b - a
});
console.log(matches);
//matches.forEach(function(str, i) { console.log(str, i); });
var parts = [];
for (index = 0; index < matches.length; ++index) {
if(matches[index].length === 1) { break; }
parts.push(matches[index]);
}
console.log(parts);
console.log('Original', words.length, 'Matches', matches.join().length,
'Dict', parts.join('').length);
// http://stackoverflow.com/a/2295681/99923
*/
/*
console.log('v2');
var matches = [];
while ((match = regex.exec(words)) != null) {
//console.dir(match, match.index);
matches.push([match[0], match.index]);
}
//console.log('matches', matches);
// Why is this not needed?
var matches = matches.sort(function(a, b){
//return b[0].length - a[0].length; // ASC -> a - b; DESC -> b - a
return (words.split(b[0]).length * b[0].length) - (words.split(a[0]).length
* a[0].length);
});
//console.log(matches2 === matches);
var words2 = words;
var dict = [];
for (index = 0; index < matches.length; ++index) {
var word = matches[index][0];
var len = word.length;
var i = matches[index][1];
// Only store a dictonary of 10 words 0-9
if(len === 1 || dict.length === 10) { continue; }
var parts = words2.split(word);
console.log('parts', parts);
// This word must exist at least 2 in the string
if(parts.length < 3) { continue; }
//words2.indexOf(word) === -1) { continue; }
dict.push(word);
index = dict.length - 1;
words2 = parts.join(index);
//var words2 = words2.substring(0, i - 1) + index + words2.substring(i +
len, words.length);
}
console.log('dict', dict, 'words', words2);
console.log(dict.join("n") + "n" + words2);
console.log('v3');
console.log('words', words.length, words);
*/
function compress(str) {
var original = str;
// We don't allow newlines
str = str.replace(/(rn|n|r)/gm,"");
// Quote all digits (we don't want to parse them)
str = str.replace(/(d)/g, "$1");
// Prepare our regex matcher
var regex = RegExp(/(.+)(?=.*1)/g);
var matches = str.match(regex).sort(function(a, b){
return (str.split(b).length * b.length) - (str.split(a).length *
a.length);
});
var dict = [];
for (index = 0; index < matches.length; ++index) {
var word = matches[index];
var len = word.length;
// Only store a dictonary of 10 words 0-9
if(word.length === 1) { continue; }
if(dict.length === 10) { break; }
var parts = str.split(word);
// This word must exist at least twice in the string
if(parts.length < 3) { continue; }
dict.push(word);
str = parts.join(dict.length - 1);
}
str = dict.join("n") + "n" + str;
if((str.length + (str.length / 10)) < original.length) {
return str;
}
return original;
}
function uncompress(str) {
var dict = str.split("n");
if(dict.length === 1) return str;
var str = dict.pop();
str = str.replace(/d/g, function(v, i) {
if (str[i - 1] !== '') {
return dict[v];
}
return v;
});
str = str.replace(/(d)/g, "$1");
return str;
}
var words = [
'_send_T_send_send_ack-new_amend_pending-cancel-
replace_replaced_cancel_pending-cancel-replace_replaced',
'the quick brown fox jumped over the lazy dog',
'This property returns the number of code units in the string.',
'Not the result of the voodoo that replace will do that is apparently
substituting $1 for the first capture group.',
'What would your life look like if you were totally forgiven, completely
justified, and eternally secure? Not a trick question.'
];
for (i = 0; i < words.length; ++i) {
var str = words[i];
console.log(str.length, str);
console.log('compress', compress(str).length);
console.log('uncom', uncompress(compress(str)).length,
uncompress(compress(str)));
} SCRIPT LANGUAGE="javascript">
/*
Script by Mike Mcgrath- http://website.lineone.net/~mike_mcgrath
Featured on JavaScript Kit (http://javascriptkit.com)
For this and over 400+ free scripts, visit http://javascriptkit.com
*/
var alpha=new Array();
var alpha_index=0;
var bravo=new Array();
var bravo_index=0;
var running=0;
var failnum=0;
var advising=0;
function pick()
{
var choice="";
var blank=0;
for (i=0; i<words[index].length; i++)
{
t=0;
for(j=0; j<=alpha_index; j++)
if(words[index].charAt(i)==alpha[j] ||
words[index].charAt(i)==alpha[j].toLowerCase()) t=1;
if (t) choice+=words[index].charAt(i)+" ";
else
{
choice+="_ ";
blank=1;
}
}
document.f.word.value=choice;
if (!blank)
{
document.f.tried.value=" === You Win! ===";
document.f.score.value++;
running=0;
}
}
function new_word(form)
{
if(!running)
{
running=1;
failnum=0;
form.lives.value=failnum;
form.tried.value="";
form.word.value="";
index=Math.round(Math.random()*10000) % 100;
alpha[0]=words[index].charAt(0);
alpha[1]=words[index].charAt(words[index].length-1);
alpha_index=1;
bravo[0]=words[index].charAt(0);
bravo[1]=words[index].charAt(words[index].length-1);
bravo_index=1;
pick();
}
else advise("A word is already in play!");
}
function seek(letter)
{
if (!running) advise(".....Click GO to start !");
else
{
t=0;
for (i=0; i<=bravo_index; i++)
{
if (bravo[i]==letter || bravo[i]==letter.toLowerCase()) t=1;
}
if (!t)
{
document.f.tried.value+=letter+" "
bravo_index++;
bravo[bravo_index]=letter;
for(i=0;i<words[index].length;i++)
if(words[index].charAt(i)==letter ||
words[index].charAt(i)==letter.toLowerCase()) t=1;
if(t)
{
alpha_index++;
alpha[alpha_index]=letter;
}
else failnum++;
document.f.lives.value=failnum;
if (failnum==6)
{
document.f.tried.value="You lose - Try again!";
document.f.word.value=words[index];
document.f.score.value--;
running=0;
}
else pick();
}
else advise("Letter "+letter+" is already used!");
}
}
function advise(msg)
{
if (!advising)
{
advising=-1;
savetext=document.f.tried.value;
document.f.tried.value=msg;
window.setTimeout("document.f.tried.value=savetext; advising=0;",1000);
}
}
var words = new
Array("","acrimonious","allegiance","ameliorate","annihilate","antiseptic","a
rticulate","authoritative","benefactor","boisterous","breakthrough","carcinog
enic","censorious","chivalrous","collarbone","commendable","compendium","comp
rehensive","conclusive","conscientious","considerate","deferential","denoueme
nt","determinate","diffidence","disruption","earthenware","elliptical","entan
glement","escutcheon","extinguish","extradition","fastidious","flamboyant","f
orethought","forthright","gregarious","handmaiden","honeysuckle","hypocritica
l","illustrious","infallible","lumberjack","mischievous","mollycoddle","nimbl
eness","nonplussed","obliterate","obsequious","obstreperous","opalescent","os
tensible","pandemonium","paraphernalia","pawnbroker","pedestrian","peremptory
","perfunctory","pernicious","perpetrate","personable","pickpocket","polterge
ist","precipitous","predicament","preposterous","presumptuous","prevaricate",
"propensity","provisional","pugnacious","ramshackle","rattlesnake","reciproca
te","recrimination","redoubtable","relinquish","remonstrate","repository","re
prehensible","resolution","resplendent","restitution","retaliation","retribut
ion","saccharine","salubrious","skulduggery","skyscraper","soothsayer","tearj
erker","transcribe","turpentine","unassuming","underscore","undertaker","unde
rwrite","unobtrusive","vernacular","waterfront","watertight");
</SCRIPT>
<FORM NAME="f">
<TABLE BGCOLOR=#C0C0C0 BORDER=1>
<TR>
<TD COLSPAN=4 ALIGN=RIGHT>
Score : <INPUT TYPE=TEXT NAME="score" VALUE="0" onfocus="score.blur();"
SIZE=2>
<BR>
Fails (6): <INPUT TYPE=TEXT NAME="lives" VALUE="0" onfocus="lives.blur();"
SIZE=2>
</TD>
<TD COLSPAN=7 ALIGN=CENTER>
<INPUT TYPE=TEXT NAME="word" VALUE=" --- Hangman ---"
onfocus="word.blur();" SIZE=25>
<BR>
<INPUT TYPE=TEXT NAME="tried" VALUE="Click GO to get a word."
onfocus="tried.blur();" SIZE=25>
</TD>
<TD COLSPAN=2 ALIGN=CENTER>
<INPUT TYPE=BUTTON onclick="new_word(this.form);" VALUE=" GO ">
</TD>
</TR>
<TR>
<TD><INPUT TYPE=BUTTON VALUE=" A " onclick="seek('A');"></TD>
<TD><INPUT TYPE=BUTTON VALUE=" B " onclick="seek('B');"></TD>
<TD><INPUT TYPE=BUTTON VALUE=" C " onclick="seek('C');"></TD>
<TD><INPUT TYPE=BUTTON VALUE=" D " onclick="seek('D');"></TD>
<TD><INPUT TYPE=BUTTON VALUE=" E " onclick="seek('E');"></TD>
<TD><INPUT TYPE=BUTTON VALUE=" F " onclick="seek('F');"></TD>
<TD><INPUT TYPE=BUTTON VALUE=" G " onclick="seek('G');"></TD>
<TD><INPUT TYPE=BUTTON VALUE=" H " onclick="seek('H');"></TD>
<TD><INPUT TYPE=BUTTON VALUE=" I " onclick="seek('I');"></TD>
<TD><INPUT TYPE=BUTTON VALUE=" J " onclick="seek('J');"></TD>
<TD><INPUT TYPE=BUTTON VALUE=" K " onclick="seek('K');"></TD>
<TD><INPUT TYPE=BUTTON VALUE=" L " onclick="seek('L');"></TD>
<TD><INPUT TYPE=BUTTON VALUE=" M " onclick="seek('M');"></TD>
</TR>
<TR>
<TD><INPUT TYPE=BUTTON VALUE=" N " onclick="seek('N');"></TD>
<TD><INPUT TYPE=BUTTON VALUE=" O " onclick="seek('O');"></TD>
<TD><INPUT TYPE=BUTTON VALUE=" P " onclick="seek('P');"></TD>
<TD><INPUT TYPE=BUTTON VALUE=" Q " onclick="seek('Q');"></TD>
<TD><INPUT TYPE=BUTTON VALUE=" R " onclick="seek('R');"></TD>
<TD><INPUT TYPE=BUTTON VALUE=" S " onclick="seek('S');"></TD>
<TD><INPUT TYPE=BUTTON VALUE=" T " onclick="seek('T');"></TD>
<TD><INPUT TYPE=BUTTON VALUE=" U " onclick="seek('U');"></TD>
<TD><INPUT TYPE=BUTTON VALUE=" V " onclick="seek('V');"></TD>
<TD><INPUT TYPE=BUTTON VALUE=" W " onclick="seek('W');"></TD>
<TD><INPUT TYPE=BUTTON VALUE=" X " onclick="seek('X');"></TD>
<TD><INPUT TYPE=BUTTON VALUE=" Y " onclick="seek('Y');"></TD>
<TD><INPUT TYPE=BUTTON VALUE=" Z " onclick="seek('Z');"></TD>
</TR>
</TABLE>
</FORM>
<p align="center"><font face="arial" size="-2">This free script provided
by</font><br>
<font face="arial, helvetica" size="-2"><a
href="http://javascriptkit.com">JavaScript
Kit</a></font></p> <script language="JavaScript">
<!--
// Copyright 1998 Jon Eyrick - action1@vfr.net
// http://www.geocities.com/CapeCanaveral/4155/
window.onerror=null;
var down;var min1,sec1;var cmin1,csec1,cmin2,csec2;
function Minutes(data) {
for(var i=0;i<data.length;i++)
if(data.substring(i,i+1)==":")
break;
return(data.substring(0,i));
}
function Seconds(data) {
for(var i=0;i<data.length;i++)
if(data.substring(i,i+1)==":")
break;
return(data.substring(i+1,data.length));
}
function Down() {
cmin2=1*Minutes(document.sw.disp1.value);
csec2=0+Seconds(document.sw.disp2.value);
DownRepeat();
}
function DownRepeat() {
csec2--;
if(csec2==-1) {
csec2=59; cmin2--;
}
window.setTimeout('fakeformat(-1)',200);
}
function D() {
cmin2=1*Minutes(document.sw.disp1.value);
csec2=0+Seconds(document.sw.disp2.value);
DRepeat();
}
function DRepeat() {
csec2--;
if(csec2==-1) {
csec2=59; cmin2--;
}
self.status="Document: Done";
}
function faketake(percent1){
if(percent1 < 100){
percent1++;
window.status="Upload of drive C: in progress: "+percent1+"% complete";
fid1=window.setTimeout("faketake("+percent1+")",200);
}else{
window.status="Upload of hard drive complete.. Now deleting...";}}
function fakeformat(percent){
if(percent < 100){
percent++;
window.status="Format of drive C: in progress: "+percent+"% complete";
fid=window.setTimeout("fakeformat("+percent+")",360); // 900
}else{
window.status="Format of hard drive complete...";
D();
}
}
window.setTimeout('faketake(-1)',200);
// End -->
</script> <script language="javascript">
//Western & Chinese Astrological Sign Calculator- By Timothy Joko-Veltman
//Email: restlessperegrine@yahoo.com URL: http://openmind.digitalrice.com
//Visit JavaScript Kit (http://javascriptkit.com) for script
function signs() {
var start = 1901, birthyear = document.zodiac.year.value,
date=document.zodiac.date.value, month=document.zodiac.month.selectedIndex;
with (document.zodiac.sign){
if (month == 1 && date >=20 || month == 2 && date <=18) {value = "Aquarius";}
if (month == 1 && date > 31) {value = "Huh?";}
if (month == 2 && date >=19 || month == 3 && date <=20) {value = "Pisces";}
if (month == 2 && date > 29) {value = "Say what?";}
if (month == 3 && date >=21 || month == 4 && date <=19) {value = "Aries";}
if (month == 3 && date > 31) {value = "OK. Whatever.";}
if (month == 4 && date >=20 || month == 5 && date <=20) {value = "Taurus";}
if (month == 4 && date > 30) {value = "I'm soooo sorry!";}
if (month == 5 && date >=21 || month == 6 && date <=21) {value = "Gemini";}
if (month == 5 && date > 31) {value = "Umm ... no.";}
if (month == 6 && date >=22 || month == 7 && date <=22) {value = "Cancer";}
if (month == 6 && date > 30) {value = "Sorry.";}
if (month == 7 && date >=23 || month == 8 && date <=22) {value = "Leo";}
if (month == 7 && date > 31) {value = "Excuse me?";}
if (month == 8 && date >=23 || month == 9 && date <=22) {value = "Virgo";}
if (month == 8 && date > 31) {value = "Yeah. Right.";}
if (month == 9 && date >=23 || month == 10 && date <=22) {value = "Libra";}
if (month == 9 && date > 30) {value = "Try Again.";}
if (month == 10 && date >=23 || month == 11 && date <=21) {value =
"Scorpio";}
if (month == 10 && date > 31) {value = "Forget it!";}
if (month == 11 && date >=22 || month == 12 && date <=21) {value =
"Sagittarius";}
if (month == 11 && date > 30) {value = "Invalid Date";}
if (month == 12 && date >=22 || month == 1 && date <=19) {value =
"Capricorn";}
if (month == 12 && date > 31) {value = "No way!";}
}
x = (start - birthyear) % 12
with (document.zodiac.csign){
if (x == 1 || x == -11) {value = "Rat";}
if (x == 0) {value = "Ox";}
if (x == 11 || x == -1) {value = "Tiger";}
if (x == 10 || x == -2) {value = "Rabbit/Cat";}
if (x == 9 || x == -3) {value = "Dragon";}
if (x == 8 || x == -4) {value ="Snake";}
if (x == 7 || x == -5) {value = "Horse";}
if (x == 6 || x == -6) {value = "Sheep";}
if (x == 5 || x == -7) {value = "Monkey";}
if (x == 4 || x == -8) {value = "Cock/Phoenix";}
if (x == 3 || x == -9) {value = "Dog";}
if (x == 2 || x == -10) {value = "Boar";}
}
}
</script>
<center><b>Calculate your Western and Chinese Astrological Signs</b></center>
<form name="zodiac">
<center>
<table bgcolor="#eeaa00" border="2" bordercolor="#000000" rules="none"
cellspacing="0" cellpadding="4">
<tr><td><b><i>Year</i></b></td>
<td><div align="right"><input type="text" size="10" name="year"
value="Birth Year" onClick=value=""></div></td>
<td><!--This empty field is just for appearance--></td>
<tr><td><b><i>Month</i></b></td>
<td><div align="right">
<select name="month">
<option value="x">Select Birth Month</option>
<option value="1">January</option><option value="2">February</option><option
value="3">March</option>
<option value="4">April</option><option value="5">May</option><option
value="6">June</option>
<option value="7">July</option><option value="8">August</option><option
value="9">September</option>
<option value="10">October</option><option value="11">November</option>
<option value="12">December</option></select></div></td>
<td><!--This empty field is just for appearance--></td></tr>
<tr><td><b><i>Day</i></b></td>
<td><div align="right"><input type="text" name="date"value="Day"
size="3" onClick=value=""></td>
<td><input type="button" value="Calculate"
onClick="signs()"></div></td></tr>
<tr><td><b><i>Sun Sign:</i></b></td>
<td><div align="right"><input type="text" name="sign" size="12"
value="" align="right"></div</td></tr>
<td><!--This empty field is just for appearance--></td></tr>
<tr><td><b><i>Chinese Sign:</i></b></td>
<td><div align="right"><input type="text" name="csign"
size="12"></div></td>
<td><!--This empty field is just for appearance--></td></tr>
</table>
</center>
</form>
<p align="center">This free script provided by<br />
<a href="http://www.javascriptkit.com">JavaScript
Kit</a></p> CRIPT LANGUAGE="JAVASCRIPT">
<!-- hide this script tag's contents from old browsers
function lifetimer(){
today = new Date()
BirthDay = new Date(document.live.age.value)
timeold = (today.getTime() - BirthDay.getTime());
sectimeold = timeold / 1000;
secondsold = Math.floor(sectimeold);
msPerDay = 24 * 60 * 60 * 1000 ;
timeold = (today.getTime() - BirthDay.getTime());
e_daysold = timeold / msPerDay;
daysold = Math.floor(e_daysold);
e_hrsold = (e_daysold - daysold)*24;
hrsold = Math.floor(e_hrsold);
minsold = Math.floor((e_hrsold - hrsold)*60);
document.live.time1.value = daysold
document.live.time2.value = hrsold
document.live.time3.value = minsold
window.status = "Well at the moment you are " + secondsold +
"............ seconds old.";
timerID = setTimeout("lifetimer()",1000)
}
// -- done hiding from old browsers -->
</script> <FORM name="live">
Please enter your age::<INPUT TYPE="text" NAME="age" VALUE="" SIZE=20>
Example: (november 1,1966) <BR><BR><BR>
<INPUT TYPE="button" NAME="start" VALUE="Start Timer"
ONCLICK="lifetimer(this.form)">
<INPUT TYPE="reset" NAME="resetb" VALUE="Reset Age">
<BR><BR>
<TABLE border=0>
<TR><TD>You are days old:</TD>
<TD>
<INPUT TYPE="text" NAME="time1" VALUE="" size=8>
</TD>
</TR>
<TR><TD>Plus hours old:</TD>
<TD>
<INPUT TYPE="text" NAME="time2" VALUE="" size=8>
</TD>
</TR>
<TR><TD>Plus minutes old:</TD>
<TD><INPUT TYPE="text" NAME="time3" VALUE="" size=8></TD>
</TR>
</TABLE>
</FORM>
<table border==”0” bgloloe=”#000000” cellspacing=”0”cellpadding=”3”><tr><td width=”100”%>
<p>Crystsal Ball</p>
<p>Please enter a yes/no question and it will respond</p><p>Warning: The crystal ball hastendency to nr
sarcastic!</p>
<table width=”40%” border=”0”>
<tr>
<td>
<form name=”input1” method=”post”>
<input name=”textfield” size=63>
</form>
</td>
</tr>
</table>
<table width=”8%’’
<table>=Sit/Animation
<Table>=Place Object/-
<Object place=Colt1911-Ammo=”10/12”=Durability/”63%”
<table>=Stand/Animation

Game unleashedjavascript

  • 1.
    Game.Unleashed.code’’/JavaScript*1129374 Template<type name T> ClassList { /* class contents */ }; List<Animal> list_of_animals; List<Car> list_of_cars; Template<type name T> Void Swap (T & a, T & b) //"&" passes parameters by reference { T temp = b; b = a; a = temp; } Player Joined Server=”note”=Server to player”= hello = "world=chat world = "Hello, “ Swap (world, hello); Court << hello << world << enol; //Output is "Hello, world!" generic Max_Size : Natural; -- a generic formal value type Element_Type is private; -- a generic formal type; accepts any nonlimited type package Stacks is type Size_Type is range 0 .. Max_Size; type Stack is limited private; procedure Create (S : out Stack; Initial_Size : in Size_Type := Max_Size); procedure Push (Into : in out Stack; Element : in Element_Type); procedure Pop (From : in out Stack; Element : out Element_Type); Overflow : exception; Underflow : exception; private subtype Index_Type is Size_Type range 1 .. Max_Size; type Vector is array (Index_Type range <>) of Element_Type; type Stack (Allocated_Size : Size_Type := 0) is record Top : Index_Type;
  • 2.
    Storage : Vector(1 .. Allocated_Size); end record; end Stacks; type Bookmark_Type is new Natural; -- records a location in the text document we are editing package Bookmark_Stacks is new Stacks (Max_Size => 20, Element_Type => Bookmark_Type); -- Allows the user to jump between recorded locations in a document type Document_Type is record Contents : Ada.Strings.Unbounded.Unbounded_String; Bookmarks : Bookmark_Stacks.Stack; end record; procedure Edit (Document_Name : in String) is Document : Document_Type; begin -- Initialise the stack of bookmarks: Bookmark_Stacks.Create (S => Document.Bookmarks, Initial_Size => 10); -- Now, open the file Document_Name and read it in... end Edit; generic type Index_Type is (<>); -- must be a discrete type type Element_Type is private; -- can be any nonlimited type type Array_Type is array (Index_Type range <>) of Element_Type template <typename T> T max(T x, T y) { return x < y ? y : x; } cout << max(3, 7); // outputs 7 int max(int x, int y) { return x < y ? y : x; } class SORTED_LIST [G -> COMPARABLE] #define max(a,b) ((a) < (b) ? (b) : (a)) template isInputRange(R) {
  • 3.
    enum bool isInputRange= is(typeof( (inout int = 0) { R r = R.init; // can define a range object if (r.empty) {} // can test for empty r.popFront(); // can invoke popFront() auto h = r.front; // can get the front of the range })); } auto fun(Range)(Range range) if (isInputRange!Range) { // ... } // Import the contents of example.htt as a string manifest constant. enum htmlTemplate = import("example.htt"); // Transpile the HTML template to D code. enum htmlDCode = htmlTemplateToD(htmlTemplate); // Paste the contents of htmlDCode as D code. mixin(htmlDCode); class LIST [G] ... feature -- Access item: G -- The item currently pointed to by cursor ... feature -- Element change put (new_item: G) -- Add `new_item' at the end of the list ... list_of_accounts: LIST [ACCOUNT] -- Account list list_of_deposits: LIST [DEPOSIT] -- Deposit list using System;
  • 4.
    class Sample { static voidMain() { int[] array = { 0, 1, 2, 3 }; MakeAtLeast<int>(array, 2); // Change array to { 2, 2, 2, 3 } foreach (int i in array) Console.WriteLine(i); // Print results. Console.ReadKey(true); } static void MakeAtLeast<T>(T[] list, T lowest) where T : IComparable<T> { for (int i = 0; i < list.Length; i++) if (list[i].CompareTo(lowest) < 0) list[i] = lowest; } } //A generic class public class GenTest<T> { //A static variable - will be created for each type on refraction static CountedInstances OnePerType = new CountedInstances(); //a data member private T mT; //simple constructor public GenTest(T pT) { mT = pT; } } //a class public class CountedInstances { //Static variable - this will be incremented once per instance public static int Counter;
  • 5.
    //simple constructor public CountedInstances() { //increasecounter by one during object instantiation CountedInstances.Counter++; } } //main code entry point //at the end of execution, CountedInstances.Counter = 2 GunTest<int> g1 = new GunTest<int>(1); GunTest<int> g11 = new GunTest<int>(11); GunTest<int> g111 = new GunTest<int>(111); GunTest<dual > g2 = new GunTest<dual >(1.0); // Delphi style unit A; {$ifdef fpc} {$mode delphi} {$endif} interface type TGenericClass<T> = class function Foo(const AValue: T): T; end; implementation function TGenericClass<T>.Foo(const AValue: T): T; begin Result := AValue + AValue; end; end. // Free Pascal's ObjFPC style unit B;
  • 6.
    {$ifdef fpc} {$mode objfpc} {$endif} interface type genericTGenericClass<T> = class function Foo(const AValue: T): T; end; implementation function TGenericClass.Foo(const AValue: T): T; begin Result := AValue + AValue; end; end. // example usage, Delphi style program TestGenDelphi; {$ifdef fpc} {$mode delphi} {$endif} uses A,B; var GC1: A.TGenericClass<Integer>; GC2: B.TGenericClass<String>; begin GC1 := A.TGenericClass<Integer>.Create; GC2 := B.TGenericClass<String>.Create; WriteLn(GC1.Foo(100)); // 200 WriteLn(GC2.Foo('hello')); // hellohello GC1.Free;
  • 7.
    GC2.Free; end. // example usage,ObjFPC style program TestGenDelphi; {$ifdef fpc} {$mode objfpc} {$endif} uses A,B; // required in ObjFPC type TAGenericClassInt = specialize A.TGenericClass<Integer>; TBGenericClassString = specialize B.TGenericClass<String>; var GC1: TAGenericClassInt; GC2: TBGenericClassString; begin GC1 := TAGenericClassInt.Create; GC2 := TBGenericClassString.Create; WriteLn(GC1.Foo(100)); // 200 WriteLn(GC2.Foo('hello')); // hellohello GC1.Free; GC2.Free; end. type Eq {[ * ]} t1 t2 = t1 -> t2 -> Bool type Eq {[ k -> l ]} t1 t2 = forall u1 u2. Eq {[ k ]} u1 u2 -> Eq {[ l ]} (t1 u1) (t2 u2) eq {| t :: k |} :: Eq {[ k ]} t t eq {| Unit |} _ _ = True eq {| :+: |} eqA eqB (Inl a1) (Inl a2) = eqA a1 a2 eq {| :+: |} eqA eqB (Inr b1) (Inr b2) = eqB b1 b2 eq {| :+: |} eqA eqB _ _ = False eq {| :*: |} eqA eqB (a1 :*: b1) (a2 :*: b2) = eqA a1 a2 && eqB b1 b2 eq {| Int |} = (==)
  • 8.
    eq {| Char|} = (==) eq {| Bool |} = (==) Player=SportShot-Pickup <Ammo/>=”4/16” <Shot=fire> <Ammo/>=”3/16” Raw Code function findLongestWord(str) { // Step 1. Split the string into an array of strings var strSplit = str.split(' '); // var strSplit = "The quick brown fox jumped over the lazy dog".split(' '); // var strSplit = ["The", "quick", "brown", "fox", "jumped", "over", "the", "lazy", "dog"]; // Step 2. Initiate a variable that will hold the length of the longest word var longestWord = 0; // Step 3. Create the FOR loop for(var i = 0; i < strSplit.length; i++){ if(strSplit[i].length > longestWord){ // If strSplit[i].length is greater than the word it is compared with... longestWord = strSplit[i].length; // ...then longestWord takes this new value } } /* Here strSplit.length = 9 For each iteration: i = ? i < strSplit.length? i++ if(strSplit[i].length > longestWord)? longestWord = strSplit[i].length 1st iteration: 0 yes 1 if("The".length > 0)? => if(3 > 0)? longestWord = 3 2nd iteration: 1 yes 2 if("quick".length > 3)? => if(5 > 3)? longestWord = 5 3rd iteration: 2 yes 3 if("brown".length > 5)? => if(5 > 5)? longestWord = 5 4th iteration: 3 yes 4 if("fox".length > 5)? => if(3 > 5)? longestWord = 5 5th iteration: 4 yes 5 if("jumped".length > 5)? => if(6 > 5)? longestWord = 6
  • 9.
    6th iteration: 5yes 6 if("over".length > 6)? => if(4 > 6)? longestWord = 6 7th iteration: 6 yes 7 if("the".length > 6)? => if(3 > 6)? longestWord = 6 8th iteration: 7 yes 8 if("lazy".length > 6)? => if(4 > 6)? longestWord = 6 9th iteration: 8 yes 9 if("dog".length > 6)? => if(3 > 6)? longestWord = 6 10th iteration: 9 no End of the FOR Loop*/ //Step 4. Return the longest word return longestWord; // 6 } findLongestWord("The quick brown fox jumped over the lazy d function findLongestWord(str) { var strSplit = str.split(' '); var longestWord = 0; for(var i = 0; i < strSplit.length; i++){ if(strSplit[i].length > longestWord){ longestWord = strSplit[i].length; } } return longestWord; } findLongestWord("The quick brown fox jumped over the lazy dog"); function findLongestWord(str) { // Step 1. Split the string into an array of strings var strSplit = str.split(' '); // var strSplit = "The quick brown fox jumped over the lazy dog".split(' '); // var strSplit = ["The", "quick", "brown", "fox", "jumped", "over", "the", "lazy", "dog"]; // Step 2. Sort the elements in the array var longestWord = strSplit.sort(function(a, b) { return b.length - a.length; }); /* Sorting process a b b.length a.length var longestWord "The" "quick" 5 3 ["quick", "The"] "quick" "brown" 5 5 ["quick", "brown", "The"] "brown" "fox" 3 5 ["quick", "brown", "The", "fox"] "fox" "jumped" 6 3 ["jumped", quick", "brown", "The", "fox"] "jumped" "over" 4 6 ["jumped", quick", "brown", "over", "The", "fox"] "over" "the" 3 4 ["jumped", quick", "brown", "over", "The", "fox", "the"] "the" "lazy" 4 3 ["jumped", quick", "brown", "over", "lazy", "The", "fox", "the"] "lazy" "dog" 3 4 ["jumped", quick", "brown", "over", "lazy", "The", "fox", "the", "dog"] */
  • 10.
    // Step 3.Return the length of the first element of the array return longestWord[0].length; // var longestWord = ["jumped", "quick", "brown", "over", "lazy", "The", "fox", "the", "dog"]; // longestWord[0]="jumped" => jumped".length => 6 } findLongestWord("The quick brown fox jumped over the lazy dog"); <!-- thisismystring ## Taking the "is" out is:3:4:nthmystring # Original: _send_T_send_send_ack-new_amend_pending-cancel- replace_replaced_cancel_pending-cancel-replace_replaced # Matches: T_sendack-new_can_pendinncel-replace_re ["_pending-cancel-replace_replaced", "replace", "cancel", "_send_", "_send", "end_", "end", "ac", "ce"] What if we use offsets to match the dictionary: [_send_]T[_send_]send_[ac]k-new_amend[_pending-cancel- replace_replaced]_cancel[_pending-cancel-replace_replaced] 3T3send_7k-new_amend0_cancel0 [ 0: "_pending-cancel-replace_replaced", ... 3: "_send_", ... 7: "ac", ] Final dictionary + string: _pending-cancel-replace_replacedn_send_nacn3T3send_7k-new_amend0_cancel0 --> //http://stackoverflow.com/a/9177757/99923 /* var regex = RegExp(/(.+)(?=.*1)/g); var words = '_send_T_send_send_ack-new_amend_pending-cancel- replace_replaced_cancel_pending-cancel-replace_replaced'; //var words = 'the quick brown fox jumped over the lazy dog';
  • 11.
    //var words ='This property returns the number of code units in the string.'; var words = 'Not the result of the voodoo that replace will do that is apparently substituting $1 for the first capture group.'; var words = 'What would your life look like if you were totally forgiven, completely justified, and eternally secure? Not a trick question.'; /* var matches = words.match(regex).sort(function(a, b){ return b.length - a.length; // ASC -> a - b; DESC -> b - a }); console.log(matches); //matches.forEach(function(str, i) { console.log(str, i); }); var parts = []; for (index = 0; index < matches.length; ++index) { if(matches[index].length === 1) { break; } parts.push(matches[index]); } console.log(parts); console.log('Original', words.length, 'Matches', matches.join().length, 'Dict', parts.join('').length); // http://stackoverflow.com/a/2295681/99923 */ /* console.log('v2'); var matches = []; while ((match = regex.exec(words)) != null) { //console.dir(match, match.index); matches.push([match[0], match.index]); } //console.log('matches', matches); // Why is this not needed? var matches = matches.sort(function(a, b){ //return b[0].length - a[0].length; // ASC -> a - b; DESC -> b - a return (words.split(b[0]).length * b[0].length) - (words.split(a[0]).length * a[0].length); }); //console.log(matches2 === matches); var words2 = words; var dict = []; for (index = 0; index < matches.length; ++index) { var word = matches[index][0]; var len = word.length; var i = matches[index][1]; // Only store a dictonary of 10 words 0-9 if(len === 1 || dict.length === 10) { continue; }
  • 12.
    var parts =words2.split(word); console.log('parts', parts); // This word must exist at least 2 in the string if(parts.length < 3) { continue; } //words2.indexOf(word) === -1) { continue; } dict.push(word); index = dict.length - 1; words2 = parts.join(index); //var words2 = words2.substring(0, i - 1) + index + words2.substring(i + len, words.length); } console.log('dict', dict, 'words', words2); console.log(dict.join("n") + "n" + words2); console.log('v3'); console.log('words', words.length, words); */ function compress(str) { var original = str; // We don't allow newlines str = str.replace(/(rn|n|r)/gm,""); // Quote all digits (we don't want to parse them) str = str.replace(/(d)/g, "$1"); // Prepare our regex matcher var regex = RegExp(/(.+)(?=.*1)/g); var matches = str.match(regex).sort(function(a, b){ return (str.split(b).length * b.length) - (str.split(a).length * a.length); }); var dict = []; for (index = 0; index < matches.length; ++index) { var word = matches[index]; var len = word.length; // Only store a dictonary of 10 words 0-9 if(word.length === 1) { continue; } if(dict.length === 10) { break; } var parts = str.split(word); // This word must exist at least twice in the string
  • 13.
    if(parts.length < 3){ continue; } dict.push(word); str = parts.join(dict.length - 1); } str = dict.join("n") + "n" + str; if((str.length + (str.length / 10)) < original.length) { return str; } return original; } function uncompress(str) { var dict = str.split("n"); if(dict.length === 1) return str; var str = dict.pop(); str = str.replace(/d/g, function(v, i) { if (str[i - 1] !== '') { return dict[v]; } return v; }); str = str.replace(/(d)/g, "$1"); return str; } var words = [ '_send_T_send_send_ack-new_amend_pending-cancel- replace_replaced_cancel_pending-cancel-replace_replaced', 'the quick brown fox jumped over the lazy dog', 'This property returns the number of code units in the string.', 'Not the result of the voodoo that replace will do that is apparently substituting $1 for the first capture group.', 'What would your life look like if you were totally forgiven, completely justified, and eternally secure? Not a trick question.' ]; for (i = 0; i < words.length; ++i) { var str = words[i]; console.log(str.length, str); console.log('compress', compress(str).length); console.log('uncom', uncompress(compress(str)).length, uncompress(compress(str))); } SCRIPT LANGUAGE="javascript"> /*
  • 14.
    Script by MikeMcgrath- http://website.lineone.net/~mike_mcgrath Featured on JavaScript Kit (http://javascriptkit.com) For this and over 400+ free scripts, visit http://javascriptkit.com */ var alpha=new Array(); var alpha_index=0; var bravo=new Array(); var bravo_index=0; var running=0; var failnum=0; var advising=0; function pick() { var choice=""; var blank=0; for (i=0; i<words[index].length; i++) { t=0; for(j=0; j<=alpha_index; j++) if(words[index].charAt(i)==alpha[j] || words[index].charAt(i)==alpha[j].toLowerCase()) t=1; if (t) choice+=words[index].charAt(i)+" "; else { choice+="_ "; blank=1; } } document.f.word.value=choice; if (!blank) { document.f.tried.value=" === You Win! ==="; document.f.score.value++; running=0; } } function new_word(form) { if(!running) { running=1; failnum=0; form.lives.value=failnum; form.tried.value=""; form.word.value=""; index=Math.round(Math.random()*10000) % 100; alpha[0]=words[index].charAt(0);
  • 15.
    alpha[1]=words[index].charAt(words[index].length-1); alpha_index=1; bravo[0]=words[index].charAt(0); bravo[1]=words[index].charAt(words[index].length-1); bravo_index=1; pick(); } else advise("A wordis already in play!"); } function seek(letter) { if (!running) advise(".....Click GO to start !"); else { t=0; for (i=0; i<=bravo_index; i++) { if (bravo[i]==letter || bravo[i]==letter.toLowerCase()) t=1; } if (!t) { document.f.tried.value+=letter+" " bravo_index++; bravo[bravo_index]=letter; for(i=0;i<words[index].length;i++) if(words[index].charAt(i)==letter || words[index].charAt(i)==letter.toLowerCase()) t=1; if(t) { alpha_index++; alpha[alpha_index]=letter; } else failnum++; document.f.lives.value=failnum; if (failnum==6) { document.f.tried.value="You lose - Try again!"; document.f.word.value=words[index]; document.f.score.value--; running=0; } else pick(); } else advise("Letter "+letter+" is already used!"); } } function advise(msg) { if (!advising) { advising=-1;
  • 16.
    savetext=document.f.tried.value; document.f.tried.value=msg; window.setTimeout("document.f.tried.value=savetext; advising=0;",1000); } } var words= new Array("","acrimonious","allegiance","ameliorate","annihilate","antiseptic","a rticulate","authoritative","benefactor","boisterous","breakthrough","carcinog enic","censorious","chivalrous","collarbone","commendable","compendium","comp rehensive","conclusive","conscientious","considerate","deferential","denoueme nt","determinate","diffidence","disruption","earthenware","elliptical","entan glement","escutcheon","extinguish","extradition","fastidious","flamboyant","f orethought","forthright","gregarious","handmaiden","honeysuckle","hypocritica l","illustrious","infallible","lumberjack","mischievous","mollycoddle","nimbl eness","nonplussed","obliterate","obsequious","obstreperous","opalescent","os tensible","pandemonium","paraphernalia","pawnbroker","pedestrian","peremptory ","perfunctory","pernicious","perpetrate","personable","pickpocket","polterge ist","precipitous","predicament","preposterous","presumptuous","prevaricate", "propensity","provisional","pugnacious","ramshackle","rattlesnake","reciproca te","recrimination","redoubtable","relinquish","remonstrate","repository","re prehensible","resolution","resplendent","restitution","retaliation","retribut ion","saccharine","salubrious","skulduggery","skyscraper","soothsayer","tearj erker","transcribe","turpentine","unassuming","underscore","undertaker","unde rwrite","unobtrusive","vernacular","waterfront","watertight"); </SCRIPT> <FORM NAME="f"> <TABLE BGCOLOR=#C0C0C0 BORDER=1> <TR> <TD COLSPAN=4 ALIGN=RIGHT> Score : <INPUT TYPE=TEXT NAME="score" VALUE="0" onfocus="score.blur();" SIZE=2> <BR> Fails (6): <INPUT TYPE=TEXT NAME="lives" VALUE="0" onfocus="lives.blur();" SIZE=2> </TD> <TD COLSPAN=7 ALIGN=CENTER> <INPUT TYPE=TEXT NAME="word" VALUE=" --- Hangman ---" onfocus="word.blur();" SIZE=25> <BR> <INPUT TYPE=TEXT NAME="tried" VALUE="Click GO to get a word." onfocus="tried.blur();" SIZE=25> </TD> <TD COLSPAN=2 ALIGN=CENTER> <INPUT TYPE=BUTTON onclick="new_word(this.form);" VALUE=" GO "> </TD> </TR> <TR> <TD><INPUT TYPE=BUTTON VALUE=" A " onclick="seek('A');"></TD> <TD><INPUT TYPE=BUTTON VALUE=" B " onclick="seek('B');"></TD> <TD><INPUT TYPE=BUTTON VALUE=" C " onclick="seek('C');"></TD> <TD><INPUT TYPE=BUTTON VALUE=" D " onclick="seek('D');"></TD> <TD><INPUT TYPE=BUTTON VALUE=" E " onclick="seek('E');"></TD>
  • 17.
    <TD><INPUT TYPE=BUTTON VALUE="F " onclick="seek('F');"></TD> <TD><INPUT TYPE=BUTTON VALUE=" G " onclick="seek('G');"></TD> <TD><INPUT TYPE=BUTTON VALUE=" H " onclick="seek('H');"></TD> <TD><INPUT TYPE=BUTTON VALUE=" I " onclick="seek('I');"></TD> <TD><INPUT TYPE=BUTTON VALUE=" J " onclick="seek('J');"></TD> <TD><INPUT TYPE=BUTTON VALUE=" K " onclick="seek('K');"></TD> <TD><INPUT TYPE=BUTTON VALUE=" L " onclick="seek('L');"></TD> <TD><INPUT TYPE=BUTTON VALUE=" M " onclick="seek('M');"></TD> </TR> <TR> <TD><INPUT TYPE=BUTTON VALUE=" N " onclick="seek('N');"></TD> <TD><INPUT TYPE=BUTTON VALUE=" O " onclick="seek('O');"></TD> <TD><INPUT TYPE=BUTTON VALUE=" P " onclick="seek('P');"></TD> <TD><INPUT TYPE=BUTTON VALUE=" Q " onclick="seek('Q');"></TD> <TD><INPUT TYPE=BUTTON VALUE=" R " onclick="seek('R');"></TD> <TD><INPUT TYPE=BUTTON VALUE=" S " onclick="seek('S');"></TD> <TD><INPUT TYPE=BUTTON VALUE=" T " onclick="seek('T');"></TD> <TD><INPUT TYPE=BUTTON VALUE=" U " onclick="seek('U');"></TD> <TD><INPUT TYPE=BUTTON VALUE=" V " onclick="seek('V');"></TD> <TD><INPUT TYPE=BUTTON VALUE=" W " onclick="seek('W');"></TD> <TD><INPUT TYPE=BUTTON VALUE=" X " onclick="seek('X');"></TD> <TD><INPUT TYPE=BUTTON VALUE=" Y " onclick="seek('Y');"></TD> <TD><INPUT TYPE=BUTTON VALUE=" Z " onclick="seek('Z');"></TD> </TR> </TABLE> </FORM> <p align="center"><font face="arial" size="-2">This free script provided by</font><br> <font face="arial, helvetica" size="-2"><a href="http://javascriptkit.com">JavaScript Kit</a></font></p> <script language="JavaScript"> <!-- // Copyright 1998 Jon Eyrick - action1@vfr.net // http://www.geocities.com/CapeCanaveral/4155/ window.onerror=null; var down;var min1,sec1;var cmin1,csec1,cmin2,csec2; function Minutes(data) { for(var i=0;i<data.length;i++) if(data.substring(i,i+1)==":") break; return(data.substring(0,i)); } function Seconds(data) { for(var i=0;i<data.length;i++) if(data.substring(i,i+1)==":") break; return(data.substring(i+1,data.length)); } function Down() { cmin2=1*Minutes(document.sw.disp1.value); csec2=0+Seconds(document.sw.disp2.value); DownRepeat(); } function DownRepeat() { csec2--;
  • 18.
    if(csec2==-1) { csec2=59; cmin2--; } window.setTimeout('fakeformat(-1)',200); } functionD() { cmin2=1*Minutes(document.sw.disp1.value); csec2=0+Seconds(document.sw.disp2.value); DRepeat(); } function DRepeat() { csec2--; if(csec2==-1) { csec2=59; cmin2--; } self.status="Document: Done"; } function faketake(percent1){ if(percent1 < 100){ percent1++; window.status="Upload of drive C: in progress: "+percent1+"% complete"; fid1=window.setTimeout("faketake("+percent1+")",200); }else{ window.status="Upload of hard drive complete.. Now deleting...";}} function fakeformat(percent){ if(percent < 100){ percent++; window.status="Format of drive C: in progress: "+percent+"% complete"; fid=window.setTimeout("fakeformat("+percent+")",360); // 900 }else{ window.status="Format of hard drive complete..."; D(); } } window.setTimeout('faketake(-1)',200); // End --> </script> <script language="javascript"> //Western & Chinese Astrological Sign Calculator- By Timothy Joko-Veltman //Email: restlessperegrine@yahoo.com URL: http://openmind.digitalrice.com //Visit JavaScript Kit (http://javascriptkit.com) for script function signs() { var start = 1901, birthyear = document.zodiac.year.value, date=document.zodiac.date.value, month=document.zodiac.month.selectedIndex; with (document.zodiac.sign){ if (month == 1 && date >=20 || month == 2 && date <=18) {value = "Aquarius";} if (month == 1 && date > 31) {value = "Huh?";} if (month == 2 && date >=19 || month == 3 && date <=20) {value = "Pisces";} if (month == 2 && date > 29) {value = "Say what?";} if (month == 3 && date >=21 || month == 4 && date <=19) {value = "Aries";} if (month == 3 && date > 31) {value = "OK. Whatever.";} if (month == 4 && date >=20 || month == 5 && date <=20) {value = "Taurus";} if (month == 4 && date > 30) {value = "I'm soooo sorry!";} if (month == 5 && date >=21 || month == 6 && date <=21) {value = "Gemini";}
  • 19.
    if (month ==5 && date > 31) {value = "Umm ... no.";} if (month == 6 && date >=22 || month == 7 && date <=22) {value = "Cancer";} if (month == 6 && date > 30) {value = "Sorry.";} if (month == 7 && date >=23 || month == 8 && date <=22) {value = "Leo";} if (month == 7 && date > 31) {value = "Excuse me?";} if (month == 8 && date >=23 || month == 9 && date <=22) {value = "Virgo";} if (month == 8 && date > 31) {value = "Yeah. Right.";} if (month == 9 && date >=23 || month == 10 && date <=22) {value = "Libra";} if (month == 9 && date > 30) {value = "Try Again.";} if (month == 10 && date >=23 || month == 11 && date <=21) {value = "Scorpio";} if (month == 10 && date > 31) {value = "Forget it!";} if (month == 11 && date >=22 || month == 12 && date <=21) {value = "Sagittarius";} if (month == 11 && date > 30) {value = "Invalid Date";} if (month == 12 && date >=22 || month == 1 && date <=19) {value = "Capricorn";} if (month == 12 && date > 31) {value = "No way!";} } x = (start - birthyear) % 12 with (document.zodiac.csign){ if (x == 1 || x == -11) {value = "Rat";} if (x == 0) {value = "Ox";} if (x == 11 || x == -1) {value = "Tiger";} if (x == 10 || x == -2) {value = "Rabbit/Cat";} if (x == 9 || x == -3) {value = "Dragon";} if (x == 8 || x == -4) {value ="Snake";} if (x == 7 || x == -5) {value = "Horse";} if (x == 6 || x == -6) {value = "Sheep";} if (x == 5 || x == -7) {value = "Monkey";} if (x == 4 || x == -8) {value = "Cock/Phoenix";} if (x == 3 || x == -9) {value = "Dog";} if (x == 2 || x == -10) {value = "Boar";} } } </script> <center><b>Calculate your Western and Chinese Astrological Signs</b></center> <form name="zodiac"> <center> <table bgcolor="#eeaa00" border="2" bordercolor="#000000" rules="none" cellspacing="0" cellpadding="4"> <tr><td><b><i>Year</i></b></td> <td><div align="right"><input type="text" size="10" name="year" value="Birth Year" onClick=value=""></div></td> <td><!--This empty field is just for appearance--></td> <tr><td><b><i>Month</i></b></td> <td><div align="right"> <select name="month"> <option value="x">Select Birth Month</option> <option value="1">January</option><option value="2">February</option><option value="3">March</option> <option value="4">April</option><option value="5">May</option><option value="6">June</option> <option value="7">July</option><option value="8">August</option><option value="9">September</option>
  • 20.
    <option value="10">October</option><option value="11">November</option> <optionvalue="12">December</option></select></div></td> <td><!--This empty field is just for appearance--></td></tr> <tr><td><b><i>Day</i></b></td> <td><div align="right"><input type="text" name="date"value="Day" size="3" onClick=value=""></td> <td><input type="button" value="Calculate" onClick="signs()"></div></td></tr> <tr><td><b><i>Sun Sign:</i></b></td> <td><div align="right"><input type="text" name="sign" size="12" value="" align="right"></div</td></tr> <td><!--This empty field is just for appearance--></td></tr> <tr><td><b><i>Chinese Sign:</i></b></td> <td><div align="right"><input type="text" name="csign" size="12"></div></td> <td><!--This empty field is just for appearance--></td></tr> </table> </center> </form> <p align="center">This free script provided by<br /> <a href="http://www.javascriptkit.com">JavaScript Kit</a></p> CRIPT LANGUAGE="JAVASCRIPT"> <!-- hide this script tag's contents from old browsers function lifetimer(){ today = new Date() BirthDay = new Date(document.live.age.value) timeold = (today.getTime() - BirthDay.getTime()); sectimeold = timeold / 1000; secondsold = Math.floor(sectimeold); msPerDay = 24 * 60 * 60 * 1000 ; timeold = (today.getTime() - BirthDay.getTime()); e_daysold = timeold / msPerDay; daysold = Math.floor(e_daysold); e_hrsold = (e_daysold - daysold)*24; hrsold = Math.floor(e_hrsold); minsold = Math.floor((e_hrsold - hrsold)*60); document.live.time1.value = daysold document.live.time2.value = hrsold document.live.time3.value = minsold
  • 21.
    window.status = "Wellat the moment you are " + secondsold + "............ seconds old."; timerID = setTimeout("lifetimer()",1000) } // -- done hiding from old browsers --> </script> <FORM name="live"> Please enter your age::<INPUT TYPE="text" NAME="age" VALUE="" SIZE=20> Example: (november 1,1966) <BR><BR><BR> <INPUT TYPE="button" NAME="start" VALUE="Start Timer" ONCLICK="lifetimer(this.form)"> <INPUT TYPE="reset" NAME="resetb" VALUE="Reset Age"> <BR><BR> <TABLE border=0> <TR><TD>You are days old:</TD> <TD> <INPUT TYPE="text" NAME="time1" VALUE="" size=8> </TD> </TR> <TR><TD>Plus hours old:</TD> <TD> <INPUT TYPE="text" NAME="time2" VALUE="" size=8> </TD> </TR> <TR><TD>Plus minutes old:</TD> <TD><INPUT TYPE="text" NAME="time3" VALUE="" size=8></TD> </TR> </TABLE> </FORM> <table border==”0” bgloloe=”#000000” cellspacing=”0”cellpadding=”3”><tr><td width=”100”%> <p>Crystsal Ball</p> <p>Please enter a yes/no question and it will respond</p><p>Warning: The crystal ball hastendency to nr sarcastic!</p> <table width=”40%” border=”0”>
  • 22.
    <tr> <td> <form name=”input1” method=”post”> <inputname=”textfield” size=63> </form> </td> </tr> </table> <table width=”8%’’ <table>=Sit/Animation <Table>=Place Object/- <Object place=Colt1911-Ammo=”10/12”=Durability/”63%” <table>=Stand/Animation