基于Linux系统八皇后问题设计报告
时间:2025-04-24
时间:2025-04-24
基于Linux系统八皇后问题设计报告
目录
一.引言 ....................................... 1 二.内容 ....................................... 2 1.八皇后问题介绍 ............................ 2 2.gcc编程介绍 ............................... 3 三.原理 ....................................... 4 1.算法 ...................................... 4 2.原理 ...................................... 7 3.方案 ..................................... 14 四.实现及其结果 ............................... 14 1.gcc的安装 ............................... 14 2.运行过程 ................................. 16 (1)编写makefile .......................... 17 (2)运行makefile文件 ..................... 17 五.结论 ...................................... 18 六.致谢 ...................................... 19 七.参考文献 .................................. 19
基于Linux系统八皇后问题设计报告
一.引言
Linux是一个年轻的操作系统,从1991年诞生到现在只有几十年的历史。但是Linux系统以其卓越的性能和安全性,迅速征服了广大的企业和个人用户。Red Hat Linux是最流行的Linux版本,提供了一系列优秀的图形管理工具以及丰富的桌面应用和服务器应用组件。本次设计实验在Red Hat Linux操作系统中用gcc编程实现八皇后问题。八皇后问题是一个古老而著名的问题,该问题是十九世纪著名的数学家高斯1850年提出的。
在国际象棋中,皇后是最有权利的一个棋子;只要别的棋子在它的同一行或同一列或同一斜线(正斜线或反斜线)上时,它就能把对方棋子吃掉。所以高斯提出了一个问题:在8*8的格的国际象棋上摆放八个皇后,使其不能相互攻击,即任意两个皇后都不能处于同一列、同一行、或同一条斜线上面,问共有多少种解法。
到了现代,随着计算机技术的飞速发展,这一古老而有趣的数学游戏问题也自然而然的被搬到了计算机上。运用所学计算机知识来试着解决这个问题是个锻炼和提高我自己编程能力和独立解决问题能力的好机会,可以使我增强信心,为我以后的编程开个好头,故我选择了这个有趣的课题。
关键字:Linux系统 Red Hat Linux 八皇后问题
Linux is a young operating system , born from 1991 to now only a few decades old. But Linux systems for its outstanding performance and safety , quickly conquered the majority of the enterprises and individual users. Red Hat Linux is the most popular version of Linux , provides a range of excellent graphical management tools and rich desktop applications and server application components . The design of experiments in Red Hat Linux operating system using gcc programming eight queens problem . Eight queens problem is an old and well-known problem , the problem is well-known nineteenth -century mathematician Gauss in 1850 raised .
基于Linux系统八皇后问题设计报告
In chess , the queen is the most right of a pawn ; Just another pawn in its same row or column or the
same diagonal ( forward slash or backslash ) on time , it can eat other pieces . So Gauss raises a question : chess placed on the grid 8 * 8 eight queens, it can not attack each other , that any two Queen can not in the same column , the same line , or with a slash above , Q. how many kinds of solutions.
In modern times , with the rapid development of computer technology , this ancient and interesting mathematical problems naturally game was moved to the computer. Apply the knowledge of computers to try to solve this problem is to exercise and improve my own programming skills and independent problem-solving ability of a good opportunity to make my boost confidence for my future programming a good beginning , so I chose this interesting subject.
Keywords: Linux Red Hat Linux system eight queens problem
二.内容 1.八皇后问题介绍
八皇后问题是一个以国际象棋为背景的问题:如何能够在 8×8 的国际象棋棋盘上放置八个皇后,使得任何一个皇后都无法直接吃掉其他的皇后?为了达到此目的,任两个皇后都不能处于同一条横行、纵行或斜线上。八皇后问题可以推广为
基于Linux系统八皇后问题设计报告
更一般的n皇后摆放问题:这时棋盘的大小变为n×n,而皇后个数也变成n。当且仅当 n = 1 或 n ≥ 4 时问题有解。
八皇后问题最早是由国际西洋棋棋手马克斯·贝瑟尔于1848年提出。之后陆续有数学家对其进行研究,其中包括高斯和康托,并且将其推广为更一般的n皇后摆放问题。八皇后问题的第一个解是在1850年由弗朗兹·诺克给出的。诺克也是首先将问题推广到更一般的n皇后摆放问题的人之一。1874年,S.冈德尔提出了一个通过行列式来求解的方法,这个方法后来又被J.W.L.格莱舍加以改进。
艾兹格·迪杰斯特拉在1972年用这个问题为例来说明他所谓结构性编程的能力。
2.gcc编程介绍
GCC是GNU公社的一个项目。是一个用于编程开发的自由编译器。最初,GCC只是一个C语言编译器,他是GNU C Compiler 的英文缩写。随着众多自由开发者的加入和GCC自身的发展,如今的GCC以经是一个包含众多语言的编译器了。其中包括 C,C++,Ada,Object C和Java等。所以,GCC也由原来的GNU C Compiler变为GNU Compiler Collection。也就是 GNU编译器家族 的意思。当然,如今的GCC借助于他的特性,具有了交叉编译器的功能,即在一个平台下编译另一个平台的代码。
直到现在,GCC的历史仍然在继续,他的传奇仍然被人所传颂。
上一篇:科研项目申请报告注意事项及范例