Posts

Showing posts from October, 2022

Check Sudoku - Unity Tutorial - 4. Setting values

Image
In the previous step we have created app skeleton . In this one we will implement setting the values of board cells: Implementation In order to fill the board with 3x3 squares (we need 9 of those) and individual cells (we need 81) we create prefabs and use the  GridLayout  to display them. We create one  GroupRect  for each 3x3 group and one  CellImage  for each cell: We follow the same pattern with the work cell, where we display possible values. We create  PossibilityRect  to display possible cell value: After clicking the cell ( CellImage ), we want something (???) to highlight the selected cell with a frame, and we want the work cell ( WorkCellImage ) to display current cell value. After clicking another cell, something (???) should deselect the previous cell, highlight the new one, and display the new cell value in the work cell. Question 1: Which element should store the information about which cell is selected? Options: The game manager ( ...

Check Sudoku - Unity Tutorial - 3. App skeleton

Image
In the previous step we have  set up Unity and GitHub . In this one, we will create an app skeleton, with home page, settings panel, empty board: Implementation Since a lot has changed in Unity over the years (e.g. TextMeshPro is used instead of regular text) we start from completing a simple tutorial: Creative Core: UI Let's start with the home page. We want to have a Sudoku background, but without paying for any "stock" photos, therefore we print one page of problems from  WSPC 2021  and take the picture ourselves: The first challenge is making the home page look good in both portrait and landscape orientation. We achieve it by using AspectRatioFitter for the background as explained  here .  After reading  this  we add a title anchored to the upper left corner of the screen, and panel with buttons anchored to the lower right corner.  This gives us the following UI: We add some background music from pixabay.com . Following Creative Core UI : Ad...

Check Sudoku - Unity Tutorial - 2. Setup

Image
Unity Since I haven't used Unity for a few years I installed Unity Hub and the latest version of Unity (2022.1.20f1) from the  official site . In oder to record animation GIFs I also installed  LICEcap . Font location Adding the first"Text - TextMeshPro" element to the UI show the prompt for importing essential and additional resources (e.g. fonts). We import both: Next, we move the fonts that we plan to use (e.g. "Roboto-Bold.ttf") to the new "Fonts" folder: Script location By default all Unity C# scripts (e.g. for "GameManager" game object) are created directly under "Assets". We move them to the new "Scripts" folder: Audio files location We put audio files (e.g. background music) into the new "Audio" folder: GitHub We save the project locally. To prevent losing it in case of computer failure, we also store it in a private repository at  gihub.com  using e.g. GitHub Desktop . Next steps The next step will be c...

Check Sudoku - Unity Tutorial - 1. An idea

Image
Problem statement Let's start from something simple. Let's implement an app for solving  classical Sudoku . Users The intended audience are people who want to learn how to solve even the hardest classical Sudoku themselves. Functionality The app will help with solving Sudoku, by: highlighting cells with deduced values for a cell with deduced value, explaining why this value needs to be there The app WILL NOT (at least in the 1st version): generate Sudoku boards solve Sudoku automatically scan Sudoku board with the use of phone / computer camera User interface The UI will be very simple. When solving the board, the app will highlight cells with deduced values: After selecting a highlighted cell, visual indicators and textual explanation appears, explaining why this value needs to be there. After selecting suggested value, the field is now filled, and is taken into account when deducing values for other fields: Let's start with the setup  :-D Polish | English

The Beginnings

  Motivation As a programmer, and at the same time puzzle lover ( GMiL ,  WSPC ), mortgage owner, real-estate owner, home budget planner, etc. I simplify my life with the use of a computer in many different ways: Implement solvers for some puzzles - to check my own solutions of course ;-) Create spreadsheets calculating my mortgage rates - in Swiss franks of course ;-) Create an app to analyze publicly available Polish land and mortgage registers from  Elektroniczne KsiÄ™gi Wieczyste  - for my own use Every six months analyze my family's home budget - to figure out when I'll finally be  financially independent ... I realized that I'm surely not the only person with such problems / questions, so I decided to create a set of tools for solving them, thus simplifying everyday life. What will be here? To increase my motivation, and maybe motivate other people for sharing their tools, I plan to describe the process of creating all the tools in this blog. To maximize my...