Any programmers on? I have no idea where to start for this.
I need to write a function that takes a struct containing information for a chess move which may or may not contain the information of where the piece is coming from, but will always contain the info for which type of piece it is, what color it is, whether it results in a capture, and where it's going, and then find on a board constructed out of a 2d array which piece is able to make that move.
I realize this is probably really basic, I'm completely new at this.
Jeremiah Green
do your own homework or ask github faggot
Nathaniel Morgan
on what like shrooms? or acid? the ganj ?? specificity dude.
Jaxon Parker
What language? Are you using an IDE?
William Green
This is pretty basic shit
Noah Ward
I am doing my own homework... this is just a specific piece that I'm stuck on.
The rest of the assignment is pretty much done.
It's in C. I'm using codeblocks... I've heard bad things about that, but I'm just used to it from my intro to programming class last semester...
Isaiah Russell
I know, I'm a fucking travesty with this stuff.
Justin Peterson
10$ and i'll write the entire code fore you.
Brayden Gray
No thanks, even if I am getting help, I still need to learn by working out the details myself.
Daniel Scott
25$ and i will not only write the entire code for you, i'll also comment it all and spend 30 minutes on skype with you explaining how it works.
Jace Howard
Even if you did that, I wouldn't be able to focus long enough to understand it.
This is why I never learn anything in class...
Hudson Jones
struct Your_type_name { int value; char * whatever; };
What do you not understand specifically?
Brody Brooks
how to figure out which piece on the board out of all the other pieces can make the move.
Say if it's a pawn moving to f4, am I supposed to just go over each pawn one at a time until I find one that's within bounds of the move? It seems so inefficient...
Connor Johnson
Well i don't know what type of help you expect then...
It's not that complicated really If you have initial position it's cool right? you just do if(x1 != null && y1!=null) if that's true then you already know which piece it is. If not, you see where it ends up and what type it is. You have only few types. Like if you have pawn and you know it ends up at [x][y], it had to be at [x][y-1] or [x-1][y-1] etc.
Cameron Evans
I got it. Not great considering programming doesn't use implicit statements. 3/10 Because 2 is a reply and 3 is a little better than 2
Xavier Walker
Well I assume you will have a struct for each piece right? Based on the one that is moving (the one that goes into the function?) It will have its current position saved in the struct right? (x,y) coords will be easier than F4 etc.
Nathaniel Ward
what language...?
Nathaniel Brooks
To expand on this:
bool check_move(piece piece_to_check) { //piece is the struct you defined switch(piece_to_check.type) //etc }
Ethan Lee
it comes from an algebraic chess notation string.
usually it only shows the piece type and where the piece is going, unless it's an ambiguous case, everything else you're supposed to infer.
here's what the struct looks like:
typedef struct Location { // the square's column ('a' through 'h') char col;
// the square's row (1 through 8) int row; } Location;
typedef struct Move { // location where this piece is moving from Location from_loc;
// location where this piece is moving to Location to_loc;
// what type of chess piece is being moved char piece;
// whether this move captures another piece short int isCapture;
// the color of the piece being moved Color color; } Move;
C
Lucas Bailey
Are you sure programming is for you bro? It kinda requires focus.
Jace Hernandez
God no, but physics majors require a CS1 credit...
I can't focus with programming, but in math and physics I do just fine.
Ian Jackson
I guess I'm probably just going to end up doing this.
Thanks for the help guys.
Ian Stewart
Either will work, its just about understanding what method you use. I program in C++ if you have more questions.
Caleb Morris
I am a programmer. checking out this thread.
Carter Rodriguez
I dare you to find a way to differentiate diagonal pawn captures and bishop captures which are identical.
Benjamin Edwards
Well you always know whether the piece is a pawn or bishop, so that doesn't really matter...
does it?
Austin Russell
t. Big Blue
Nathaniel Brooks
Pic you?
Luke Reed
nah, that's from game grumps.
Nicholas Anderson
1. If the starting position is given: 1.1. Return the piece at that position
2. If the starting column is given: 2.1. For each space in the column: 2.1.1. Check the piece on the space 2.1.2. If it's the right piece, return that piece
3. For each row in board 3.1. For each space in row 3.1.1. Check the piece on the space 3.1.2. If it's the right piece, return that piece
Subroutine for checking a piece: 1. If the piece isn't the right type, return that it's the wrong piece 2. If the piece isn't the right colour, return that it's the wrong piece 3. If the target position is /not/ a valid move for the piece, return that it's the wrong piece 4. Return that it's the right piece