Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.programming > #6735

Re: Feedback on sudoku solver and count-the-squares solver?

Path csiph.com!news.mixmin.net!news.albasani.net!.POSTED!not-for-mail
From root <NoEMail@home.org>
Newsgroups comp.programming
Subject Re: Feedback on sudoku solver and count-the-squares solver?
Date Mon, 18 Jul 2016 14:24:24 +0000 (UTC)
Organization Linux Advocacy
Lines 91
Message-ID <nmioqo$9rr$2@news.albasani.net> (permalink)
References <bc6924b2-51f3-476d-b06c-2c235de57086@googlegroups.com> <nmgeg3$34q$1@news.albasani.net> <eddf769d-f966-4f0a-a2ff-69caddb64d91@googlegroups.com> <nmh6tr$2l5$1@news.albasani.net> <9a5c4ff5-a322-4c84-94f7-e7b2a10b9d0a@googlegroups.com>
X-Trace news.albasani.net JXWzXnzmROXu/8bEq3Pzz769DadpsBSpnTR5/tiEbNjeijWDFBnWA1t9QRJv6DCuQj5V264r2GsTaMKyMq+0jJY5lq/SMEzYq1RVRXBxxPHmUzx4nGypg/ZxyG2iHwpU
NNTP-Posting-Date Mon, 18 Jul 2016 14:24:24 +0000 (UTC)
Injection-Info news.albasani.net; logging-data="VhHkgOvayDmiFWWcFLprdKSiSCYKInCqrAEUz9e8gSiNrm3smPuuvh+sY9SfwPV5st/zuQnxxigP9Z2BqedLwA1bkILMIz5H67I8UdDRZ2nVUzqAdgoaV5EbeHr/wAWb"; mail-complaints-to="abuse@albasani.net"
User-Agent slrn/1.0.2 (Linux)
Cancel-Lock sha1:ut5XY0pBez64X5HnrW/DDldBYzk=
Xref csiph.com comp.programming:6735

Show key headers only | View raw


Paul <pepstein5@gmail.com> wrote:
> On Monday, July 18, 2016 at 1:12:46 AM UTC+1, root wrote:
>> Paul <pepstein5@gmail.com> wrote:
>> > On Sunday, July 17, 2016 at 6:15:50 PM UTC+1, root wrote:
>> >> Paul <pepstein5@gmail.com> wrote:
>> >> > I have a sudoku solver in c++ here -- https://github.com/pauldepstein/Sudoku/blob/master/SudokuSolverWithHardestEver.cpp
>> >> >
>> >> > and I also have code for solving "count the squares" problems.  This is solved and tested here: https://github.com/pauldepstein/CountSquares/blob/master/CountSquares.cpp  However, most of the lines of code involve setting up the example.
>> >> >
>> >> > Any feedback would be welcome.
>> >> >
>> >> > Thanks,
>> >> >
>> >> > Paul
>> >> 
>> >> Feedback: your sudoku solver will not compile using gcc 5.3.0
>> >
>> > Do you have C++11 enabled?
>> >
>> > Paul
>> 
>> I have c++14
>
> What error message do you get?
>
> Paul

I,m sorry Paul, but there were 302 lines of error messages. Here is a sample:
In file included from /usr/include/c++/5.3.0/unordered_map:35:0,
                 from sudokusolver.cpp:12:
/usr/include/c++/5.3.0/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 c #error This file requires compiler and library support for the \
  ^
sudokusolver.cpp:137:115: error: 'std::unordered_map' has not been declared
  bool consistent(int digit, const std::pair<int, int>& location, const std::vector<std::vector<int> >& grid, std::unordered_map<int, std::vector<std::pair<int, int> > >& record, int subgridSize = 3)
                                                                                                                   ^
sudokusolver.cpp:137:128: error: expected ',' or '...' before '<' token
  bool consistent(int digit, const std::pair<int, int>& location, const std::vector<std::vector<int> >& grid, std::unordered_map<int, std::vector<std::pair<int, int> > >& record, int subgridSize = 3)
                                                                                                                                ^
sudokusolver.cpp: In function 'bool consistent(int, const std::pair<int, int>&, const std::vector<std::vector<int> >&, int)':
sudokusolver.cpp:139:7: error: 'column' does not name a type
  auto column = record[digit];
       ^
sudokusolver.cpp:140:21: error: 'column' was not declared in this scope
  for(int i = 0; i < column.size(); ++i)
                     ^
sudokusolver.cpp:141:38: error: 'subgridSize' was not declared in this scope
  if(!consistent(location, column[i], subgridSize))
                                      ^
sudokusolver.cpp: In function 'std::vector<std::vector<int> > createTestGrid()':
sudokusolver.cpp:178:61: error: in C++98 'grid' must be initialized by constructor, not by '{...}'
  {0,0,1,0,0,0,0,6,8},{0,0,8,5,0,0,0,1,0},{0,9,0,0,0,0,4,0,0}};
                                                             ^
