Friday, November 17, 2017

Digest for comp.lang.c++@googlegroups.com - 12 updates in 5 topics

markgaffney211@gmail.com: Nov 16 05:37PM -0800

I need help with setting up my board
So far I got my enums, but need help with my array set up
woodbrian77@gmail.com: Nov 16 06:31PM -0800

> I need help with setting up my board
> So far I got my enums, but need help with my array set up
 
Duckduckgo is your friend:
 
https://duckduckgo.com/?q=c%2B%2B+stratego&t=hf&ia=images
 
 
Brian
Ebenezer Enterprises
http://webEbenezer.net
"Öö Tiib" <ootiib@hot.ee>: Nov 16 08:37PM -0800

> I need help with setting up my board
> So far I got my enums, but need help with my array set up
 
It is quite impossible for us to see what difficulties you
face with that array of that board.
 
If you have difficulty (lets say) to declare array of (lets say)
100 (lets say) Positions as board then you can do it like that:
 
std::array<Position,100> board;
 
However that answer is based on too lot of guessing and so it
might be not what you need. You need to put more effort into
showing what you have and what difficulty you have with it.
Jorgen Grahn <grahn+nntp@snipabacken.se>: Nov 17 06:26AM

On Fri, 2017-11-17, Öö Tiib wrote:
 
> However that answer is based on too lot of guessing and so it
> might be not what you need. You need to put more effort into
> showing what you have and what difficulty you have with it.
 
Also we don't know what he's going to use this Stratego board for (AI
player? two-player? something entirely different?), and many (well, me
at least) are unfamiliar with the rules of Stratego.
 
(I see on Wikipedia it's 10x10 squares, but I didn't learn the rules
of movement.)
 
Two questions which may be useful:
- Is the Board object distinct from the game being played on that
Board? Does the Board or the Game, or neither, own the playing pieces?
- What are the properties of a Board object?
 
/Jorgen
 
--
// Jorgen Grahn <grahn@ Oo o. . .
\X/ snipabacken.se> O o .
leigh.v.johnston@googlemail.com: Nov 17 04:38AM -0800

Sane people use Google for search or at a push Bing.
 
/Leigh
woodbrian77@gmail.com: Nov 17 09:05AM -0800

> Sane people use Google for search or at a push Bing.
 
Duckduckgo keeps growing:
 
https://en.wikipedia.org/wiki/DuckDuckGo#History
 
It's one of the things I'm thankful for along with
family, friends, health, kosher work and food.
 
 
Brian
Ebenezer Enterprises - Enjoying programming again.
http://webEbenezer.net
Rick C Hodgin <rickchodginjesus@gmail.com>: Nov 17 07:19AM -0800

On Wednesday, November 15, 2017 at 5:09:52 AM UTC+8, Vir Campestris wrote:
 
> In the real code beta handles inter-object communication, and may
> receive signals from other threads.
 
> Andy
 
A request for each of you
 
Original post : https://groups.google.com/forum/#!topic/alt.os.development/nvGbmY74C-4
 
 
To my fellow "Usenet group"ies:
 
I come before you today with a request for each of you. I ask
you to give it an ear and ponder it in your heart. Consider it
for a time each day and think about what it means to the baseline
fundamental views we hold in our lives.
 
-----
My request is that you consider what this means to your self-
image: You were created. You do have a purpose. You were not
an accident of random chance in this universe. You were, instead,
specifically and purposefully hand-crafted by God, hand-placed
into this world where you are, with a purpose to have a real im-
pact upon this world. To further realize that within the creation
of your existence, the one creating you had a real purpose in do
doing. God created you with a goal of certain things He wants you
to do in this world, for example.
 
Think about this idea: That you were created, that you do have a
real purpose, and that you will go on after you leave this world,
and that you do have a choice today regarding how you will live
your life, and that the warning given you by your very creator is
that there is a real enemy here in this world, responsible for all
that we see wrong here, who seeks to mislead you, trick you, trap
you, and ultimately destroy your soul by leading you away from God,
but if you will give God an ear, and stop hardening your heart
toward Him, that He will guide you not only to safety in this world,
but to the fullest, richest prosperity in Him.
 
