DEPRECATION WARNING

This documentation is not using the current rendering mechanism and is probably outdated. The extension maintainer should switch to the new system. Details on how to use the rendering mechanism can be found here.

EXT: Sudoku

Created:2006-12-06T00:32:00
Changed:2007-02-20T23:09:27
Author:Andreas Kastl
Email:andreas.kastl@gmx.de
Info 3:
Info 4:

EXT: Sudoku

Extension Key: sudoku

Copyright 2006-2013, Andreas Kastl, <andreas.kastl@gmx.de>

This document is published under the Open Content License

available from http://www.opencontent.org/opl.shtml

The content of this document is related to TYPO3

- a GNU/GPL CMS/Framework available from www.typo3.com

Table of Contents

EXT: Sudoku 1

Introduction 1

What does it do? 1

Screenshots 1

Users manual 2

Administration 3

Tutorial 4

Known problems 6

To-Do list 6

Changelog 6

Introduction

What does it do?

Sudoku puzzles are very popular on the web. This extension provides a Sudoku puzzle for Typo3 that can be integrated as a frontend plugin. The puzzles are pre-generated and stored in database for faster content delivery to frontend user.

More information about Sudoku puzzles can be found under http://en.wikipedia.org/wiki/Sudoku.

Screenshots

The frontend user has to solve the Sudoku puzzle by filling out all empty cells with the correct numbers from 1 to 9. The input fields are positioned in table cells. In addition the user has some buttons to control the game.

  • Check enables validation of user input without presenting the complete solution of the puzzle. This is useful if the user wants to verify some input fields, but does not want to quit the current game.
  • Solve presents the complete, correct solution of the puzzle and quits the current game.
  • Level 1 (easy) ... Level 10 (difficult) set the difficulty level of a new game or displays the current level.
  • New starts a new game based on the selected level.

img-1

For a live example of the game please have a look at http://www .andreas-kastl.de/en/games-fun/sudoku/ .

Users manual

  • Frontend user has full control over game with three buttons (Check, Solve, New) and level selector.
  • Input fields have no separate border. Only border around table cell is displayed. Please click with mouse pointer on center of table cell to set the focus on input field. Clicks next to cell border will probably not set focus on input field.
  • To navigate through open input fields from upper-left to bottom-right cell keyboard with tabulator key can be used, too.
  • If you enter incorrect characters (others than '1' to '9', e.g. a letter like 'A') and submit the form for check, incorrect characters are removed. If you enter a correct character (between '1' and '9') and submit the form for check, but your input for a certain field is not the correct solution, your input is marked as false (red color and underlined in default style). So you have to change your input.
  • If you click on solve, your field input is ignored and correct solution is displayed.
  • If you click on new, your field input is also ignored and a new puzzle based on your level selection is displayed.
  • The complete board is based on CSS. You can scale it as you like. All necessary length units are scaleable in default CSS styles.
  • Solution methods to solve the Sudoku puzzles can be found at http://en.wikipedia.org/wiki/Sudoku.

img-1

Administration

A Typo3 backend user can easily add the plugin to a page by selecting the plugin as a new content element:

img-2

Next you need to configure the HTML template for the content output in flexform (either use default template or custom template via file selector):

img-3

If you want to use the default CSS styles (recommended), then you have to add them to your template (either root template or extension template) by including static Typoscript configuration:

img-4

Otherwise you have to include the CSS descriptions manually in your own CSS files. See pi1/static/setup.txt for details.

That's all you have to configure in the Typo3 backend.

Tutorial

All available, pre-generated Sudoku puzzles are stored under root- level pid (id = 0), where other static data is stored as well (e.g. static data from extension static_info_tables, static templates, backend users, etc.). To view the boards, use Web List Mode and click on root-level entry of your Typo3 installation (globe icon). Then you will see the Sudoku puzzles:

img-5

When you select one Sudoku puzzle and click Edit, then you can see the puzzle details:

img-6

Some notes on the extension:

  • Extension was tested under Typo3 4.0.x up to Typo3 6.1.x release.
  • You only have to configure which template should be used for content rendering. You can either use default template (recommended) which is stored in the extension directory under pi1/static/template.html or use a custom template. This configuration must be made via flexform when you insert the plugin to a page as content element. If you are using multiple languages in your environment, you must repeat the configuration per language (flexform default).
  • There is no special TypoScript configuration necessary. All configuration is done via flexform. But you can use TypoScript as well to override parameters, e.g. _CSS_DEFAULT_STYLES (defined in pi1/static/setup.txt) or _LOCAL_LANG.<language key> (defined in pi1/locallang.xml). Further information about overriding of default styles or language labels can be found in Typo3 core documentation under http://typo3.org/documentation/document-library/core- documentation/ .
  • The extensions provides 500 different, pre-generated Sudoku puzzles with 50 puzzles per difficulty level from 1 to 10. This is should be more than sufficient.
  • Preconfigured Sudoku puzzles in the database were generated with class.Sudoku.php from Richard Munroe http://www.csworks.com/ . You can download it under http://www.phpclasses.org/browse/package/2674.html . For licensing reasons this class is not included in the extension package.
  • If you want to add more Sudoku puzzles to the database:
  • All puzzles are stored in table tx_sudoku_puzzles.
  • Every puzzle contains initialboard (start positions), solvedboard (complete/solved puzzle), level, uid and pid. Uid is incremented automatically. Make sure that pid is 0 for new entries. This is necessary to display the puzzle list under root-level as static data.
  • Initial and solved puzzles are serialized as a string of 81 characters. Upper left corner of Sudoku board is character at string position 1, bottom right corner is character at position 81.
  • Open/unsolved cells in initial puzzle are filled with '#' character, other cells must have a character between '1' and '9'.
  • Solved puzzles do not contain any '#' character. Only characters between '1' and '9' are allowed.
  • Each puzzle has a level represented as integer between 1 (easy) and 10 (difficult). This is exactly the level that is one of the optional input parameters of generator class.
  • When using generator class, you must modify the output before importing new puzzle into database. Output of the class represents open/unsolved cells in puzzle as blank ' ' and not as '#'. And string may be trimmed on the right side.

By default, TCA configuration does not allow modification of Sudoku puzzles under root level pid (0). Therefore a Save button is not displayed in detail view.

Known problems

No known problems at the moment.

To-Do list

No to do's at the moment.

Changelog

  • Version 1.2.0: Typo3 CMS 6.x compatibility fix.
  • Version 1.1.0: Added NL language support.
  • Version 1.0.0: first stable release, documentation modified and completed
  • Version 0.5.0: first public beta release after several local alpha releases, ready for review by Typo3 community.

img-7 EXT: Sudoku - 6