Styling a sudoku grid

后端 未结 5 1759
时光说笑
时光说笑 2021-01-22 12:47

I’ve created a sudoku puzzle creator / solver and need a bit of help with some CSS to style it.

Typically they are styled like this:

.

Some naming I’m us

5条回答
  •  独厮守ぢ
    2021-01-22 13:25

    Great solution Jukka. I used a combination of this and the following .erb code to dynamically generate the table and pop the contents in.

    @current_solution is my array holding the values for each cell.

    <% 3.times do |all_box_rows_value|%>
      
        <% 3.times do |box_row_value| %> 
          <%  all_box_rows = all_box_rows_value * 27 %>
            <% all_rows = ((box_row_value +1 ) * 9)-9 %>
            <%9.times do |row| %>
              <% index = all_box_rows+all_rows+row %>
              <% value = @current_solution[index] %>
    <% colour_class = get_colour_class index %> > <% end %> <% end %> <% end %>

提交回复
热议问题