Think about this. Read it a few times. Make sure you get a clear
understanding: You were created specifically by God. You have a
real purpose, and there are two paths before you: one leading to
forgiveness for the wrong you've done, to be a part of God's plan
for your life, one that keeps you unforgiven in the wrong you've
done and is leading away from God and God's plan for your life.
 
-----
God created you for greatness. He loves you. He will lead and
guide and protect and save you from all evil. But He also honors
you too much to violate His greatest gift to you: your volition.
He will not violate your free will to choose. But look into Him
and see how He's revealed Himself through His Son. The Bible
gives us a view of God that explains things in a way which really
resonates on the inside if you're willing to receive it. But if
you harden your heart, it will always only be a book of laughable
tales and fantasies.
 
The choice is yours, but the truth speaks to you. You were God's
creation. You were made special. You do have a purpose. And
you will go on after you leave this world. God has a plan for you
and will save you from everything bad, and give you a real and
secure future that dwells in fullest, richest prosperity for you,
His beloved and held dear, most special creation.
 
Thank you,
Rick C. Hodgin
Rick C Hodgin <rickchodginjesus@gmail.com>: Nov 17 07:19AM -0800

On Thursday, November 16, 2017 at 11:08:42 PM UTC+8, Rick C. Hodgin wrote:
 
> https://groups.google.com/d/msg/comp.lang.c++/X9lgo_CquUc/I_-pAWvuAAAJ
 
> --
> Rick C. Hodgin
 
A request for each of you
 
Original post : https://groups.google.com/forum/#!topic/alt.os.development/nvGbmY74C-4
 
 
To my fellow "Usenet group"ies:
 
I come before you today with a request for each of you. I ask
you to give it an ear and ponder it in your heart. Consider it
for a time each day and think about what it means to the baseline
fundamental views we hold in our lives.
 
-----
My request is that you consider what this means to your self-
image: You were created. You do have a purpose. You were not
an accident of random chance in this universe. You were, instead,
specifically and purposefully hand-crafted by God, hand-placed
into this world where you are, with a purpose to have a real im-
pact upon this world. To further realize that within the creation
of your existence, the one creating you had a real purpose in do
doing. God created you with a goal of certain things He wants you
to do in this world, for example.
 
Think about this idea: That you were created, that you do have a
real purpose, and that you will go on after you leave this world,
and that you do have a choice today regarding how you will live
your life, and that the warning given you by your very creator is
that there is a real enemy here in this world, responsible for all
that we see wrong here, who seeks to mislead you, trick you, trap
you, and ultimately destroy your soul by leading you away from God,
but if you will give God an ear, and stop hardening your heart
toward Him, that He will guide you not only to safety in this world,
but to the fullest, richest prosperity in Him.
 
Think about this. Read it a few times. Make sure you get a clear
understanding: You were created specifically by God. You have a
real purpose, and there are two paths before you: one leading to
forgiveness for the wrong you've done, to be a part of God's plan
for your life, one that keeps you unforgiven in the wrong you've
done and is leading away from God and God's plan for your life.
 
-----
God created you for greatness. He loves you. He will lead and
guide and protect and save you from all evil. But He also honors
you too much to violate His greatest gift to you: your volition.
He will not violate your free will to choose. But look into Him
and see how He's revealed Himself through His Son. The Bible
gives us a view of God that explains things in a way which really
resonates on the inside if you're willing to receive it. But if
you harden your heart, it will always only be a book of laughable
tales and fantasies.
 
The choice is yours, but the truth speaks to you. You were God's
creation. You were made special. You do have a purpose. And
you will go on after you leave this world. God has a plan for you
and will save you from everything bad, and give you a real and
secure future that dwells in fullest, richest prosperity for you,
His beloved and held dear, most special creation.
 
Thank you,
Rick C. Hodgin
Rick C Hodgin <rickchodginjesus@gmail.com>: Nov 17 07:18AM -0800

A request for each of you
 
Original post : https://groups.google.com/forum/#!topic/alt.os.development/nvGbmY74C-4
 
 
To my fellow "Usenet group"ies:
 
