You are Here: Home

1. 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!
2. Sure why not. I'm good at C++. What are you struggling with?
3. (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.
4. (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
5. (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

### Related university courses

TSR Support Team

We have a brilliant team of more than 60 Support Team members looking after discussions on The Student Room, helping to make it a fun, safe and useful place to hang out.

This forum is supported by:
Updated: November 12, 2016
The home of Results and Clearing

### 1,272

people online now

### 1,567,000

students helped last year
Today on TSR

Hang on, have Edexcel's come out already?

### University open days

1. Bournemouth University
Fri, 17 Aug '18
2. University of Bolton
Fri, 17 Aug '18
3. Bishop Grosseteste University
Fri, 17 Aug '18
Poll
Useful resources

Can you help? Study Help unanswered threadsStudy Help rules and posting guidelines

## Groups associated with this forum:

View associated groups

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