Turn on thread page Beta
    • Thread Starter
    Offline

    19
    ReputationRep:
    Hey!

    So we've started learning c++ only recently so Im still bit new to the syntax and they've given a coursework about making a sudoku game which I'm finding incredibly hard to get my head around it.

    Anyone a bit of a wise owl in the subject ? Then I can go into the deets!
    Thanks!
    Offline

    3
    ReputationRep:
    Sure why not. I'm good at C++. What are you struggling with?
    • Thread Starter
    Offline

    19
    ReputationRep:
    (Original post by BobBobson)
    Sure why not. I'm good at C++. What are you struggling with?
    So, I'm using a 3D vector to make the puzzle. But I'm struggling with the algorithm for setting the value inside square in the board and removing all the other same values from the other boxes.

    So I'm making a vector1<vector2<vector3<int> > > as the board.
    Vector 3 is the values till 9 and then Im trying to remove all the other possibilities when 1 no. is selected.
    Offline

    3
    ReputationRep:
    (Original post by a9493r)
    So, I'm using a 3D vector to make the puzzle. But I'm struggling with the algorithm for setting the value inside square in the board and removing all the other same values from the other boxes.

    So I'm making a vector1 as the board.
    Vector 3 is the values till 9 and then Im trying to remove all the other possibilities when 1 no. is selected.
    So say your 3d vector is called vec.
    And then the user picks x on the square with coordinates a and b. You want that squares respective vector to only contain the digit 1.
    So you say:
    Code:
    vec[a][b] = {x};
    And obviously it doesn't have to be 1, it could be any integer variable.

    Then you loop through the whole row.
    [code]
    for (int i = 0; i
    • Thread Starter
    Offline

    19
    ReputationRep:
    (Original post by BobBobson)
    So say your 3d vector is called vec.
    And then the user picks x on the square with coordinates a and b. You want that squares respective vector to only contain the digit 1.
    So you say:
    Code:
    vec[a][b] = {x};
    And obviously it doesn't have to be 1, it could be any integer variable.

    Then you loop through the whole row.
    [code]
    for (int i = 0; i
    Thanks! I was working on a similar logic...had got a Segmentation error that took agess to fix but worked! Thanks
 
 
 
Reply
Submit reply
Turn on thread page Beta
Updated: November 12, 2016
The home of Results and Clearing

1,272

people online now

1,567,000

students helped last year

University open days

  1. Bournemouth University
    Clearing Open Day Undergraduate
    Fri, 17 Aug '18
  2. University of Bolton
    Undergraduate Open Day Undergraduate
    Fri, 17 Aug '18
  3. Bishop Grosseteste University
    All Courses Undergraduate
    Fri, 17 Aug '18
Poll
Will you be tempted to trade up and get out of your firm offer on results day?

The Student Room, Get Revising and Marked by Teachers are trading names of The Student Room Group Ltd.

Register Number: 04666380 (England and Wales), VAT No. 806 8067 22 Registered Office: International House, Queens Road, Brighton, BN1 3XE

Write a reply...
Reply
Hide
Reputation gems: You get these gems as you gain rep from other members for making good contributions and giving helpful advice.