I come before you today with a request for each of you. I ask
you to give it an ear and ponder it in your heart. Consider it
for a time each day and think about what it means to the baseline
fundamental views we hold in our lives.
 
-----
My request is that you consider what this means to your self-
image: You were created. You do have a purpose. You were not
an accident of random chance in this universe. You were, instead,
specifically and purposefully hand-crafted by God, hand-placed
into this world where you are, with a purpose to have a real im-
pact upon this world. To further realize that within the creation
of your existence, the one creating you had a real purpose in do
doing. God created you with a goal of certain things He wants you
to do in this world, for example.
 
Think about this idea: That you were created, that you do have a
real purpose, and that you will go on after you leave this world,
and that you do have a choice today regarding how you will live
your life, and that the warning given you by your very creator is
that there is a real enemy here in this world, responsible for all
that we see wrong here, who seeks to mislead you, trick you, trap
you, and ultimately destroy your soul by leading you away from God,
but if you will give God an ear, and stop hardening your heart
toward Him, that He will guide you not only to safety in this world,
but to the fullest, richest prosperity in Him.
 
Think about this. Read it a few times. Make sure you get a clear
understanding: You were created specifically by God. You have a
real purpose, and there are two paths before you: one leading to
forgiveness for the wrong you've done, to be a part of God's plan
for your life, one that keeps you unforgiven in the wrong you've
done and is leading away from God and God's plan for your life.
 
-----
God created you for greatness. He loves you. He will lead and
guide and protect and save you from all evil. But He also honors
you too much to violate His greatest gift to you: your volition.
He will not violate your free will to choose. But look into Him
and see how He's revealed Himself through His Son. The Bible
gives us a view of God that explains things in a way which really
resonates on the inside if you're willing to receive it. But if
you harden your heart, it will always only be a book of laughable
tales and fantasies.
 
The choice is yours, but the truth speaks to you. You were God's
creation. You were made special. You do have a purpose. And
you will go on after you leave this world. God has a plan for you
and will save you from everything bad, and give you a real and
secure future that dwells in fullest, richest prosperity for you,
His beloved and held dear, most special creation.
 
Thank you,
Rick C. Hodgin
Rick C Hodgin <rickchodginjesus@gmail.com>: Nov 17 07:18AM -0800

A request for each of you
 
Original post : https://groups.google.com/forum/#!topic/alt.os.development/nvGbmY74C-4
 
 
To my fellow "Usenet group"ies:
 
I come before you today with a request for each of you. I ask
you to give it an ear and ponder it in your heart. Consider it
for a time each day and think about what it means to the baseline
fundamental views we hold in our lives.
 
-----
My request is that you consider what this means to your self-
image: You were created. You do have a purpose. You were not
an accident of random chance in this universe. You were, instead,
specifically and purposefully hand-crafted by God, hand-placed
into this world where you are, with a purpose to have a real im-
pact upon this world. To further realize that within the creation
of your existence, the one creating you had a real purpose in do
doing. God created you with a goal of certain things He wants you
to do in this world, for example.
 
Think about this idea: That you were created, that you do have a
real purpose, and that you will go on after you leave this world,
and that you do have a choice today regarding how you will live
your life, and that the warning given you by your very creator is
that there is a real enemy here in this world, responsible for all
that we see wrong here, who seeks to mislead you, trick you, trap
you, and ultimately destroy your soul by leading you away from God,
but if you will give God an ear, and stop hardening your heart
toward Him, that He will guide you not only to safety in this world,
but to the fullest, richest prosperity in Him.
 
Think about this. Read it a few times. Make sure you get a clear
understanding: You were created specifically by God. You have a
real purpose, and there are two paths before you: one leading to
forgiveness for the wrong you've done, to be a part of God's plan
for your life, one that keeps you unforgiven in the wrong you've
done and is leading away from God and God's plan for your life.
 
-----
God created you for greatness. He loves you. He will lead and
guide and protect and save you from all evil. But He also honors
you too much to violate His greatest gift to you: your volition.
He will not violate your free will to choose. But look into Him
and see how He's revealed Himself through His Son. The Bible
gives us a view of God that explains things in a way which really
resonates on the inside if you're willing to receive it. But if
you harden your heart, it will always only be a book of laughable
tales and fantasies.
 
