# 3D Console Game interface

• (6 Pages)
• 1
• 2
• 3
• 4
• 5
• Last »

## 85 Replies - 2466 Views - Last Post: 02 June 2017 - 02:18 PM

### #31 modi123_1

• Suitor #2

Reputation: 13401
• Posts: 53,498
• Joined: 12-June 08

## Re: 3D Console Game interface

Posted 15 May 2017 - 07:01 AM

Quote

binary values of the pieces to the various addresses

Why would you be mucking with binary and memory addresses? Why not just variables and some collection?

### #32 s23bog

Reputation: 0
• Posts: 79
• Joined: 02-May 17

## Re: 3D Console Game interface

Posted 15 May 2017 - 07:49 AM

Just offering my thoughts. You can take them for what they are.

Every coordinate is an address that can be used to store the value of the piece that occupies the space. Now, how that is done is inconsequential to me. Every address can be a unique character, as far as I am concerned, but I think the math works out better when using a coordinate system. But, I could be wrong, it might be even more effective to just look at the adresses sequentially.

### #33 s23bog

Reputation: 0
• Posts: 79
• Joined: 02-May 17

## Re: 3D Console Game interface

Posted 15 May 2017 - 10:07 AM

I currently have the output in the diamond (or eye) shape, and have removed the coordinates from the edges. It will take a fair bit to be able to recognize where things are, and to be able to perceive the cube with the current layout, but I think it may work out.

What I am going to have to do is to change how pieces are selected. When prompted for input, I want to use a getch() and read in the characters one at a time. When the first character is given, I want to highlight that plane. Then, when the second character is selected, I want to highlight he intersection of the two planes (if they intersect). When the third character is input, it should highlight the intersection of the 3 planes (a single space). A user should be able to use backspace.

Anyhow, here is how the output looks currently:

@skydiver
Is there some reason that I can't post attachments to my comments?

### #34 s23bog

Reputation: 0
• Posts: 79
• Joined: 02-May 17

## Re: 3D Console Game interface

Posted 15 May 2017 - 10:37 AM

Sorry, missed taking out a space from one of the for loops. This is better:

### #35 modi123_1

• Suitor #2

Reputation: 13401
• Posts: 53,498
• Joined: 12-June 08

## Re: 3D Console Game interface

Posted 15 May 2017 - 10:54 AM

Quote

@skydiver
Is there some reason that I can't post attachments to my comments?

This was an issue already reported and being investigated by the webmaster.

### #36 s23bog

Reputation: 0
• Posts: 79
• Joined: 02-May 17

## Re: 3D Console Game interface

Posted 15 May 2017 - 11:30 AM

modi123_1, on 15 May 2017 - 10:54 AM, said:

Quote

@skydiver
Is there some reason that I can't post attachments to my comments?

This was an issue already reported and being investigated by the webmaster.

A programmer's website is kind of like a mechanic's car.

### #37 modi123_1

• Suitor #2

Reputation: 13401
• Posts: 53,498
• Joined: 12-June 08

## Re: 3D Console Game interface

Posted 15 May 2017 - 11:36 AM

Life is complex. Situations are often different.

### #38 s23bog

Reputation: 0
• Posts: 79
• Joined: 02-May 17

## Re: 3D Console Game interface

Posted 15 May 2017 - 11:55 AM

I think that, in order to advance to the 4 dimensional variant (using dimension "w", as declared in the source), a new character set should be created. But that is a long ways off. People have spent around 1000 years on 2 dimensional chess. I reckon we would have to take some time to tackle 3 dimensional chess.

### #39 s23bog

Reputation: 0
• Posts: 79
• Joined: 02-May 17

## Re: 3D Console Game interface

Posted 15 May 2017 - 07:27 PM

Here is a link to an editable copy of the source.

Someone take a look at how this actually works, and help me figure out what this actually needs to make it usable? Actually try to move the pieces around. I can guarantee that you will find it extremely difficult to figure out.

I am talking about a minimalist approach to help one see the lines, and be able to rotate the viewing perspective.

I have been thinking along the lines of using colors to represent each of the values of 1-7. Inverse can be set over the whole field to make the pieces stand out. But it is more or less up to the user to figure out who is who on the playing field. I have reserved 25 identifiers to identify the pieces and pawns and "vacant".

