Skip to content

Instantly share code, notes, and snippets.

@qex
qex / battle.js
Created July 3, 2015 22:27
单纵就是干
/* player defination ... */
var Players = {
Sunyanzi : { HP:100, ATT:20, DEF:5 },
ikaros : { HP:100, ATT:15, DEF:5 }
};
/* initialize battle field ... */
var queue = [];
/* decide fighting order ... */
<?php
function encrypt( $source, $key ) {
/* calculate padding ... */
$pad = 8 - ( strlen( $source ) % 8 );
/* encrypt using MCrypt ... */
return base64_encode( mcrypt_encrypt(
MCRYPT_DES ,$key, $source . str_repeat( chr( $pad ), $pad ),
MCRYPT_MODE_CBC, pack(