The choice is yours, but the truth speaks to you. You were God's
creation. You were made special. You do have a purpose. And
you will go on after you leave this world. God has a plan for you
and will save you from everything bad, and give you a real and
secure future that dwells in fullest, richest prosperity for you,
His beloved and held dear, most special creation.
 
Thank you,
Rick C. Hodgin
Rick C Hodgin <rickchodginjesus@gmail.com>: Nov 17 07:19AM -0800

A request for each of you
 
Original post : https://groups.google.com/forum/#!topic/alt.os.development/nvGbmY74C-4
 
 
To my fellow "Usenet group"ies:
 
I come before you today with a request for each of you. I ask
you to give it an ear and ponder it in your heart. Consider it
for a time each day and think about what it means to the baseline
fundamental views we hold in our lives.
 
-----
My request is that you consider what this means to your self-
image: You were created. You do have a purpose. You were not
an accident of random chance in this universe. You were, instead,
specifically and purposefully hand-crafted by God, hand-placed
into this world where you are, with a purpose to have a real im-
pact upon this world. To further realize that within the creation
of your existence, the one creating you had a real purpose in do
doing. God created you with a goal of certain things He wants you
to do in this world, for example.
 
Think about this idea: That you were created, that you do have a
real purpose, and that you will go on after you leave this world,
and that you do have a choice today regarding how you will live
your life, and that the warning given you by your very creator is
that there is a real enemy here in this world, responsible for all
that we see wrong here, who seeks to mislead you, trick you, trap
you, and ultimately destroy your soul by leading you away from God,
but if you will give God an ear, and stop hardening your heart
toward Him, that He will guide you not only to safety in this world,
but to the fullest, richest prosperity in Him.
 
Think about this. Read it a few times. Make sure you get a clear
understanding: You were created specifically by God. You have a
real purpose, and there are two paths before you: one leading to
forgiveness for the wrong you've done, to be a part of God's plan
for your life, one that keeps you unforgiven in the wrong you've
done and is leading away from God and God's plan for your life.
 
-----
God created you for greatness. He loves you. He will lead and
guide and protect and save you from all evil. But He also honors
you too much to violate His greatest gift to you: your volition.
He will not violate your free will to choose. But look into Him
and see how He's revealed Himself through His Son. The Bible
gives us a view of God that explains things in a way which really
resonates on the inside if you're willing to receive it. But if
you harden your heart, it will always only be a book of laughable
tales and fantasies.
 
The choice is yours, but the truth speaks to you. You were God's
creation. You were made special. You do have a purpose. And
you will go on after you leave this world. God has a plan for you
and will save you from everything bad, and give you a real and
secure future that dwells in fullest, richest prosperity for you,
His beloved and held dear, most special creation.
 
Thank you,
Rick C. Hodgin
ram@zedat.fu-berlin.de (Stefan Ram): Nov 17 02:09PM

>I need help with setting up my board
>So far I got my enums, but need help with my array set up
 
I have written a program that finds solutions to the
eight-queens problem. It uses a board. Maybe you can
get some ideas from it?
 
#include <algorithm>
#include <array>
#include <cassert>
#include <iostream>
#include <ostream>
#include <string>
#include <vector>
 
using position_type = int;
using direction_type = int;
 
static ::std::array< direction_type const, 8 >directions{ 0, 1, 2, 3, 4, 5, 6, 7 };
 
static ::std::array< int const, 8 >offset_y_of_direction{ +1, +1, 0, -1, -1, -1, 0, +1 };
static ::std::array< int const, 8 >offset_x_of_direction{ 0, +1, +1, +1, 0, -1, -1, -1 };
 
