1. 《全景探秘游戲設計藝術》pdf下載在線閱讀全文,求百度網盤雲資源
《全景探秘游戲設計藝術》網路網盤pdf最新全集下載:
鏈接:https://pan..com/s/1FRv_QUv9JC46nBG4dbaWbw
2. 《游戲設計的236個技巧》pdf下載在線閱讀全文,求百度網盤雲資源
《游戲設計的236個技巧》網路網盤pdf最新全集下載:
鏈接: https://pan..com/s/1oSkqNXSnLWxDaQuh1OzZHg
3. 《游戲設計藝術第2版》pdf下載在線閱讀全文,求百度網盤雲資源
《游戲設計藝術第2版》網路網盤pdf最新全集下載:
鏈接:https://pan..com/s/1kjSILkBGAvSEEjZsSXO7Uw
4. 幫我推薦一本書,有關FLASH游戲製作的或c++游戲製作的書.謝謝!我是菜鳥啊!
Game Developer Magazine 1994 - 2000年,共7年的游戲開發者雜志電子版(含源碼)
Graphics Programming Black Book (by Michael Abrash).zip,圖形編程黑書,Id software的Michael Abrash編著
Game Programming Gems I.rar ,游戲編程精粹I、II(含源碼)
Game Programming Gems II.rar
Graphics Gems I.rar ,圖形學精粹I、II、III、IV、V
Graphics Gems II.rar
Graphics Gems III IBM.rar
Graphics Gems IV IBM.rar
Graphics Gems V.rar
Computer Graphics, C Version (2nd Ed.).rar ,計算機圖形學C版(第二版)
half_life2_engine.zip ,半條命2游戲引擎源代碼
D3DTutorial10_Half-Life2_Shading.pdf ,半條命2游戲引擎光照分析
Course.PTR.3D.Game.Engine.Programming.eBook-LinG.rar ,3D游戲引擎編程
3D Game Engine Design.rar ,3D游戲引擎設計
3D Game Engine Design source code.rar ,3D游戲引擎設計源代碼
3D.Game.Programming.All.In.One.zip ,3D游戲編程大全
Game Design - Theory and Practice.rar ,游戲設計 - 理論與實踐
game.programming.all.in.one.zip ,游戲編程大全
The Cg Tutorial - The Definitive Guide to Programmable Real-Time Graphics.rar ,CG指導 - 可編程實時圖形權威指南
Tricks Of The 3D Game Programming Gurus - Advanced 3D Graphics And Rasterization.rar ,3D游戲編程大師技巧 - 高級3D圖形和光柵化
Ultimate Game Design Building Game Worlds.rar ,終極游戲設計 - 創建游戲世界
Core.Techniques.And.Algorithms.In.Game.Programming.rar ,核心技術和演算法在游戲編程
Simulating Humans.rar ,模擬人類
3D Lighting - History, Concepts, and Techniques.rar ,3D光照 - 歷史,概念和技術
Lighting.Techniques.For.Real-Time.3D.Rendering.rar ,光照技術For實時3D渲染
Vector.Game.Math.Processors.zip ,向量游戲數學處理器
AI for Computer Games and Animation - A Cognitive Modeling Approach.rar ,AI(人工智慧)for計算機游戲和動畫 - 一個認知建模方案
AI.Game.Development.Synthetic.Creatures.With.Learning.And.Reactive.Behaviors.rar ,AI游戲開發 - 合成生物With學習和反應舉止
AI.Techniques.for.Game.Programming.rar ,AI技術for游戲編程(含源碼)
Ai.Game.Programming.Wisdom.rar ,AI游戲編程(代碼)
Real_Time_Rendering.rar ,實時渲染
special.effects.game.programming.rar ,特效(特殊效果)游戲編程(含源碼)
Shaders.for.Game.Programmers.and.Artists.zip ,著色器for游戲開發者和藝術家
Real-Time Shader Programming.rar ,實時著色器編程
Wordware.Publishing.Advanced.Lighting.and.Materials.With.Shaders.rar ,高級光照和材質with著色器
OReilly - Physics for Game Developers.rar ,物理for游戲開發者
GPU Programming Guide.rar ,GPU編程指南
Collision.Detection.pdf.rar ,碰撞檢測
Collision.Detection.-.Algorithms.and.Applications.rar ,碰撞檢測 - 演算法與應用
focus.on.3D.terrain.zip ,游戲3D地形編程
Focus.On.3D.Models.zip ,游戲3D模型編程
Focus.On.2D.in.Direct3D.-.fly.pdf ,集中於Direct3D中的2D
Beginning.Game.Audio.Programming.rar ,開始游戲音頻編程(含源碼)
Internetworked.3D.Computer.Graphics.rar ,互連網間的3D計算機圖形學
Beginning.Math.and.Physics.For.Game.Programmers.zip ,開始數學和物理for游戲編程者(PDF版)
Beginning Math and Physics for Game Programmers[CHM].rar ,開始數學和物理for游戲編程者(CHM版)
3D.Math.Primer.for.graphics.and.game.development.zip ,3D數學初步for圖形和游戲開發
The art of computer game design.rar ,計算機游戲設計藝術
Sams.Beginning.3D.Game.Programming.eBook-LiB.rar ,3D游戲編程入門
MIT.Press.Rules.of.Play.Game.Design.Fundamentals.rar ,游戲設計基礎
design a pc game engine.rar ,設計一個PC游戲引擎
Advanced Graphics Programming Techniques Using Opengl.rar ,高級圖形編程技術用OpenGL
Real-time.Rendering.Tricks.and.Techniques.in.DirectX.rar ,DirectX實時渲染技巧與技術
Real-Time Rendering Tricks and Techniques in DirectX(src).ZIP ,DirectX實時渲染技巧與技術(源代碼)
Real Time 3D Terrain Engines Using C++ And Dx9.rar ,實時3D地形引擎用C++和Dx9
MS.Press.-.Microsoft.DirectX.9.Programmable.Graphics.Pipeline.rar ,Microsoft DirectX9可編程圖形管線
Wordware.Publishing.OpenGL.Game.Development.eBook-YYePG.rar ,OpenGL游戲開發
Beginning.OpenGL.Game.Programming.ebook.zip ,OpenGL游戲編程入門
OpenGL.Programming.Guide.rar ,OpenGL編程指南
Addison.Wesley.-.OpenGL.Programming.Guide.2nd.Edition.rar ,OpenGL編程指南(第二版)
Addison-Wesley,.OpenGL.Shading.Language.(2004).DDU.ShareConnector.rar ,OpenGL著色語言(2004)
Learn Vertex and Pixel Shader Programming With Directx 9.rar ,學習頂點和像素著色器編程用DirectX9
Shaderx2 - Shader Programming Tips & Tricks With Directx 9.rar ,Shaderx2 - 著色器編程提示與技巧With DirectX9
ShaderX2 Introctions and Tutorials with DirectX9.rar ,ShaderX2介紹和指導With DirectX9
Direct3D.ShaderX.-.Vertex.and.Pixel.Shader.Tips.and.Tricks.rar ,Direct3D.ShaderX - 頂點和像素著色器提示和技巧
Advanced 3D Game Programming with DirectX 9.rar ,高級3D游戲編程用DirectX 9.0(含源碼,CHM版)
Advanced 3D Game Programming with DirectX 9[PDF].rar ,高級3D游戲編程用DirectX 9.0(PDF版)
DirectX 3D Graphics Programming Bible.rar ,DirectX 3D圖形編程寶典
Introction to 3D Game Programming with DirectX 9.0.rar ,介紹對3D游戲編程用DirectX9.0(含部分源代碼)
Beginning.Direct3D.Game.Programming.rar ,Direct3D游戲編程入門
Beginning.DirectX9.zip ,DirectX9入門
Cutting Edge Direct 3D Programming.rar ,Cutting Edge(刀刃)Direct 3D編程
Game.Scripting.Mastery.zip ,游戲描述語言掌握
Data.Structures.for.Game.Programmers.rar ,數據結構for游戲編程者(含源碼)
2_OpenGL.Extensions.-.Nvidia.rar ,OpenGL擴展(Nvidia)
Managed.DX.9.Kick.Start.Graphics.And.Game.Programming.rar ,DirectX9圖形和游戲編程
OpenGL.Reference.Manual.rar ,OpenGL參考手冊
OpenGL.Super.Bible.rar ,OpenGL超級寶典
Tricks of the Windows Game Programming Gurus.rar ,Windows游戲編程大師技巧
Tricks of Win Game Programming Gurus 2ed.rar ,Windows游戲編程大師技巧(第二版)
Game.Programming.Beginners.Guide.rar ,游戲編程初學者指南
Chris_Crawford_on_Game_Design.rar ,Chris Crawford寫的游戲設計書
Advanced.Animation.with.DirectX.rar ,高級動畫with DirectX(含源碼)
Inside Direct3D.rar ,深入Direct3D
Direct3D_9_Basics.rar ,Direct3D 9基礎
Sams Teach Yourself DirectX 7 in 24 Hours.rar ,教你自己DirectX7在24小時
Programming.Role.Playing.Games.with.DirectX.rar ,用DirectX編程RPG游戲(含源碼)
Programming Multiplayer Games.rar ,編程多玩家游戲
Net Game Programming With Directx 9.0.rar ,網路游戲編程with Directx 9.0
Programming Linux Games.rar ,編程Linux游戲
Developing Online Games - An Insiders Guide.rar ,開發在線游戲 - 一個權威人士的指導
Game Coding Complete.rar ,游戲編碼完全
Strategy Game Programming with DirectX 9.0.rar ,策略游戲編程用DirectX9.0
Strategy Game Programming with DirectX 9.0 Source Code.zip ,策略游戲編程用DirectX9.0(源代碼)
Addison-Wesley - Software Engineering and Computer Games.rar ,軟體工程和計算機游戲
Artificial Intelligence and Software Engineering.rar ,AI和軟體工程
Game-Programming-OpenGL-C++.rar ,有關OpenGl和C++的一些資料
GBA Programming Game Boy Advance The Unofficial Guide.rar ,GBA編程非官方指南
Palm.OS.Game.Programming.zip ,Palm掌上操作系統游戲編程
Mac.Game.Programming.pdf ,蘋果機游戲編程
Premier.Press.J2ME.Game.Programming.rar ,J2ME游戲編程
J2ME Game Development with MIDP2.rar ,J2ME游戲開發with MIDP2
PHP.Game.Programming.zip ,PHP語言游戲編程
Game.Programming.with.Python.Lua.And.Ruby.zip ,游戲編程用Python,Lua和Ruby語言
Apress.dot.NET.Game.Programming.with.DirectX.9.0.eBook-KB.rar ,點NET游戲編程用DirectX9
Wordware.Wireless.Game.Development.In.C.Cpp.With.BREW.chm ,無線游戲開發用C、C++ With BREW
DirectX9 User Interfaces Design and Implementation.rar ,DirectX9用戶介面設計和實現
Game.Interface.Design.rar ,游戲介面設計
SAMS Teach Yourself Game Programming in 24 Hours.rar ,教你自己游戲編程在24小時
C.Game.Programming.For.Dummies.2.rar ,C游戲編程傻瓜書2
Beginners Guide to DarkBASIC Game Programming.rar ,初學者指南對DarkBASIC游戲編程
Windows Graphics Programming Win32 GDI and DirectDraw.rar ,Windows圖形編程 - Win32 GDI 和 DirectDraw
Game Programming Genesis.rar ,游戲編程起步
2D.Artwork.and.3D.Modeling.for.Game.Artists.zip ,2D藝術品和3D建模for游戲藝術家
Game.Art.for.Teens.pdf ,游戲藝術for青年人
Game Development and Proction.rar ,游戲開發和產品
Game.Developers.Market.Guide.rar ,游戲開發者市場指南
MIT.Press.A.History.Of.Modern.Computing.eBook-LiB.rar ,現代計算歷史
The C++ Programming Language NO.3 Edition.rar ,C++編程語言(第三版)
Computer Systems A Programmers Perspective.rar ,計算機系統 - 一個編程者的透視
Intel Architecture Software Developer Manual.zip ,Intel架構軟體開發者手冊
Intel Itanium Assembly Language Reference.rar ,Intel Itanium架構匯編語言參考
Agile Software Development.rar ,靈活的軟體開發
Code Reading The Open Source Perspective.rar ,代碼閱讀與開放源透視
ps2DevEnvironment.exe ,PS2開發環境
doxygen-1.3.9.1-setup.exe ,一種文檔自動生成軟體
wolf_source.exe ,wolf游戲(id software)源代碼
doom_src.zip ,doom游戲(id software)源代碼
q2src320.exe ,Quake2游戲(id software)源代碼
Q3A_TA_GameSource_127.exe ,QuakeIII(id software)游戲源代碼
Q3A_ToolSource.exe ,QuakeIII(id software)工具源代碼
5. 《C游戲編程從入門到精通》pdf下載在線閱讀,求百度網盤雲資源
《C游戲編程從入門到精通》浦濱電子書網盤下載免費在線閱讀
鏈接:
書名:C游戲編程從入門到精通
作者名:浦濱
出版社:北希電腦出版社
出版年份:2002-5-1
頁數:408
內容介紹:
本書以C語言游戲編程入門,以102個實例,近200個函數較為系統地介紹了C基於游戲編程與開發的力法與技巧,內容豐富並相互包容,相互滲透。以實際的基於不同平台的游戲製作為背景,知識闡述與實際案例結合,深入淺出,具體、直觀、全面,可操作性強;是一本難得的集入門、深入到精通C游線編程的綜合書籍。
6. 求C語言 小游戲設計
我寫了個貪吃蛇,有單人版,也有雙人版
這是單人版:
#include<stdio.h>
#include<stdlib.h>
#include<windows.h>
#include<conio.h>
#include<time.h>
#include<malloc.h>
intfood[2];
intfeng;
intdengji=3;
intspeed=150;
structsnake
{
intx,y,life;
structsnake*next;
};
voidwelcome()
{
system("MODEcon:COLS=79LINES=24");
system("color8F");
printf("歡迎來到貪吃蛇的世界 ");
printf("ByHB ");
printf("↑↓←→ ");
printf("上下左右 ");
printf("食物為:★ ");
printf("按空格暫停 ");
printf("按Z(大寫)切換等級 ");
printf("等級從5級到1級是從高到低 ");
printf("注意:每次增加的分數=當前等級*10 ");
printf("按任意鍵開始游戲! ");
getch();
system("cls");
}
voidgotoxy(intx,inty)
{
COORDcoord;
coord.X=x;coord.Y=y;
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),coord);
}
voidmakefood(structsnake*p)
{
intfx;
structsnake*p1=p;
srand(time(NULL));
fx=rand()%77+2;
if(fx%2==0)
{
fx--;
}
food[0]=fx;
food[1]=rand()%22+1;
while(p!=NULL)
{
if(p->x==food[0]&&p->y==food[1])
{
makefood(p1);
}
p=p->next;
}
}
voiddrawmap(structsnake*p)
{
system("cls");
printf("你的分數為:%d分當前等級為:%d級",feng,dengji);
gotoxy(p->x,p->y);
printf("◇");
p=p->next;
while(p!=NULL)
{
gotoxy(p->x,p->y);
printf("※");
p=p->next;
}
gotoxy(food[0],food[1]);
printf("★");
}
structsnake*mvsnake(structsnake*p,intz)
{
structsnake*p2,*p3;
intx,y;
x=p->x;
y=p->y;
switch(z)
{
case1:
{
x-=2;
break;
}
case2:
{
x+=2;
break;
}
case3:
{
y--;
break;
}
case4:
{
y++;
break;
}
}
p2=(structsnake*)malloc(sizeof(structsnake));
p2->x=x;
p2->y=y;
p2->life=1;
p2->next=p;
if(p2->x>=79||p2->y>=24||p2->x<0||p2->y<1)
{
p2->life=0;
}
p3=p;
while(p3!=NULL)
{
if(p2->x==p3->x&&p2->y==p3->y)
{
p2->life=0;
}
p3=p3->next;
}
if(p2->x==food[0]&&p2->y==food[1])
{
feng+=dengji*10;
makefood(p2);
}
else
{
while(p->next->next!=NULL)
{
p=p->next;
}
p3=p->next;
p->next=NULL;
free(p3);
}
returnp2;
}
intscan(intz)
{
charch;
if(kbhit()){
ch=getch();
switch(ch)
{
case75:if(z!=2)z=1;break;
case77:if(z!=1)z=2;break;
case72:if(z!=4)z=3;break;
case80:if(z!=3)z=4;break;
case32:z=5;break;
case'Z':speed-=50;
dengji++;
if(speed==0){speed=250;dengji=1;}
break;
default:break;
}
if(ch==27)z=27;
fflush(stdin);
}
returnz;
}
intmain(intargc,char*argv[])
{
welcome();
loop:system("cls");
structsnake*snakenext;
structsnake*snk=(structsnake*)malloc(sizeof(structsnake));
snk->x=15;
snk->y=15;
snk->life=1;
snk->next=(structsnake*)malloc(sizeof(structsnake));
snk->next->x=14;
snk->next->y=snk->y;
snk->next->next=(structsnake*)malloc(sizeof(structsnake));
snk->next->next->x=13;
snk->next->next->y=snk->y;
snk->next->next->next=NULL;
intz=2;
makefood(snk);
while(1)
{
inttemp_z=z;
z=scan(z);
if(z==27)exit(0);
if(z==5)
{
gotoxy(30,15);
printf("暫停");
getch();z=temp_z;
}
snk=mvsnake(snk,z);
if(snk->life==0)break;
drawmap(snk);
Sleep(speed);
}
system("cls");
gotoxy(25,11);
printf("GAMEOVER,你的最終分數為:%d分 ",feng);
gotoxy(25,12);
printf("按空格重新開始,按其他鍵結束! ");
while(snk!=NULL)
{
snakenext=snk->next;
free(snk);
snk=snakenext;
}
Sleep(500);
charcha;
cha=getch();
if(cha==32)
{
gotoloop;
}
return0;
}
這是雙人版:
#include<stdio.h>
#include<stdlib.h>
#include<windows.h>
#include<conio.h>
#include<time.h>
#include<malloc.h>
intfood[2];
intfeng1,feng2;
intspeed=150;
intdengji=3;
intchi;
structsnake
{
intx,y,life;
structsnake*next;
};
voidwelcome()
{
system("MODEcon:COLS=79LINES=24");
system("color8F");
printf("歡迎來到雙人貪吃蛇游戲 ");
printf("ByHB ");
printf("玩家1:□□◇ ");
printf("WSAD(大寫) ");
printf("上下左右 ");
printf("玩家2:■■◆ ");
printf("↑↓←→ ");
printf("上下左右 ");
printf("食物為:★ ");
printf("按空格暫停 ");
printf("按Z(大寫)切換等級 ");
printf("等級從5級到1級是從高到低 ");
printf("注意:每次增加的分數=當前等級*10 ");
printf("按任意鍵開始游戲! ");
getch();
system("cls");
}
voidgotoxy(intx,inty)
{
COORDcoord;
coord.X=x;coord.Y=y;
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),coord);
}
voidmakefood(structsnake*p,structsnake*p2)
{
intfx;
structsnake*p1=p;
structsnake*p3=p2;
srand(time(NULL));
fx=rand()%77+2;
if(fx%2==0)
{
fx--;
}
food[0]=fx;
food[1]=rand()%22+1;
while(p!=NULL&&p2!=NULL)
{
if((p->x==food[0]&&p->y==food[1])||(p2->x==food[0]&&p2->y==food[1]))
{
makefood(p1,p3);
}
p=p->next;
p2=p2->next;
}
}
voiddrawmap(structsnake*p,structsnake*p2)
{
system("cls");
printf("玩家1的分數為:%d分當前等級為:%d級玩家2的分數為:%d分",feng1,dengji,feng2);
gotoxy(p->x,p->y);
printf("◇");
p=p->next;
gotoxy(p2->x,p2->y);
printf("◆");
p2=p2->next;
while(p!=NULL)
{
gotoxy(p->x,p->y);
printf("□");
p=p->next;
}
while(p2!=NULL)
{
gotoxy(p2->x,p2->y);
printf("■");
p2=p2->next;
}
gotoxy(food[0],food[1]);
printf("★");
}
structsnake*mvsnake(structsnake*p,structsnake*p4,intz,inti)
{
structsnake*p2,*p3;
intx,y;
x=p->x;
y=p->y;
switch(z)
{
case1:
{
x-=2;
break;
}
case2:
{
x+=2;
break;
}
case3:
{
y--;
break;
}
case4:
{
y++;
break;
}
}
p2=(structsnake*)malloc(sizeof(structsnake));
p2->x=x;
p2->y=y;
p2->life=1;
p2->next=p;
if(p2->x>=79||p2->y>=24||p2->x<0||p2->y<1)
{
p2->life=0;
}
p3=p;
while(p3!=NULL)
{
if(p2->x==p3->x&&p2->y==p3->y)
{
p2->life=0;
}
p3=p3->next;
}
if(p2->x==food[0]&&p2->y==food[1])
{
if(i==1)
{
feng1+=dengji*10;
}
elseif(i==2)
{
feng2+=dengji*10;
}
makefood(p2,p4);
}
else
{
while(p->next->next!=NULL)
{
p=p->next;
}
p3=p->next;
p->next=NULL;
free(p3);
}
returnp2;
}
intscan(intz)
{
charch;
if(kbhit()){
ch=getch();
switch(ch)
{
case75:
case'A':if(z!=2)z=1;break;
case77:
case'D':if(z!=1)z=2;break;
case72:
case'W':if(z!=4)z=3;break;
case80:
case'S':if(z!=3)z=4;break;
case32:z=5;break;
case'Z':speed-=50;
dengji++;
if(speed==0){speed=250;dengji=1;}
break;
default:break;
}
if(ch==27)z=27;
}
returnz;
}
intmain(intargc,char*argv[])
{
welcome();
loop:system("cls");
structsnake*snakenext;
structsnake*snk=(structsnake*)malloc(sizeof(structsnake));
snk->x=15;
snk->y=15;
snk->life=1;
snk->next=(structsnake*)malloc(sizeof(structsnake));
snk->next->x=14;
snk->next->y=snk->y;
snk->next->next=(structsnake*)malloc(sizeof(structsnake));
snk->next->next->x=13;
snk->next->next->y=snk->y;
snk->next->next->next=NULL;
structsnake*snake2next;
structsnake*snk2=(structsnake*)malloc(sizeof(structsnake));
snk2->x=17;
snk2->y=10;
snk2->life=1;
snk2->next=(structsnake*)malloc(sizeof(structsnake));
snk2->next->x=16;
snk2->next->y=snk2->y;
snk2->next->next=(structsnake*)malloc(sizeof(structsnake));
snk2->next->next->x=15;
snk2->next->next->y=snk2->y;
snk2->next->next->next=NULL;
intz=2;
intk=2;
makefood(snk,snk2);
while(1)
{
inttemp_z=z;
z=scan(z);
k=scan(k);
if(z==27)exit(0);
if(z==5)
{
gotoxy(30,15);
printf("暫停");
getch();z=temp_z;
}
snk=mvsnake(snk,snk2,z,1);
snk2=mvsnake(snk2,snk,k,2);
if(snk->life==0||snk2->life==0)break;
drawmap(snk,snk2);
Sleep(speed);
}
system("cls");
gotoxy(15,11);
printf("GAMEOVER,玩家1的分數為:%d分,玩家2的分數為:%d分 ",feng1,feng2);
gotoxy(33,12);
if(feng1>feng2)
{
printf("玩家1贏了! ");
}
elseif(feng2>feng1)
{
printf("玩家2贏了! ");
}
else
{
printf("你們打成了平手! ");
}
gotoxy(25,13);
printf("按空格重新開始,按其他鍵結束! ");
while(snk!=NULL)
{
snakenext=snk->next;
free(snk);
snk=snakenext;
}
while(snk2!=NULL)
{
snake2next=snk2->next;
free(snk2);
snk2=snake2next;
}
Sleep(500);
charcha;
cha=getch();
if(cha==32)
{
gotoloop;
}
return0;
}
7. 《游戲機制高級游戲設計技術》pdf下載在線閱讀全文,求百度網盤雲資源
《游戲機制高級游戲設計技術》網路網盤pdf最新全集下載:
鏈接:https://pan..com/s/1bWIW43LnL1vWmrWt11U32g
8. C語言程序小游戲----一條龍游戲設計
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
using namespace std;
typedef __int64 BigInteger;
typedef unsigned int Index;
typedef double Number;
class CombinationIterator
{
vector<Index> mCurrent;
Index mN;
Index mM;
static BigInteger factorial( Index n )
{
BigInteger fact = 1;
for( Index i = 2; i <= n; ++i )
fact *= i;
return fact;
}
public:
CombinationIterator(): mN( 0 ), mM( 0 )
{}
CombinationIterator( Index n, Index m )
: mN( n ), mM( m ),
mCurrent( (vector<Index>::size_type) m )
{
if( m > n || n < 1 || m < 1 )
throw 1;
for( Index i = 0; i < m; ++i )
mCurrent[ i ] = i;
}
void operator ++ ()
{
if( mM == 0 )
throw 1;
if( mCurrent[ 0 ] == mN - mM )
{
mN = mM = 0;
return;
}
Index i = mM - 1;
while( mCurrent[ i ] == mN - mM + i )
--i;
mCurrent[ i ] = mCurrent[ i ] + 1;
for( Index j = i + 1; j < mM; ++j )
mCurrent[ j ] = mCurrent[ i ] + j - i;
}
const vector<Index>& operator* () const
{
return mCurrent;
}
bool operator == ( const CombinationIterator& that ) const
{
if( mM == that.mM && mM == 0 )
return true;// both end
return mM == that.mM && mN == that.mN && mCurrent == that.mCurrent;
}
bool operator != ( const CombinationIterator& that ) const
{
return !( *this == that );
}
};
template<typename T>
class VectorCombinationIterator
{
vector<T> mVector;
Index mCurrentM;
CombinationIterator mIter;
public:
VectorCombinationIterator()
{}
VectorCombinationIterator(const vector<T>& v)
: mVector( v ), mCurrentM( 1 ), mIter( (Index) v.size(), mCurrentM )
{}
void operator ++ ()
{
++mIter;
if( mIter == CombinationIterator() && mCurrentM < mVector.size() )
{
++mCurrentM;
mIter = CombinationIterator( (Index) mVector.size(), mCurrentM );
}
}
pair< vector<T>, vector<T> > operator* () const
{
const vector<Index>& current = *mIter;
pair< vector<T>, vector<T> > result;
for( vector<T>::size_type i = 0; i < mVector.size(); ++i )
if( find( current.begin(), current.end(), i ) != current.end() )
result.first.push_back( mVector[i] );
else
result.second.push_back( mVector[i] );
return result;
}
bool operator == ( const VectorCombinationIterator& that ) const
{
if( mIter == that.mIter && mIter == CombinationIterator() )
return true;// both end
return mCurrentM == that.mCurrentM && mVector == that.mVector && mIter == that.mIter;
}
bool operator != ( const VectorCombinationIterator& that ) const
{
return !( *this == that );
}
};
static char gOperatorChars[]={'+','-','*','/'};
struct ExpressionItem
{
Number mValue;
char mOperator;
ExpressionItem* mLeftChild;
ExpressionItem* mRightChild;
ExpressionItem(){}
ExpressionItem( Number v, char oper, ExpressionItem* left, ExpressionItem* right )
: mValue( v ), mOperator( oper ), mLeftChild( left ), mRightChild( right )
{}
static vector<ExpressionItem> mPool;
static ExpressionItem* alloc( Number v, char oper, ExpressionItem* left, ExpressionItem* right )
{
mPool.push_back( ExpressionItem( v, oper, left, right ) );
return &*mPool.rbegin();
}
};
vector<ExpressionItem> ExpressionItem::mPool( 1024*1024 );
vector<ExpressionItem*> getPossibleResult( const vector<ExpressionItem*>& left, const vector<ExpressionItem*>& right )
{
vector<ExpressionItem*> result;
for( vector<ExpressionItem*>::const_iterator liter = left.begin(); liter != left.end() ; ++liter )
for( vector<ExpressionItem*>::const_iterator riter = right.begin(); riter != right.end() ; ++riter )
{
result.push_back( ExpressionItem::alloc( (*liter)->mValue + (*riter)->mValue, '+', *liter, *riter ) );
result.push_back( ExpressionItem::alloc( (*liter)->mValue - (*riter)->mValue, '-', *liter, *riter ) );
result.push_back( ExpressionItem::alloc( (*liter)->mValue * (*riter)->mValue, '*', *liter, *riter ) );
if( (*riter)->mValue != 0.0 )
result.push_back( ExpressionItem::alloc( (*liter)->mValue / (*riter)->mValue, '/', *liter, *riter ) );
}
return result;
}
vector<ExpressionItem*> getPossibleResult( const vector<ExpressionItem*>& expItems )
{
if( expItems.size() == 1 )
return expItems;
vector<ExpressionItem*> result;
VectorCombinationIterator<ExpressionItem*> iter( expItems );
while( iter != VectorCombinationIterator<ExpressionItem*>() )
{
pair< vector<ExpressionItem*>, vector<ExpressionItem*> > p = *iter;
if( p.first.size() != 0 && p.second.size() != 0 )
{
vector<ExpressionItem*> items = getPossibleResult( getPossibleResult( p.first ),
getPossibleResult( p.second ) );
result.insert( result.end(), items.begin(), items.end() );
}
++iter;
}
return result;
}
vector<ExpressionItem*> getPossibleResult( const vector<Number>& numbers )
{
vector<ExpressionItem*> expItems;
for( vector<Number>::const_iterator iter = numbers.begin(); iter != numbers.end(); ++iter )
expItems.push_back( ExpressionItem::alloc( *iter, 0, NULL, NULL ) );
return getPossibleResult( expItems );
}
void printExpression( ExpressionItem* item, char oper, bool isLeftChild )
{
if( item->mLeftChild == NULL )
{
cout<<item->mValue;
}
else if( ( item->mOperator == '+' || item->mOperator == '-' ) && ( oper == '*' || oper == '/' ) )
{
cout<<"( ";
printExpression( item->mLeftChild, item->mOperator, true );
cout<<" ";
cout<<item->mOperator;
cout<<" ";
printExpression( item->mRightChild, item->mOperator, false );
cout<<" )";
}
else if( !isLeftChild &&
( ( ( item->mOperator == '+' || item->mOperator == '-' ) && oper == '-' ) ||
( ( item->mOperator == '*' || item->mOperator == '/' ) && oper == '/' ) ) )
{
cout<<"( ";
printExpression( item->mLeftChild, item->mOperator, true );
cout<<" ";
cout<<item->mOperator;
cout<<" ";
printExpression( item->mRightChild, item->mOperator, false );
cout<<" )";
}
else
{
printExpression( item->mLeftChild, item->mOperator, true );
cout<<" ";
cout<<item->mOperator;
cout<<" ";
printExpression( item->mRightChild, item->mOperator, false );
}
}
void printExpression( ExpressionItem* item )
{
if( item->mLeftChild != NULL )
{
printExpression( item->mLeftChild, item->mOperator, true );
cout<<" ";
cout<<item->mOperator;
cout<<" ";
printExpression( item->mRightChild, item->mOperator, false );
}
else
cout<<item->mValue;
}
int main()
{
for( int i = 1; i <= 10; ++i )
for( int j = 1; j <= 10; ++j )
for( int k = 1; k <= 10; ++k )
for( int l = 1; l <= 10; ++l )
{
if( i > j || j > k || k > l )
continue;
ExpressionItem::mPool.clear();
ExpressionItem::mPool.reserve( 1024*1024 );
vector<Number> vn;
vn.push_back( i );
vn.push_back( j );
vn.push_back( k );
vn.push_back( l );
vector<ExpressionItem*> exps = getPossibleResult( vn );
for( int m = 0; m < exps.size(); ++m )
if( exps[ m ]->mValue >= 23.999 && exps[ m ]->mValue <= 24.001 )
{
cout<<i<<','<<j<<','<<k<<','<<l<<" \t---\t";
printExpression( exps[ m ] );
cout<<" = "<<exps[ m ]->mValue<<endl;
break;
}
// if( m == exps.size() )
// cout<<i<<','<<j<<','<<k<<','<<l<<" have no possible result"<<endl;
}
return 0;
}
9. 《C語言程序設計第四版》pdf下載在線閱讀全文,求百度網盤雲資源
《C語言程序設計第四版》網路網盤pdf最新全集下載:
鏈接: https://pan..com/s/1OJyaV3BLbsB8eBo8cUAvBQ
10. 《C游戲編程從入門到精通》pdf下載在線閱讀全文,求百度網盤雲資源
《C游戲編程從入門到精通》(浦濱)電子書網盤下載免費在線閱讀
鏈接:
書名:C游戲編程從入門到精通
作者:浦濱
出版社:北希電腦出版社
出版年份:2002-5-1
頁數:408