Cài đặt Steam
Đăng nhập
|
Ngôn ngữ
简体中文 (Hán giản thể)
繁體中文 (Hán phồn thể)
日本語 (Nhật)
한국어 (Hàn Quốc)
ไทย (Thái)
Български (Bungari)
Čeština (CH Séc)
Dansk (Đan Mạch)
Deutsch (Đức)
English (Anh)
Español - España (Tây Ban Nha - TBN)
Español - Latinoamérica (Tây Ban Nha cho Mỹ Latin)
Ελληνικά (Hy Lạp)
Français (Pháp)
Italiano (Ý)
Bahasa Indonesia (tiếng Indonesia)
Magyar (Hungary)
Nederlands (Hà Lan)
Norsk (Na Uy)
Polski (Ba Lan)
Português (Tiếng Bồ Đào Nha - BĐN)
Português - Brasil (Bồ Đào Nha - Brazil)
Română (Rumani)
Русский (Nga)
Suomi (Phần Lan)
Svenska (Thụy Điển)
Türkçe (Thổ Nhĩ Kỳ)
Українська (Ukraine)
Báo cáo lỗi dịch thuật
I need to somehow make it check all squares between the 'from' square and the destination square, on the same diagonal (for example if the bishop is moving from c8 to h3, it needs to ckeck that the squares d7, e6, f5 and g4 are empty).
This was easy enough for the rooks - essentially "for(k = from_x+1;k < msqx;k ++) if pc[from_x+k,msqy] != 0 exit". With the bishops I've been trying things like "if pc[max(from_x,msqx)-min(from_x,msqx)+k,max(from_y,msqy)-min(from_y,msqy)] != 0 exit" but they always end up able to make illegal moves or unable to make legal ones ):
x += lengthdir_x( dis, dir ); dis is the distance and dir is the direction which you get using point_direction.
By the way you would want to use both x += lengthdir_x and y += lengthdir_y to move diagonal. You can use the the same dir you get from point_direction in both the x and y.