11 Replies - 888 Views - Last Post: 14 April 2013 - 02:39 PM

#1 mastapro  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 133
  • Joined: 19-September 11

sudoku help

Posted 12 April 2013 - 06:27 PM

Hi guys, I'm not gonna ask for code because I truly want to figure this out for myself but I am completely stumped on this. I'm supposed to make a sudoku game in javascript/html that is 4x4. I don't even know how to begin this to be honest. I'm assuming I have to make a table with 16 cells, 4 rows 4 columns. Can someone point me in the right direction with pseudo code as to how this game would be implemented? Thanks.
Is This A Good Question/Topic? 0
  • +

Replies To: sudoku help

#2 modi123_1  Icon User is offline

  • Suitor #2
  • member icon



Reputation: 9201
  • View blog
  • Posts: 34,575
  • Joined: 12-June 08

Re: sudoku help

Posted 12 April 2013 - 06:34 PM

html5 has a nice 'canvas' option.. pretty simple to draw rectangles and such on there.

Example:
http://www.dreaminco...canvas-drawing/
Was This Post Helpful? 0
  • +
  • -

#3 mastapro  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 133
  • Joined: 19-September 11

Re: sudoku help

Posted 12 April 2013 - 06:39 PM

Actually so far, i have made the 16 cells and each cell has 4 buttons on it for 1,2,3 and 4. Now I'm guessing everytime someone clicks on one of those buttons, i'll go to a function to check if it's valid. I have another question, how do I get rid of all the buttons once a number is verified to be valid and make it pop up in big font on that cell? Also, how do I initialize an array of numbers to be inside the cells?
Was This Post Helpful? 0
  • +
  • -

#4 mastapro  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 133
  • Joined: 19-September 11

Re: sudoku help

Posted 12 April 2013 - 07:30 PM

New question: how do i set up multiple options within a cell of a table? I set up my table and some have values in them but the others have 0 which means you have to pick 1,2,3 or 4. how do i set up 4 hyperlinks or buttons within a cell so i can process which one they click on that cell?
Was This Post Helpful? 0
  • +
  • -

#5 modi123_1  Icon User is offline

  • Suitor #2
  • member icon



Reputation: 9201
  • View blog
  • Posts: 34,575
  • Joined: 12-June 08

Re: sudoku help

Posted 12 April 2013 - 07:36 PM

You wouldn't.. you would use the DOM (document object model), java script events, and client side processing.
Was This Post Helpful? 0
  • +
  • -

#6 mastapro  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 133
  • Joined: 19-September 11

Re: sudoku help

Posted 12 April 2013 - 07:54 PM

thank you for the reply. so i have to use DOM to make the table or use it to process the choices?
Was This Post Helpful? 0
  • +
  • -

#7 modi123_1  Icon User is offline

  • Suitor #2
  • member icon



Reputation: 9201
  • View blog
  • Posts: 34,575
  • Joined: 12-June 08

Re: sudoku help

Posted 12 April 2013 - 07:55 PM

Typically I would use DOM to manipulate elements on the screen as well as deal with user input on the client side.
Was This Post Helpful? 0
  • +
  • -

#8 mastapro  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 133
  • Joined: 19-September 11

Re: sudoku help

Posted 12 April 2013 - 09:42 PM

Thanks i'm researching DOM right now. so with DOM i am able to set up 4 hyperlinks in each table? I want to set it so whenever a number is clicked, i will verify it by checking if that number is in that row or not
Was This Post Helpful? 0
  • +
  • -

#9 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 3541
  • View blog
  • Posts: 10,232
  • Joined: 08-June 10

Re: sudoku help

Posted 13 April 2013 - 12:17 AM

View Postmastapro, on 13 April 2013 - 03:27 AM, said:

I'm supposed to make a sudoku game in javascript/html that is 4x4. I don't even know how to begin this to be honest. I'm assuming I have to make a table with 16 cells, 4 rows 4 columns.

compared to the original Sudoku, a 4x4 would have 16 rows and 16 columns, I’d say.

This post has been edited by Dormilich: 13 April 2013 - 12:19 AM

Was This Post Helpful? 0
  • +
  • -

#10 JMRKER  Icon User is offline

  • D.I.C Addict

Reputation: 128
  • View blog
  • Posts: 828
  • Joined: 25-October 08

Re: sudoku help

Posted 13 April 2013 - 08:30 PM

Suduku is hard enough with it's 9x9 arrangement (3 columns/rows of 1-9 in 3x3 boxes for total of 81 entries).

The only way you would be able to solve a 16x16 board would be to use hexidecimal values (0..9,A-F)

I believe the 4x4 layout would be (arrangement only, not a solvable puzzle) or 16 total entries:
+-----------+-----------+
|           |           |
| [ 1 | 2 ] | [ 1 | 2 ] |
|     +     |     +     |
| [ 3 | 4 ] | [ 3 | 4 ] |
|           |           |
+-----------+-----------+
|           |           |
| [ 1 | 2 ] | [ 1 | 2 ] |
|     +     |     +     |
| [ 3 | 4 ] | [ 3 | 4 ] |
|           |           |
+-----------+-----+-----+

(Sorry, layout looks formatted in edit mode before posting to the thread)

This post has been edited by Dormilich: 14 April 2013 - 01:53 AM

Was This Post Helpful? 0
  • +
  • -

#11 mastapro  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 133
  • Joined: 19-September 11

Re: sudoku help

Posted 13 April 2013 - 10:31 PM

it's not 16x16, it's only 4x4, a much simpler way. By 4x4 i mean that there's only 4 quadrants and each have 4 numbers. so something like this

[ ][ ][ ][ ]
[ ][ ][ ][ ]
[ ][ ][ ][ ]
[ ][ ][ ][ ]


It's a very dumbed down version of sudoku but I just don't understand the basic concept of how to implement it

This post has been edited by Dormilich: 14 April 2013 - 01:55 AM

Was This Post Helpful? 0
  • +
  • -

#12 laytonsdad  Icon User is offline

  • Cheese and Sprinkles
  • member icon

Reputation: 440
  • View blog
  • Posts: 1,867
  • Joined: 30-April 10

Re: sudoku help

Posted 14 April 2013 - 02:39 PM

I did this not to long ago to help me with jquery. What I did was make some divs styled with css and used a click event on the divs to send a prompt for a number then put the number in that div, you could also click it again and change it if it was wrong.

Hope that helps.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1