91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 0.01M
    文件類型: .c
    金幣: 1
    下載: 0 次
    發(fā)布日期: 2021-05-29
  • 語言: 其他
  • 標簽: 其他??

資源簡介

迷宮小車代碼.c

資源截圖

代碼片段和文件信息

//示例迷宮信息?
/*uchar?map[8][8]?=?{{0x070x050x090x030x010x050x090x0b}
{0x030x050x000x080x0a0x0b0x0a0x0a}
{0x0a0x0b0x0a0x0e0x0e0x020x000x0c}
{0x0a0x020x000x050x050x080x0a0x0b}
{0x060x0c0x0a0x0b0x0b0x0a0x0a0x0a}
{0x030x010x0c0x0a0x020x080x060x08}
{0x0a0x020x050x040x080x020x050x0c}
{0x0e0x060x050x0d0x0e0x060x050x0d}};
uchar?map[8][8]?=?{{0x070x050x090x030x050x050x090x0b}
{0x030x010x080x060x010x0d0x0a0x0a}
{0x0a0x0a0x060x050x000x050x000x0c}
{0x0e0x020x050x0d0x0a0x070x040x09}
{0x070x040x010x0d0x0a0x070x050x08}
{0x030x010x040x050x040x010x0d0x0a}
{0x0a0x0a0x030x050x050x000x050x0c}
{0x0e0x060x040x050x0d0x060x050x0d}};*/
/*
地圖默認從左下角為起點,右上角為終點,按照坐標的記憶方式,這樣的上下左右是固定的?
07?17?27?37?47?57?67?77
06?16?26?36?46?56?66?76
05?15?25?35?45?55?65?75
04?14?24?34?44?54?64?74
03?13?23?33?43?53?63?73
02?12?22?32?42?52?62?72
01?11?21?31?41?51?61?71
00?10?20?30?40?50?60?70
跟數(shù)組的方向轉(zhuǎn)了90°?
數(shù)組的記憶方式是
00?01?02?03?04?05?06?07
10?11?12?13?14?15?16?17
20?21?22?23?24?25?26?27
30?31?32?33?34?35?36?37
40?41?42?43?44?45?46?47
50?51?52?53?54?55?56?57
60?61?62?63?64?65?66?67
70?71?72?73?74?75?76?77
因此示例迷宮信息在看的時候注意將地圖信息逆時針旋轉(zhuǎn)90°來觀認
注意:“全體代碼均按照坐標方式進行記憶和標記,非數(shù)組的排列方式?”
全篇信息記錄也可以改做為數(shù)組記憶方式,不過得重新確定上下左右的方向以及修改通過A(小車方向)來執(zhí)行命令的代碼?
*/
#include?

#define?uchar?unsigned?char
#define?uint?unsigned?int

uchar?map[8][8]?=?{0xff}; //地圖信息
uint?t?=?5000; //坐標,定時器時間?
uchar?x?=?0y?=?0?i?j?A?=?0?m?n?flag?count;//標記?,A用于記錄方向,0是上,1是右,2是下,3是左?
uchar?code?forw[8]?=?{0x110x930x820xc60x440x6c0x280x39}; //前進?
uchar?code?tR[8]?=?{0x110x330x220x660x440xcc0x880x99}; //往左偏?
uchar?code?tL[8]?=?{0x110x990x880xcc0x440x660x220x33}; //往右偏?
char?r[8][8]?=?{0}; //等高表的存儲?
uchar?irC?=?0irL?=?0irR?=?0irLU?=?0irRU?=?0;//傳感器
uchar?code?table[]={0xc00xf90xa40xb00x990x920x820xf80x800x90};//數(shù)碼管的顯示數(shù)字
sfr?P4?=?0xe8; //定義P4?
sbit?beep?=?P3^7; //蜂鳴器?
sbit?irR1?=?P2^1; //前
sbit?irR2?=?P2^2; //左前
sbit?irR3?=?P2^3; //左?
sbit?irR4?=?P2^4; //右?
sbit?irR5?=?P2^5; //右前?
sbit?well?=?P4^3; //數(shù)碼管
sbit?welr?=?P4^2; //數(shù)碼管
sbit?A0?=?P4^0;
sbit?A1?=?P2^0;
sbit?A2?=?P2^7;

void?Delay_ms(uint?ms) //延時函數(shù)?
{
uchar?k;
while(ms--)
for(k?=?0;?k?}

/*void?Display(uint?s) //數(shù)碼管顯示?
{
uint?ab;
a?=?s/10;
b?=?s%10;
well=0;
P0=table[b];
Delay_ms(5);
well=1;
welr=0;
P0=table[a];
Delay_ms(5);
welr=1;
}*/

void?CorrectR() //向右修正
{
for(m?=?0;?m? for(n?=?0;?n? {
P1?=?tR[n];
Delay_ms(2);
}
}

void?CorrectL() //向左修正
{
for(m?=?0;?m? {
for(n?=?0;?n? {
P1?=?tL[n];
Delay_ms(2);
}
}
}

void?Forward() //前進一格?
{
for(i?=?0;?i? {
for(j?=?0;?j? {
P1?

評論

共有 條評論