Android Sudoku Game

Source: Internet
Author: User

Recently nothing to do, according to video Tutorial wrote a Sudoku game, very rough there are many places to modify. Let's talk about this game.

1. Customize a View control to display a 9*9 grid on the screen, which is actually a horizontal drawing of 8 lines, a vertical drawing of 8 jumpers, and then a few of the lines to be bold. So that's the 9*9 lattice.

2. Initialize the numbers on the game interface with a string

1 String str_int = "360000000004230800000004200" +2             "070460003820000014500013020" +3             "001900000007048300000000045"; // Data Initialization Data

I'm just going to fill in the initialized numbers with a string.

3. When clicking on a grid, we need to figure out the row of the lattice, the number that has appeared in the small 9, that is, the number that cannot be used, and then gives the user a number that can be used. (a bit around here) I used a custom dialog to show the user

4. The user clicks on the number above the dialog, recalculates the already used number, refreshes the interface, that is, calls back the OnDraw () method

SOURCE download

PS: Source code is a bit messy, the document is also very confusing

Android Sudoku Game

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.