# Algorithm for implementing chess rule [closed]

It's my first question on the chess stack exchange (actually I asked this question to stack overflow but my question was closed 'off topic'), and English is not my first language. So please understand if my explanation is not clear.

I'm a programming novice. I can use some of C (actually I forgot even basics of C), python, IDL just for scientific calculations, or for graphing.

I'm a moderate custom map maker for Starcraft 1. Yes, old fashioned game. Till lately only algorithm I need to make an custom map in Starcraft was trigger, which consists of condition(if~) and action(do~). There was no more complex algorithm like loop or like that.

However, recently there were much advance in the technology of making custom map with the popularization of EUD trigger.

EUD stands for Extended Unit death Trigger. There is an action in Starcraft trigger named 'Set Death'. The point is, you can set the death value of certain unit (of certain player) outside the allowed range. That makes possible to access and change other game data, like unit attack range or unit appearance(though extreme exploitation were limited in Starcraft:Remastered)

And one map maker (and programmer) made a programming language named epScript in which you can program a custom map and that would compile your script into Starcraft triggers and automatically embed them in a map.

And he wrote some lectures about how to use the language and compiler and the example he chose was the Chess. https://github.com/phu54321/euddraft/wiki

So you can play Chess in Starcraft Battlenet. (Well it was possible before when EUD was enabled but it was a result of such a lot of labor.)

However unfortunately he has stopped midway and I have some reasons to believe that for a while he'd not complete his lectures. So I'd like to continue and complete the chess map for two person, and besides, I wanna apply the principle to make a variant of chess, Kriegspiel, which is one of my favorite board game. https://en.wikipedia.org/wiki/Kriegspiel_(chess)

Anyway, before that, I want to make chess (PvP). But as I said, I'm novice in programming, so I'm not accustomed to make algorithms to realize chess mechanism. So like, I'm not sure how to make script for disabling king to go into a checked cell.

Are there some webpages that lists algorithms for chess making , not language-dependent? I don't want AI algorithm for chess.(well after I finish the job, if I have enough time I may invest some time for that to enable PvC. And maybe for Kriegspiel too..?) I just want algorithms to implement chess rules. Thanks.

You're asking code for validating a chess position. There're a lot, tons and tons libraries. However, I don't think there's anything that you can compile for StarCraft. Consider:

1. Learn chess yourself. Make sure you know the rules well.
2. There's nothing you can just grab for your project. You'll need to do it yourself. If speed is not important, you could encode the chess board as a 8x8 two-dimensional arrays. Simple programming. Loop throught the arrays for moves, slow but it'll work for sure.
3. If speed is important, consider bitboard implementation. Please google bitboard for chess.

Some references: