Removing integers from another player

Ok, so this code here works and runs fine. The only thing is that I am trying to figure out a way to remover integers inputed by either player 1 or player 2 (also known as their stones). But, you can only remove these stones if you have three integers in a row (a mill). So, I just need to know what you can or have to use in order to be able to remover integers of an other player off of the board



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
#include <iostream>
#include <Windows.h>
char gameboard (short);
void board();
int main()
{

	using namespace std;
	short boardn[24] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; 
	short in;
	short playernum = 1;
	for(int i=0; i<19; i++)
	{
		cout << "         MALOM" << endl;
		cout << gameboard(boardn[0]) << "----------" << gameboard(boardn[1]) << "----------" << gameboard(boardn[2]) << "    1  2  3" << endl;
		cout <<"|          |          |" << endl;
		cout <<"|          |          |" << endl;
		cout <<"|   "<< gameboard(boardn[3]) << "------" << gameboard(boardn[4]) << "------" << gameboard(boardn[5]) <<"   |" << "    4  5  6" << endl;
		cout <<"|   |      |      |   |" << endl;
		cout <<"|   |      |      |   |" << endl;
		cout <<"|" "   |    " << gameboard(boardn[6]) << "-" << gameboard(boardn[7]) << "-" << gameboard(boardn[8]) <<    "    |"   "   |" << "    7  8  9" << endl;
		cout <<"|   |    |   |    |   |" << endl;
		cout << gameboard(boardn[9]) << "---" << gameboard(boardn[10]) << "----" << gameboard(boardn[11]) << "   " << gameboard(boardn[12]) <<"----" << gameboard(boardn[13]) << "---" << gameboard(boardn[14]) << "    10 11 12    13 14 15" << endl;
		cout <<"|   |    |   |    |   |" << endl;
		cout <<"|" "   |    " << gameboard(boardn[15]) << "-" << gameboard(boardn[16]) << "-" << gameboard(boardn[17]) <<    "    |"   "   |" << "    16 17 18" << endl;
		cout <<"|   |      |      |   |" << endl;
		cout <<"|   |      |      |   |" << endl;	
		cout <<"|   "<< gameboard(boardn[18]) << "------" << gameboard(boardn[19]) << "------" << gameboard(boardn[20]) <<"   |" << "    19 20 21" << endl;
		cout <<"|          |          |" << endl;
		cout <<"|          |          |" << endl;
		cout << gameboard(boardn[21]) << "----------" << gameboard(boardn[22]) << "----------" << gameboard(boardn[23]) << "    22 23 24" << endl;
		cout << endl;		
		cout << "________________________________________________________________________________";
		cout << "The numbers to the right of the board correspond to the placement of a stone on the board."  << endl;
		cout << "Please select the placement of your stone. Player # " << playernum <<endl;
		cin >> in;
		boardn[in-1] = playernum;
		if (in > 24)
		{
			SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),4);
			cout << "Illegal move please re-enter a number that is between 1-24. \a" << endl;	
			SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),7);
		}
		if (in < 0)
		{
			SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),4);
			cout << "Illegal move please re-enter a number that is between 1-24. \a" << endl;	
			SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),7);
		}
		else 
			playernum = playernum == 2 ? 1 : 2;


	}
	board();
	int choice;
	cin >> choice;
	while (choice!= gameboard(boardn[0]), gameboard(boardn[1]), gameboard(boardn[2]), gameboard(boardn[3]), gameboard(boardn[4]), gameboard(boardn[5]), gameboard(boardn[6]), gameboard(boardn[7]), gameboard(boardn[8]), gameboard(boardn[9]), gameboard(boardn[10]), gameboard(boardn[11]), gameboard(boardn[12]), gameboard(boardn[13]), gameboard(boardn[14]), gameboard(boardn[15]), gameboard(boardn[16]), gameboard(boardn[17]), gameboard(boardn[18]), gameboard(boardn[19]), gameboard(boardn[20]), gameboard(boardn[21]), gameboard(boardn[22]), gameboard(boardn[23]))
	{
		short a;
		switch (choice)
		{
		case 1: 
			a = '0';
				break;
		case 2: 
			a = '1';
				break;
		case 3:
			a = '2';
				break;
		case 4:  
			a = '3';
				break;
		case 5:
			a = '4';
				break;
		case 6: 
			a = '5';
				break;
		case 7: 
			a = '6';
				break;
		case 8:  
			a = '7';
				break;
		case 9: 
			a = '8';
				break;
		case 10:  
			a = '9';
				break;
		case 11:  
			a = '10';
				break;
		case 12:  
			a = '11';
				break;
		case 13:  
			a = '12';
				break;
		case 14:  
			a = '13';
				break;
		case 15:  
			a = '14';
				break;
		case 16:  
			a = '15';
				break;
		case 17:  
			a = '16';
				break;
		case 18:  
			a = '17';
				break;
		case 19:  
			a = '18';
				break;
		case 20:  
			a = '19';
				break;
		case 21:  
			a = '20';
				break;
		case 22:  
			a = '21';
				break;
		case 23:  
			a = '22';
				break;
		case 24:  
			a = '23';
				break;
		}
		board();
		cin >> choice;
	};
	short a;
	return a;

}
void board()
{

	using namespace std;
	cout << " If you have three stones in a row, you have a mill!" <<endl;
	return;

};



char gameboard (short a)
{
	char b;
	switch(a)
	{
	case 0:
		b = 'X';
		break;
	case 1:
		b = '1';
		break;
	case 2:
		b = '2';
		break;
	};
	return b;
}


Oh my god...there are so many logic errors in there I can't even begin to help you. Please go draw a flowchart or something and make a program based off that...
I think lines 61-135 are the worst thing I've seen in my life. They almost seem to scream "whoever wrote us completely missed the point of programming".
Since BrianM is obviously a new programmer, and doesn't know all of the idioms you all know, why bother posting

"AAArrrrrgghhh! Yur k0de is CRAP"

? Instead, please post some constructive help. Like:

Lines 61-135 could be replaced with:
 
short a = (choice - 1) + '0';

If you want to know if things are in a row, you'll need to write a little function to tell you whether or not that is the case. That is, how about a function that indicates something like
bool in_a_row( int column_number );
where given the column number, determine whether or not all the other columns in the row have the same value as the argument column.

Hope this helps.
Thank you very much duoas, and the reason the code was so long is cuz it is a partner project, and my partner wrote that part...
OK well, I tried replacing lines 65-135
OK the first part that you told me to write in works flawlessly, so the
bool in_a_row( int column_number );
is a function correct?
It is a function prototype. You need to write the body.
Topic archived. No new replies allowed.