sudokusolver.cpp:178:61: error: could not convert '{{8, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 3, 6, 0, 0, 0, 0, 0}, {0, 7, 0, 0, 9, 0, 2, 0, 0}, {0, 5, 0, 0, 0, 7, 0, 0, 0}, {0, 0, 0, 0, 4, 5, 7, 0, 0}, {0, 0, 0, 1, 0, 0, 0, 3, 0}, {0, 0, 1, 0, 0sudokusolver.cpp: At global scope:
sudokusolver.cpp:230:7: error: 'unordered_map' in namespace 'std' does not name a template type
  std::unordered_map<int, std::vector<std::pair<int, int> > >occurrences(const std::vector<std::vector<int> >& grid)
       ^
sudokusolver.cpp:257:107: error: 'std::unordered_map' has not been declared
  std::vector<int> options(const std::pair<int, int>& location, std::vector<std::vector<int> >& grid, std::unordered_map<int, std::vector<std::pair<int, int> > >& record, int subgridSize = 3)
                                                                                                           ^
sudokusolver.cpp:257:120: error: expected ',' or '...' before '<' token
  std::vector<int> options(const std::pair<int, int>& location, std::vector<std::vector<int> >& grid, std::unordered_map<int, std::vector<std::pair<int, int> > >& record, int subgridSize = 3)
                                                                                                                        ^
sudokusolver.cpp: In function 'std::vector<int> options(const std::pair<int, int>&, std::vector<std::vector<int> >&, int)':
sudokusolver.cpp:268:37: error: 'record' was not declared in this scope
  if(consistent(val, location, grid, record, subgridSize))
                                     ^
sudokusolver.cpp:268:45: error: 'subgridSize' was not declared in this scope
  if(consistent(val, location, grid, record, subgridSize))
                                             ^
sudokusolver.cpp: At global scope:
sudokusolver.cpp:283:133: error: 'std::unordered_map' has not been declared
  std::list< std::pair<int, int> >::iterator min(std::vector<std::vector<int> >& grid, std::list<std::pair<int, int> >& blanks, std::unordered_map<int, std::vector<std::pair<int, int> > >& record, bool& nonEmpty, int subgridSize = 3)
                                                                                                                                     ^
sudokusolver.cpp:283:146: error: expected ',' or '...' before '<' token
  std::list< std::pair<int, int> >::iterator min(std::vector<std::vector<int> >& grid, std::list<std::pair<int, int> >& blanks, std::unordered_map<int, std::vector<std::pair<int, int> > >& record, bool& nonEmpty, int subgridSize = 3)
                                                                                                                                                  ^
sudokusolver.cpp: In function 'std::list<std::pair<int, int> >::iterator min(std::vector<std::vector<int> >&, std::list<std::pair<int, int> >&, int)':
sudokusolver.cpp:286:7: error: 'iter' does not name a type
  auto iter = blanks.begin();
       ^
sudokusolver.cpp:287:7: error: 'currentMin' does not name a type
  auto currentMin = iter;
       ^
sudokusolver.cpp:288:8: error: 'iter' was not declared in this scope



My command line was:
gcc sudokusolver.cpp -o sudokusolver

I am running Slackware64-multilib 14.2

Back to comp.programming | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Feedback on sudoku solver and count-the-squares solver? Paul <pepstein5@gmail.com> - 2016-07-17 09:43 -0700
  Re: Feedback on sudoku solver and count-the-squares solver? root <NoEMail@home.org> - 2016-07-17 17:15 +0000
    Re: Feedback on sudoku solver and count-the-squares solver? Paul <pepstein5@gmail.com> - 2016-07-17 11:32 -0700
      Re: Feedback on sudoku solver and count-the-squares solver? root <NoEMail@home.org> - 2016-07-18 00:12 +0000
        Re: Feedback on sudoku solver and count-the-squares solver? Paul <pepstein5@gmail.com> - 2016-07-17 23:53 -0700
          Re: Feedback on sudoku solver and count-the-squares solver? root <NoEMail@home.org> - 2016-07-18 14:24 +0000
            Re: Feedback on sudoku solver and count-the-squares solver? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-07-18 17:02 +0100
              Re: Feedback on sudoku solver and count-the-squares solver? root <NoEMail@home.org> - 2016-07-18 16:51 +0000
            Re: Feedback on sudoku solver and count-the-squares solver? Paul <pepstein5@gmail.com> - 2016-07-18 09:03 -0700
              Re: Feedback on sudoku solver and count-the-squares solver? Paul <pepstein5@gmail.com> - 2016-07-18 09:05 -0700

csiph-web