连连看API版本的源代码[5]

[入库:2006年2月23日] [更新:2007年3月24日]

本文简介:

void Linker_Matrix::get_point(point &p1,point &p2)
{
 //if( auto_search() )
 //{
  p1=this->p1;
  p2=this->p2;
  //return true;
 //}
 
 //return false;
}

void Linker_Matrix::reShuffle()
{
 int m,n,k;
 time_t curtime; //记录当前时间

 //p1.x = p1.y = 0;
 //p2.x = p2.y = 0;
 //index = 0;

 time(&curtime);//取得当前时间
 srand(curtime);//用当前时间作种子,产生随机数

 //for( int k=0; k<4; k++ )
 // way[k].x = way[k].y = 0;

 for( int i=1; i<=(M-2); i++ )
 for( int j=1; j<=(N-2); j++ )
 {
  if(matrix[i][j]!=0)
  {
   do
   {
    m = rand()%(M-2) + 1;
    n = rand()%(N-2) + 1;
   }
   while( 0==matrix[m][n] );

   k=matrix[i][j];
   matrix[i][j]=matrix[m][n];
   matrix[m][n]=k;
  }
 }
}

linker.cpp

#include<stdlib.h>
#include<stdio.h>
#include<string.h>
#include <windows.h>

#include "head.h"
#include "resource.h"

TCHAR szAppName[] = TEXT ("Linker") ;//程序名称
const int xsize=610,ysize=520;
const int TimerID=1;


LRESULT CALLBACK WndProc ( HWND, UINT, WPARAM, LPARAM ) ;

int WINAPI WinMain ( HINSTANCE hInstance, HINSTANCE hPrevInstance,
                    PSTR szCmdLine, int iCmdShow )
{
 HWND         hwnd ;
 MSG          msg ;
 WNDCLASS     wndclass ;
 HACCEL hAccel ;//快捷键表


 wndclass.style         = CS_HREDRAW | CS_VREDRAW ;
 wndclass.lpfnWndProc   = WndProc ;
 wndclass.cbClsExtra    = 0 ;
 wndclass.cbWndExtra    = 0 ;
 wndclass.hInstance     = hInstance ;
 wndclass.hIcon         = LoadIcon (hInstance, MAKEINTRESOURCE (IDI_ICON)) ;
 wndclass.hCursor       = LoadCursor (NULL, IDC_ARROW) ;
 wndclass.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH) ;
 wndclass.lpszMenuName  = szAppName ;
 wndclass.lpszClassName = szAppName ;

本文关键:连连看API版本的源代码
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top