Z ABCDEFG -- Player 1
Y HIJKLMN -- Player 2
X OPQRSTU -- Player 3

Plus V for "vacant".

We can work on making those cool looking later. For now, the crude lines on flat surfaces will suffice.

This post has been edited by s23bog: 15 May 2017 - 07:29 PM

### #40 modi123_1

• Suitor #2

Reputation: 13401
• Posts: 53,498
• Joined: 12-June 08

## Re: 3D Console Game interface

Posted 15 May 2017 - 07:38 PM

I'm thinking this will be moved to 'share your project'.

### #41 s23bog

Reputation: 0
• Posts: 79
• Joined: 02-May 17

## Re: 3D Console Game interface

Posted 15 May 2017 - 07:55 PM

No. Not inverse. The text color should be black. The first file of each axis is red. The second file of each axis is green. The third, yellow. Fourth, blue. Fifth, magenta. Sixth, cyan. Seventh, white.

### #42 s23bog

Reputation: 0
• Posts: 79
• Joined: 02-May 17

## Re: 3D Console Game interface

Posted 16 May 2017 - 07:47 AM

I am starting to feel a bit overwhelmed by what needs to be changed in the program. I have thought of making a list, but there is so much that needs to be done and I am unsure what order the changes need to be made.

Perhaps the most useful change would be to change the method of coordinate entry. I would prefer for the coordinates to be read one character at a time, then make the background of the planes, lines, or spaces, bold. I also would like to use the ANSI color codes corresponding to the index (+1) of the inner loop of the display function, but in order to do that, I need to completely get rid of any existing uses I have for red, green, and blue.

That means changing the main array to an array of characters, and displaying the unique character identifiers for each player/piece combination.

i.e.
ABCDEFG Z
HIJKLMN Y
OPQRSTU X

and V for Vacant

This post has been edited by s23bog: 16 May 2017 - 07:48 AM

### #43 modi123_1

• Suitor #2

Reputation: 13401
• Posts: 53,498
• Joined: 12-June 08

## Re: 3D Console Game interface

Posted 16 May 2017 - 07:49 AM

You most definitely should make a list. From that list mark what is needed for the minimal viable product.. the rest become 'gold plating'. From there you should be able to arrange tasks in some semi sequential needs.. else, at worst, you have an awesome list of tick off work.

### #44 s23bog

Reputation: 0
• Posts: 79
• Joined: 02-May 17

## Re: 3D Console Game interface

Posted 16 May 2017 - 08:12 AM

Perhaps it is worthwhile to consider rewriting the whole thing, and just borrowing bits and pieces of the current version.
a-
I definitely need to get away from using an array of integers to store the contents of the playingSpace. That also entails getting rid of the current method of highlighting possible moves. I can implement vector searches later.

Change playingField array of integers to playingSpace array of characters.
Assign piece type to the various piece identifiers (ABCDEFGZ,HIJKLMNY,OPQRSTUX).
Change human (and parts of computer) coordinate system to use a-u instead of 1-7.
Change coordinate input to one character at a time with visual indication of which planes are selected.
Change perspective views depending upon whose turn it is.
Allow for user to select from multiple perspective views?
Before and after each move, calculate all possible moves for each player/piece, and analyze for checks.
Have possible move highlighting come from checks against complete moveList.

### #45 s23bog

Reputation: 0
• Posts: 79
• Joined: 02-May 17

## Re: 3D Console Game interface

Posted 16 May 2017 - 09:44 AM

I want to be able to go through the various planes from either the beginning, or the end. If I were to use the letters a-g for zPlanes, h-n for yPlanes, and o-u for xPlanes, I could use a range based for loop, and just reverse the strings zPlanes, yPlanes, and/or xPlanes as I see fit. There is a bit of math used in the for loops, but I think that can be overcome by calling for the planes by index, in some situations.

Then, when I call the element of the playingSpace array, I would have to convert the characters from the [xyz]Planes arrays into their indices.

Unless ....

a+1=b
b+1=c, etc.

Still would have to convert to the indices of the planes arrays when using them to call the element from the playingSpace array.

Is there a way to say ...

cout << playingSpace [d] [k] [r];

where d, k, and r are the 4th index of each dimension?

I played around with using enums, but didn't like that. I want d to only be usable for the 4th z plane. It winds up converting the d to a 3 and it winds up being equal to k.

Am I making any sense, at all?