0
Help with a chess game
Hello,I need help in making of a chess game with random pieces. (in C#)(its for a school project) By random pieces,I mean that every new game,you get 1 king ( must),and maybe 2 queens,or maybe 3 knights,no rooks,a lot of horses,random,you know? This is the game I got my inspiration from: https://play.google.com/store/apps/details?id=com.noodlecake.reallybadchess I want to code something like Really Bad Chess,but I've got no idea how to randomize those pieces. Also,I'd like to try to randomize (Every round) every piece that you havent used (like if this turn you haven't used your rooks,they transform into another piece,like rook->queen/etc) Thanks for any help :D
1 Resposta
+ 3
Just place the available options in some sort of array/list/etc... Then in your code where it generates pieces onto the square, use a random number to select one of the available pieces. Prior to that, filter all potential pieces by whatever rules you want - for example, you said no rooks, etc...After it selects the piece, generate it as you would normally.
As for the second part, it'll work in a similar fashion. Basically, you'll have a list of all your pieces and which one made the most recent move. You'll freeze the most recent one and randomize the rest of them similar to how you generated them in the beginning.