struct board_type : public ::std::vector< position_type >
{
 
using ::std::vector< position_type >::vector;
 
board_type(): board_type( 64 ){}
int is_occupied( int const y, int const x ) const
{ return this->at( y * 8 + x ); }
 
void set_queen_at( position_type const position )
{ assert( !this->at( position ));
this->at( position )= 1; }
 
void remove_queen_at( position_type const position )
{ assert( this->at( position ));
this->at( position )= 0; }
 
bool is_in_board( int const position ) const
{ return( unsigned )position < 64u; }
 
bool is_in_board( int const y, int const x ) const
{ return( unsigned )y < 8u &&( unsigned )x < 8u; }
 
bool out_of_board( int const y, int const x ) const
{ return !is_in_board( y, x ); }
 
bool there_is_a_conflict_at_in_direction
( int pos_y, int pos_x, int const dy, int const dx ) const
{ for( int distance = 0;; ++distance )
{ pos_y += dy; pos_x += dx;
if( out_of_board( pos_y, pos_x ))return false;
if( is_occupied( pos_y, pos_x ))return true; }}
 
bool there_is_a_conflict_at_in_direction
( int const position_y, int const position_x,
direction_type const direction ) const
{ return there_is_a_conflict_at_in_direction
( position_y, position_x,
offset_y_of_direction.at( direction ), offset_x_of_direction.at( direction )); }
 
bool there_is_a_conflict_with_other_position_at
( int const position_y, int const position_x ) const
{ for( direction_type const direction : directions )
if( there_is_a_conflict_at_in_direction( position_y, position_x, direction ))return true;
return false; }
 
bool there_is_a_conflict_with_other_position_at( position_type const position ) const
{ return there_is_a_conflict_with_other_position_at( position / 8, position % 8 ); }
 
bool there_is_a_conflict_with_this_position_at( position_type const position ) const
{ return this->at( position ); }
 
bool there_is_a_conflict_at( position_type const position ) const
{ assert( is_in_board( position ));
if( there_is_a_conflict_with_this_position_at( position ))return true;
return there_is_a_conflict_with_other_position_at( position ); }
 
bool there_is_no_conflict_at( position_type const position ) const
{ return !there_is_a_conflict_at( position ); }
 
void print_cell_at( int const row, int const col ) const
{ ::std::cout <<( is_occupied( row, col )? 'W' : ':' ); }
 
void print_end_of_line() const
{ ::std::cout << '\n'; }
 
void print_all_cells_of( int const row ) const
{ for( int col = 0; col < 8; ++col )print_cell_at( row, col );
print_end_of_line(); }
 
void print_all_rows() const
{ for( int row = 8; row > 0; ){ --row; print_all_cells_of( row ); }}
 
void print() const
{ print_all_rows(); }};
 
static void print_board_number()
{ static int n = 0; ::std::cout << n++ << '\n'; }
 
static void print_end_of_line()
{ ::std::cout << '\n'; }
 
static void print( board_type const & board )
{ print_board_number(); board.print(); print_end_of_line(); }
 
struct place_eight_queens
{
 
int number_of_current_queen;
board_type board;
 
void print_solution_or_set_next_queen_at( position_type const position )
{ if( 7 == number_of_current_queen )print( board ); else
{ position_type const first_position_of_next_row =
( static_cast< int >( position )/ 8 + 1 )* 8;
place_next_queen_starting_at( first_position_of_next_row ); }}
 
void place_queen_at( position_type const position )
{ board.set_queen_at( position );
print_solution_or_set_next_queen_at( position );
board.remove_queen_at( position ); }
 
void place_queen_if_no_conflict_at( position_type const position )
{ if( board.there_is_no_conflict_at( position ))
place_queen_at( position ); }
 
void try_all_positions_starting_at( int const starting_position )
{ for( position_type position = starting_position; position < board.size(); ++position )
place_queen_if_no_conflict_at( position ); }
 
void place_next_queen_starting_at( int const starting_position )
{ ++number_of_current_queen;
try_all_positions_starting_at( starting_position );
number_of_current_queen--; }
 
void place_queens()
{ number_of_current_queen = -1;
int const starting_position = 0;
place_next_queen_starting_at( starting_position ); }
 
void run() { place_queens(); }};
 
int main() { ::place_eight_queens{}.run(); }
 
transcript
 
0
 
:::W::::
:W::::::
::::::W:
::W:::::
:::::W::
:::::::W
::::W:::
W:::::::
 
...
You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page.
To unsubscribe from this group and stop receiving emails from it send an email to comp.lang.c+++unsubscribe@googlegroups.com.

No comments: