Copy php content to clipboard PHP code:
$winmain =wb_create_window (Null,appwindow, ' 21-point game ', wbc_center,wbc_center,800,495,0,0);
Wb_create_control ($winmain, Label, ' banker ', 20,15,40,30,lb_1,0,0,0);
Wb_create_control ($winmain, Label, ' Player ', 20,200,40,30,lb_2,00,0,0);
Wb_create_control ($winmain, Frame, ', 80,40,120,150,fr_pc_1,0,0,0);
Wb_create_control ($winmain, Frame, ', 220,40,120,150,fr_pc_2,0,0,0);
Wb_create_control ($winmain, Frame, ', 360,40,120,150,fr_pc_3,0,0,0);
Wb_create_control ($winmain, Frame, ', 500,40,120,150,fr_pc_4,0,0,0);
Wb_create_control ($winmain, Frame, ', 640,40,120,150,fr_pc_5,0,0,0);
Wb_create_control ($winmain, Frame, ', 645,230,120,150,fr_u_5,0,0,0);
Wb_create_control ($winmain, Frame, ', 500,230,120,150,fr_u_4,0,0,0);
Wb_create_control ($winmain, Frame, ', 360,230,120,150,fr_u_3,0,0,0);
Wb_create_control ($winmain, Frame, ', 220,230,120,150,fr_u_2,0,0,0);
Wb_create_control ($winmain, Frame, ', 80,230,120,150,fr_u_1,0,0,0);
Wb_create_control ($winmain, Label, ', 35,305,25,20,lb_u_t,0,0,0);
Wb_create_control ($winmain, Label, ', 35,110,25,20,lb_p_t,0,0,0);
Wb_create_control ($winmain, pushbutton, ' Licensing ', 320,400,70,25,b_go,0x00000002,0,0);
Wb_create_control ($winmain, pushbutton, ' Stop ', 435,400,70,25,b_change,0x00000002,0,0);
Wb_create_control ($winmain, Label, ', 110,95,60,60,lb_pc_1,0x00000800,0,0);
Wb_create_control ($winmain, Label, ', 250,95,60,60,lb_pc_2,0x00000800,0,0);
Wb_create_control ($winmain, Label, ', 390,95,60,60,lb_pc_3,0x00000800,0,0);
Wb_create_control ($winmain, Label, ', 530,95,60,60,lb_pc_4,0x00000800,0,0);
Wb_create_control ($winmain, Label, ', 670,95,60,60,lb_pc_5,0x00000800,0,0);
Wb_create_control ($winmain, Label, ', 110,285,60,60,lb_u_1,0x00000800,0,0);
Wb_create_control ($winmain, Label, ', 250,285,60,60,lb_u_2,0x00000800,0,0);
Wb_create_control ($winmain, Label, ', 390,285,60,60,lb_u_3,0x00000800,0,0);
Wb_create_control ($winmain, Label, ', 530,285,60,60,lb_u_4,0x00000800,0,0);
Wb_create_control ($winmain, Label, ', 670,285,60,60,lb_u_5,0x00000800,0,0);
Wb_create_control ($winmain, Label, ', 70,20,90,20,pc_mon,0,0,0);
Wb_create_control ($winmain, Label, ', 70,205,90,20,u_mon,0,0,0);
point_include.php file
for ($i =1; $i <=13; $i + +) {
Switch ($i) {
Case 1j=1; $key = ' A ';
Case 11j=10; $key = ' J ';
Case 12j=10; $key = ' Q ';
Case 13j=10; $key = ' K ';
Default
$key = $j = $i;
}
$card ["Black \ Peach \n$key"]= $j;
$card ["Red \ Peach \n$key"]= $j;
$card ["Mei \ \ \n$key"]= $j;
$card ["square \ \ \ \ \n$key"]= $j;
}
$contorl _id=array (
' B_go ' =>1001, ' B_change ' =>1002,
' Me_start ' =>2001, ' Me_remon ' =>2002, ' Me_author ' =>2003, ' me_quit ' =>idclose,
' Lb_1 ' =>3001, ' lb_2 ' =>3002, ' lb_u_t ' =>3003, ' lb_p_t ' =>3004,
' Pc_mon ' =>3005, ' U_mon ' =>3006,
' Lb_pc_1 ' =>3101, ' lb_pc_2 ' =>3102, ' lb_pc_3 ' =>3103, ' lb_pc_4 ' =>3104, ' lb_pc_5 ' =>3105,
' Lb_u_1 ' =>3201, ' lb_u_2 ' =>3202, ' lb_u_3 ' =>3203, ' lb_u_4 ' =>3204, ' lb_u_5 ' =>3205,
' Fr_pc_1 ' =>4001, ' fr_pc_2 ' =>4002, ' fr_pc_3 ' =>4003, ' fr_pc_4 ' =>4004, ' fr_pc_5 ' =>4005,
' Fr_u_1 ' =>5001, ' fr_u_2 ' =>5002, ' fr_u_3 ' =>5003, ' fr_u_4 ' =>5004, ' fr_u_5 ' =>5005,
);
foreach ($contorl _id as $key = + $value) {
if (!defined (Strtoupper ($key))) define (Strtoupper ($key), $value);
}
?>
21POINT.PHPW file
Set_time_limit (0);
Include_once (' include/winbinder.php ');
Include_once (' form/point_include.php ');
Include_once (' form/21point.form.php ');
Class Ponit {
Public $key _id;
Private $user _point=10000;
Private $pc _point=10000;
Private $card;
Private $player = ' user ';
Private $new _term=false;
Private $remon =false;
Public function __construct ($winmain, $card) {
$f =file_get_contents (' form/db.db ');
List ($this->user_point, $this->pc_point) =explode (' | ', $f);
$this->window= $winmain;
$this->card= $card;
$this->prepare ();
}
Private function prepare () {
Wb_set_image ($this->window, ' Form/hyper.ico ');
Wb_create_control ($this->window,menu,array (
' Game (&g) ', NULL,
Array (Me_start, "opening \tcrtl+n", "'," ', ' CTRL + N '),
Array (Me_remon, "re-scoring"),
Array (Me_author, "author"),
Null
Array (Me_quit, "Exit \tcrtl+q", "'," ', ' ctrl+q '),
Null
));
Wb_set_text (Wb_get_control ($this->window,u_mon), $this->user_point. ' min ');
Wb_set_text (Wb_get_control ($this->window,pc_mon), $this->pc_point. ' min ');
$font =wb_create_font ("Arial", and null, fta_bold);
Wb_set_font (Wb_get_control ($this->window,lb_1), $font);
Wb_set_font (Wb_get_control ($this->window,lb_2), $font);
$font =wb_create_font ("Arial", (Fta_bold), NULL, and/or);
for ($i =1; $i <=5; $i + +) {
Wb_set_font (Wb_get_control ($this->window, (3100+ $i)), $font);
Wb_set_font (Wb_get_control ($this->window, (3200+ $i)), $font);
}
}
Private Function Start () {
$this->player= ' user ';
$this->new_term=true;
$this->clear ();
$this->play ();
Wb_set_enabled (Wb_get_control ($this->window,b_go), true);
Wb_set_enabled (Wb_get_control ($this->window,b_change), true);
}
Private Function Stop () {
Wb_set_enabled (Wb_get_control ($this->window,b_go), false);
Wb_set_enabled (Wb_get_control ($this->window,b_change), false);
}
Private Function Change_player () {
$this->stop ();
$this->player= ' PC ';
$this->play ();
}
Private Function Total ($num =0, $win) {
Static $u _tem, $p _tem;
if (Empty ($u _tem) | | Empty ($p _tem) | | $this->remon==true) {
$u _tem= $this->user_point;
$p _tem= $this->pc_point;
$this->remon=false;
}
if (Strtoupper ($win) = = = ' U ') {
$u _tem+= $num;
$p _tem-= $num;
}else{
$u _tem-= $num;
$p _tem+= $num;
}
$this->user_point= $u _tem;
$this->pc_point= $p _tem;
Wb_set_text (Wb_get_control ($this->window,u_mon), $this->user_point. ' min ');
Wb_set_text (Wb_get_control ($this->window,pc_mon), $this->pc_point. ' min ');
$f =fopen (' form/db.db ', ' WB ');
Fwrite ($f, $this->user_point. "|". $this->pc_point);
Fclose ($f);
}
Private Function Remon () {
$this->remon=true;
$this->user_point=10000;
$this->pc_point=10000;
Wb_set_text (Wb_get_control ($this->window,u_mon), $this->user_point. ' min ');
Wb_set_text (Wb_get_control ($this->window,pc_mon), $this->pc_point. ' min ');
$f =fopen (' form/db.db ', ' WB ');
Fwrite ($f, $this->user_point. "|". $this->pc_point);
Fclose ($f);
}
Private Function Clear () {
Wb_set_text (Wb_get_control ($this->window,lb_u_t), ");
Wb_set_text (Wb_get_control ($this->window,lb_p_t), ");
for ($i =1; $i <=5; $i + +) {
Wb_set_text (Wb_get_control ($this->window, (4000+ $i)), ");
Wb_set_text (Wb_get_control ($this->window, (5000+ $i)), ");
Wb_set_text (Wb_get_control ($this->window, (3100+ $i)), ");
Wb_set_text (Wb_get_control ($this->window, (3200+ $i)), ");
}
}
Private Function Play () {
Static $card _tem=array (), $i =0, $j =0, $user _total=0, $pc _total=0;
if ($this->new_term==true) {
$card _tem= $this->card;
$this->new_term=false;
$user _total=0;
$PC _total=0;
$i =0; $j = 0;
}
if ($this->player== ' user ') {
$i + +;
$card _key=array_rand ($card _tem);
$card _value= $card _tem[$card _key];
$user _total+= $card _value;
Wb_set_text (Wb_get_control ($this->window,lb_u_t), $user _total. ' Point ');
Wb_set_text (Wb_get_control ($this->window, (5000+ $i)), $card _key);
Wb_set_text (Wb_get_control ($this->window, (3200+ $i)), $card _value);
if ($i >=5 && $user _total<=21) {
$this->total ("U");
$sel =wb_message_box ($this->window, "Congratulations, 5 sheets all small, the player wins!" \ nyou still want to play? ", ' Victory ', Wbc_yesno);
$sel ==1? $this->start (): $this->stop ();
}elseif ($user _total>21) {
$this->total (' P ');
$sel =wb_message_box ($this->window, "really unfortunate, more than 21 points, the dealer wins!" \ nyou still want to play? ", ' failure ', wbc_yesno);
$sel ==1? $this->start (): $this->stop ();
}
}else{
$j + +;
$card _key=array_rand ($card _tem);
$card _value= $card _tem[$card _key];
$pc _total+= $card _value;
Wb_set_text (Wb_get_control ($this->window,lb_p_t), $pc _total. ' Point ');
Wb_set_text (Wb_get_control ($this->window, (4000+ $j)), $card _key);
Wb_set_text (Wb_get_control ($this->window, (3100+ $j)), $card _value);
if ($j >=5 && $pc _total<=21) {
$this->total (' P ');
$sel =wb_message_box ($this->window, "The Banker 5 sheets all small, the banker wins!" \ nyou still want to play? ", ' failure ', wbc_yesno);
$sel ==1? $this->start (): $this->stop ();
}elseif ($pc _total>21) {
if ($pc _total-$card _value< $user _total) {
$this->total ("U");
$sel =wb_message_box ($this->window, "Congratulations, the dealer points more than 21 points, the player wins!" \ nyou still want to play? ", ' Victory ', Wbc_yesno);
$sel ==1? $this->start (): $this->stop ();
}else{
$pc _total= $pc _total-$card _value;
Wb_set_text (Wb_get_control ($this->window,lb_p_t), $pc _total. ' Point ');
Wb_set_text (Wb_get_control ($this->window, (4000+ $j)), ");
Wb_set_text (Wb_get_control ($this->window, (3100+ $j)), ");
if ($pc _total>= $user _total) {
$this->total (' P ');
$msg = ($pc _total== $user _total)? " Two points, the dealer wins! \ nyou still want to play? ":" The dealer points bigger than you, the crop wins! \ nyou still want to play? ";
$sel =wb_message_box ($this->window, $msg, ' failure ', wbc_yesno);
$sel ==1? $this->start (): $this->stop ();
}else{
$this->total ("U");
$sel =wb_message_box ($this->window, "Congratulations, the dealer points smaller than you, the player wins!" \ nyou still want to play? ", ' Victory ', Wbc_yesno);
$sel ==1? $this->start (): $this->stop ();
}
}
}else{
Usleep (800000);
$this->play ();
}
}
unset ($card _tem[$card _key]);
}
Private Function author () {
$inf = "Hello everyone, I am machine_ horse, \ n \ nthe this is my life's first desktop application, \ n \ nyou Do very rotten, we laughed at, hahaha ^_^." \n\n\n\n\t\t Author: machine_ Ma ";
$author _window=wb_create_window ($this->window,modaldialog, ' Introduction to the author ', Wbc_center, Wbc_center, he, 0 );
Wb_set_handler ($author _window, ' Author_handler ');
$image =wb_create_control ($author _window,frame, ' 123 ', 0,0,128,144,110,wbc_image);
Wb_create_control ($author _window,label, $inf, 140,20,200,150,120,wbc_image);
Wb_set_image ($image, ' form/author.bmp ', nocolor);
}
Public Function main () {
Switch ($this->key_id) {
Case Idclose:
Wb_destroy_window ($this->window); Break
Case Me_start:
$this->start (); Break
Case Me_author:
$this->author (); Break
Case B_GO:
$this->play (); Break
Case B_change:
$this->change_player (); Break
Case Me_remon:
$this->remon (); Break
}
}
}
$WBD =new ponit ($winmain, $card);
Wb_set_handler ($winmain, ' go_to ');
Wb_main_loop ();
function go_to ($window, $id) {
Global $WBD;
$WBD->key_id= $id;
return $WBD->main ();
}
function Author_handler ($this _window, $id) {
Switch ($id) {
Case Idclose:
Wb_destroy_window ($this _window);
}
}
?>
http://www.bkjia.com/PHPjc/631916.html www.bkjia.com true http://www.bkjia.com/PHPjc/631916.html techarticle copy php content to clipboard PHP code: PHP $winmain =wb_create_window (Null,appwindow, ' 21-point game ', wbc_center,wbc_center,800,495,0,0); Wb_create_control ($winmain, Label, ' banker ', 20,1 ...