<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Nesim Razon</title>
    <description>The latest articles on DEV Community by Nesim Razon (@nesimrazon).</description>
    <link>https://dev.to/nesimrazon</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4229210%2Fde7efa93-80bc-4dfe-b69e-a43c10bbb3d3.jpg</url>
      <title>DEV Community: Nesim Razon</title>
      <link>https://dev.to/nesimrazon</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/nesimrazon"/>
    <language>en</language>
    <item>
      <title>Kotlin Multiplatform: Platform Features as a Nullable Interface</title>
      <dc:creator>Nesim Razon</dc:creator>
      <pubDate>Wed, 02 Dec 2026 13:10:03 +0000</pubDate>
      <link>https://dev.to/nesimrazon/kotlin-multiplatform-platform-features-as-a-nullable-interface-pdj</link>
      <guid>https://dev.to/nesimrazon/kotlin-multiplatform-platform-features-as-a-nullable-interface-pdj</guid>
      <description>&lt;p&gt;Sooner or later a shared Kotlin screen needs something that only one platform has yet: a purchase, a photo picker, a cloud save. The usual answer is expect/actual. I found a smaller one in my own apps: give shared code an interface, and let the property be null when the platform cannot do it. Here is how that looks in real code, and where it stops working.&lt;/p&gt;

&lt;h2&gt;
  
  
  The problem: a feature that exists on one side only
&lt;/h2&gt;

&lt;p&gt;My Astrolings app is a Kotlin Multiplatform project with an Android app and an iOS app sharing one Compose interface. When I ported it to iOS, the Android version already sold a remove-ads purchase. The iOS version, in its first release, did not have that product defined in the store yet.&lt;/p&gt;

&lt;p&gt;The shared screen still had to draw a profile page, and that page has a remove-ads button. So the real question was: how does shared code learn that this button should not exist on this platform? I did not want an if on a platform name scattered over screens, and I did not want a fake purchase that quietly does nothing.&lt;/p&gt;

&lt;h2&gt;
  
  
  The answer in the code: a nullable property
&lt;/h2&gt;

&lt;p&gt;The shared module declares a small interface called RemoveAds. It has two members: a price, which is a nullable string, and a function buy that returns true if the purchase screen opened. The Platform interface, which every shared screen receives, then has one property: removeAds, whose type is RemoveAds with a question mark.&lt;/p&gt;

&lt;p&gt;On Android, that property returns an object that forwards to the billing code. On iOS, the class IosPlatform sets it to null, with a comment saying the store product was not defined in the first release. That is the whole platform difference. No expect, no actual, no flag.&lt;/p&gt;

&lt;p&gt;The shared screen reads it in one place. The call site passes a parameter called canRemoveAds, which is simply removeAds not equal to null. When that is false, the profile page shows a calm sentence saying the app is free and shows one small ad at the bottom, instead of a button. I have simplified the description here, but the names come straight from the project.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why not expect/actual
&lt;/h2&gt;

&lt;p&gt;I do use expect/actual in these projects, but for small pure functions. Snowlings, for instance, declares one to decode image bytes into a bitmap and one to turn a bitmap into a PNG. Both platforms can always do that, so a missing implementation is simply a compile error, which is exactly what you want.&lt;/p&gt;

&lt;p&gt;A purchase is different, for three reasons.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;An actual must exist for every target. If iOS cannot buy yet, the actual has to lie: return a fake price, or do nothing when called. Nothing in the type says so.&lt;/li&gt;
&lt;li&gt;It needs state and a screen. A real purchase holds a billing connection and an Activity. Those are objects with a life cycle, and a top-level function declaration is a poor home for them.&lt;/li&gt;
&lt;li&gt;The shared code cannot ask a function whether it is real. With a nullable interface, one comparison with null answers it, and the compiler forces every call site to handle the answer.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Null, null object, or a default body: a rule I use
&lt;/h2&gt;

&lt;p&gt;I use three different ways to say a platform cannot do something, and they are not interchangeable. The choice depends on one question: what should the user see when the feature is missing?&lt;/p&gt;

&lt;p&gt;If the user should see nothing different, except that the thing silently does not happen, I use a default body or a null object. In Snowlings, the Platform interface gives cloud sync an empty default body, and the photo picker a default that reports no photo. A platform that does not override them simply does nothing. In Slinglings, a small object named NoServices stands in for ads and purchases: it has no ads, and a rewarded request gives the reward at once. Because the callback always fires, the game never waits.&lt;/p&gt;

&lt;p&gt;If the user should see a different screen, I use null. A hidden button, a different paragraph, a menu entry that is not there. The null is not an error here. It is information that the shared screen needs in order to draw correctly.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Callback that must always fire: null object, as in NoServices.&lt;/li&gt;
&lt;li&gt;Optional action with nothing to show: default body, as in the photo picker.&lt;/li&gt;
&lt;li&gt;Feature that changes what is drawn: nullable interface, as in removeAds.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Slinglings shows the in-between case. Its GameServices interface has a flag called billingAvailable and a nullable price. That works, but the flag and the buy function can disagree. With the nullable object in Astrolings, you cannot call buy on something that does not exist.&lt;/p&gt;

&lt;h2&gt;
  
  
  Three states, not two
&lt;/h2&gt;

&lt;p&gt;A nullable capability has a trap: null can mean too many things. I keep the meanings separate by putting each one in a different place.&lt;/p&gt;

&lt;p&gt;Absent on this platform is the null on the property. Present, but not allowed right now is a separate question on the object, like the permission check in the notifications interface. Present, but not available at the moment is a nullable value inside it: in RemoveAds, a null price means the product cannot be bought at this moment, for example because the store has not answered yet. The screen reacts to each differently. The first hides the button, the second asks for permission, the third shows the button without a price.&lt;/p&gt;

&lt;p&gt;If you collapse them into one null, you end up debugging a missing button that only appears sometimes.&lt;/p&gt;

&lt;h2&gt;
  
  
  Testing gets easier
&lt;/h2&gt;

&lt;p&gt;The shared code only sees an interface, so a test can hand it any platform it likes. In Astrolings the test folder has a fake Platform, in a file named IosShots, in which the members do nothing and removeAds is null. That single fake lets the screens run as a plain unit test, without a phone and without a purchase library.&lt;/p&gt;

&lt;p&gt;The same idea gives the opposite test for free. Pass an object with a price and the button appears. Pass one that returns false from buy and you can check the failure message. In both cases, the only thing under test is the shared screen's reaction.&lt;/p&gt;

&lt;p&gt;Compare that with an actual declaration: you cannot easily swap it in a test, because it is chosen at compile time.&lt;/p&gt;

&lt;h2&gt;
  
  
  The iOS side: null at the boundary
&lt;/h2&gt;

&lt;p&gt;The same idea shows up one level lower. In Snowlings and Astrolings, the iOS entry point is a Kotlin function named MainViewController, and its parameter is the Swift bridge object, with a question mark in the type. In the Snowlings version of IosPlatform, the cloud save does nothing if that object is missing, and the photo picker answers with no photo.&lt;/p&gt;

&lt;p&gt;A missing bridge therefore means a quieter app, not a crash. That is useful during a port, when some Swift pieces are not written yet: the Kotlin side can still run, and you can see what is still missing.&lt;/p&gt;

&lt;p&gt;A practical note from my iOS port checklist: the shared Platform interface lists the nullable capability explicitly, so a new port starts by asking, for every member, whether this platform has it yet.&lt;/p&gt;

&lt;p&gt;I should be precise about what I did and did not do. In these apps the Platform object itself is never null, and the Swift bridge is the only null-typed object at the entry point. The nullable capability property exists in Astrolings. The other capabilities use default bodies or the null object.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where it hurts
&lt;/h2&gt;

&lt;p&gt;Nullable capabilities are not free.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Every call site must handle null. That is the point, but a feature used in ten places gets ten question marks. If that hurts, wrap the check in one small function and call that.&lt;/li&gt;
&lt;li&gt;Kotlin exports an interface to Swift as a protocol, and nullability crosses over as optional. It works, but I only rely on it in the entry point, where the type is simple.&lt;/li&gt;
&lt;li&gt;Do not use it when the platforms are always equal. A function that every target can implement belongs in expect/actual or in a plain interface.&lt;/li&gt;
&lt;li&gt;Do not use it for something that is mostly present. If it is null on one platform in a hundred, the question marks become noise.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;My rule of thumb: when the shared screen has to look different, the capability is nullable. When it only has to keep working, give it a default.&lt;/p&gt;

&lt;h2&gt;
  
  
  FAQ
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;When is a nullable interface better than expect/actual?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;When a platform may not have the feature at all and the shared screen must look different without it. Expect/actual forces every target to provide something, even a fake.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Is a nullable interface the same as the null object pattern?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;No. A null object pretends the feature exists and does nothing. A nullable interface says plainly that it does not exist, so shared code can hide the button or change the text.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How do you test shared code that depends on platform features?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Write a small fake Platform in the test folder. Return null for the capability to test the missing case, or an object with a price to test the present case.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Does a nullable interface work across the Swift bridge?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In my apps the iOS entry function takes the Swift bridge object as nullable, and the Kotlin side does nothing when it is missing. I did not export the nullable capability property itself to Swift.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What should null never mean?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Never use one null for several situations. Keep absent on this platform, not allowed now and not available right now in three separate places.&lt;/p&gt;

</description>
      <category>kotlin</category>
      <category>android</category>
      <category>ios</category>
      <category>architecture</category>
    </item>
    <item>
      <title>Moving From GitHub Pages to Your Own Domain Without Losing SEO</title>
      <dc:creator>Nesim Razon</dc:creator>
      <pubDate>Wed, 02 Dec 2026 13:09:24 +0000</pubDate>
      <link>https://dev.to/nesimrazon/moving-from-github-pages-to-your-own-domain-without-losing-seo-29hn</link>
      <guid>https://dev.to/nesimrazon/moving-from-github-pages-to-your-own-domain-without-losing-seo-29hn</guid>
      <description>&lt;p&gt;My site started life on a github.io address, and in mid November 2026 I moved it to its own domain, nesimapps.com. The site is a static one, built by scripts, with four languages and a few hundred pages. This is the order I followed, what I checked after the switch, and the loose ends I only noticed because other systems depended on the old address.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why move, and why not wait
&lt;/h2&gt;

&lt;p&gt;A github.io address belongs to your account name, not to your project. Every link you collect, every store listing and every backlink points at a name you do not fully control. The site was only a few weeks old, which made the move cheap: there was very little history tied to the old address. That is the argument for doing it early.&lt;/p&gt;

&lt;p&gt;Before switching I wrote down the real risks. The app stores had review pages that opened privacy and support URLs on the old address. After the switch those addresses would redirect, and the HTTPS certificate for the new name might take minutes to hours to appear. A reviewer landing in that window could see an error. The ad file, app-ads.txt, is also tied to the developer website listed in the stores. So I planned the switch for a quiet period, and I kept in mind that the whole change is reversible: removing the custom domain in the repository settings puts things back.&lt;/p&gt;

&lt;h2&gt;
  
  
  The order of operations
&lt;/h2&gt;

&lt;p&gt;First I bought the domain and set up DNS, with the proxy turned off on every record. GitHub Pages wants to talk to the domain directly, and a proxy in front of it can get in the way of certificate issuing. The zone has the four address records and four IPv6 records that GitHub documents, a www record that points to the old github.io name, and the TXT record for domain verification. I verified the domain in GitHub first, two days before the switch, so nothing was left to chance on the day.&lt;/p&gt;

&lt;p&gt;Second, before touching anything live, I made the base address a single constant in the site generators, so the switch could not leave a stray old address behind. Third, I entered the custom domain in the Pages settings. The repository then carries a CNAME file with one line, nesimapps.com. Fourth, I waited for the certificate and enabled the HTTPS enforcement. The publishing step takes a few minutes, and I polled the live site with a script instead of refreshing a browser.&lt;/p&gt;

&lt;h2&gt;
  
  
  The redirects come for free, but check them
&lt;/h2&gt;

&lt;p&gt;Once a custom domain is set, GitHub Pages answers requests for the old github.io address with a permanent 301 redirect to the new domain, and it does the same for the www version of the new name. The path is kept. That matters more than it sounds, because my site also serves things that are not pages: the privacy policies, the app-ads.txt file and a small JSON file that older versions of my apps download. Those apps cannot be changed after they are published, and they keep working because the old URL still arrives at the new file.&lt;/p&gt;

&lt;p&gt;I did not trust that and checked it. I requested the old privacy page, the ad file and the JSON file on the old address and confirmed each one ended on the new address with the same content. I also opened the www address. A redirect that goes to the home page instead of the matching path would be an easy mistake to miss, so I check the paths, not only the home page.&lt;/p&gt;

&lt;h2&gt;
  
  
  Canonical, sitemap and hreflang
&lt;/h2&gt;

&lt;p&gt;A redirect alone is not enough. Search engines also read the signals inside your pages, and all of them have to say the new address. My site is built by a chain of generator scripts, and the last step splits it per language and adds the head tags. That step writes the canonical link, the alternate links for every language including the x-default entry, the language attribute and the structured data. It also writes the sitemap, which lists each page with its alternates and a last modified date, and the robots.txt file points at that sitemap. I rebuilt everything in one run with the new base address, so no page was left with a canonical on the old name.&lt;/p&gt;

&lt;p&gt;The same change reached the machine-readable summary file for AI assistants, the QR code targets, the share cards and the script that posts articles to a developer community with a canonical link. The privacy and terms pages stay out of the sitemap and carry a noindex tag, as before. After publishing I opened a few pages from each language on the live site and read the head tags, and I fetched the sitemap itself, because a sitemap that still lists the old host is the classic leftover.&lt;/p&gt;

&lt;h2&gt;
  
  
  Search Console, Bing and the other accounts
&lt;/h2&gt;

&lt;p&gt;In Search Console I used a domain property, verified through DNS. A domain property covers the www and non-www names and both protocols, so it fits a site that will always be reached through redirects from other forms of the address. My reporting script reads search data through the API with a service account, and that account has to be added to the new property as a restricted user, or the report comes back empty. I added it and kept the old property as a fallback in the script until I deleted it shortly after. The history I had already saved in my own archive stayed there, because Search Console only keeps sixteen months and I never relied on it for the past.&lt;/p&gt;

&lt;p&gt;Bing Webmaster got the new site and its sitemap. Yandex needed its two verification files in the site root. The instant-indexing workflow that pings search engines when pages change got the new host. For analytics I updated the stream address, and the tracking script accepts both host names, so a visit that somehow lands on the old name is still counted instead of dropped. The web stats script for my dashboard looks for the new property first. Bing data was empty for the first few days on the new site, which I expected.&lt;/p&gt;

&lt;h2&gt;
  
  
  app-ads.txt, store listings and UTM
&lt;/h2&gt;

&lt;p&gt;The ad file lives at the root of the site, and ad networks find it through the website you list in the store. On Android that field is in the Play Console, and I changed it, along with the privacy policy address on every app, to the new domain. On iOS the stores read the marketing and support URLs from App Store Connect, and those are separate fields that someone has to change by hand.&lt;/p&gt;

&lt;p&gt;That was the loose end. The day after the move, an ad verification for an iOS app was stuck, and the public App Store pages still showed the old github.io addresses. My working explanation is that the verifier starts from the old address and follows a redirect to another domain, which it may not accept. I have not proven that. The fix I wrote down is to enter the new domain in App Store Connect, then ask the ad network to check again. I mention it because it shows how a move touches systems that never appear in your repository.&lt;/p&gt;

&lt;p&gt;For UTM tags I made a deliberate choice. The Play links on the site carry a referrer with utm_source set to the old name. I left it unchanged so that months of earlier data and new data stay in one series. The only thing that would force a change is a source-based filter, and I plan to look at GA4 two weeks later to see whether sessions still arrive with the old host as the source.&lt;/p&gt;

&lt;h2&gt;
  
  
  The checklist I would reuse
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Verify the domain with the hosting provider before you switch, and keep the DNS proxy off.&lt;/li&gt;
&lt;li&gt;Put the base address in one constant and rebuild everything in a single pass.&lt;/li&gt;
&lt;li&gt;Check the redirects on real paths: policies, ad file, data files, language folders and &lt;a href="http://www" rel="noopener noreferrer"&gt;www&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Read canonical, alternates and the sitemap on the live site, not only in the source.&lt;/li&gt;
&lt;li&gt;Add the service account to the new search property before you need the data.&lt;/li&gt;
&lt;li&gt;List every outside system that stores your address: store listings, ad file checks, profiles, article cross-posts.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What I cannot tell you
&lt;/h2&gt;

&lt;p&gt;I do not have a before-and-after traffic story for this move, and I will not invent one. The site was young, my search data is small and the numbers move for many reasons at once. What I can show is that the technical signals were consistent on the day I switched, and that the redirect paths worked. If you do this, write down your own baseline first and look again after a few weeks.&lt;/p&gt;

&lt;h2&gt;
  
  
  FAQ
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Does GitHub Pages redirect the old address automatically?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Yes. After you set a custom domain, requests to the old github.io address are redirected with a 301 to the new domain, and the path is kept. Check a few real paths to be sure.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Should I use a domain property in Search Console?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;It is a good fit for a moved site, because it covers www, non-www and both protocols. It is verified through a DNS record.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why keep the DNS proxy off with GitHub Pages?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;GitHub Pages issues the HTTPS certificate for your domain and wants to reach it directly. A proxy in front can interfere with that process.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Can I undo the move?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Yes. Removing the custom domain in the repository settings returns the site to the github.io address, which is why a quiet period is enough for the switch.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Will app-ads.txt keep working after a move?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;It is read from the website you list in each store. Update that field in every store, and check the ad network's verification status afterwards.&lt;/p&gt;

</description>
      <category>seo</category>
      <category>webdev</category>
      <category>github</category>
      <category>devjournal</category>
    </item>
    <item>
      <title>Beamies: How a Solver Measures and Raises Difficulty</title>
      <dc:creator>Nesim Razon</dc:creator>
      <pubDate>Wed, 02 Dec 2026 13:09:20 +0000</pubDate>
      <link>https://dev.to/nesimrazon/beamies-how-a-solver-measures-and-raises-difficulty-30eb</link>
      <guid>https://dev.to/nesimrazon/beamies-how-a-solver-measures-and-raises-difficulty-30eb</guid>
      <description>&lt;p&gt;Beamies has 400 levels that nobody drew by hand. A solver measures how hard each one is, a hill climb makes it harder, and a test replays every stored solution before the game ships. This post follows that chain: why my first levels were too easy, what a move even means here, how two different solvers do two different jobs, and where the finished pack still falls short of its own plan.&lt;/p&gt;

&lt;h2&gt;
  
  
  Too simple, and the numbers agreed
&lt;/h2&gt;

&lt;p&gt;Beamies is a puzzle where you slide a teleport gate across a board and it beams aliens of its own color home. The gate moves one cell at a time. It can only pass over aliens of its own color, other colors, other gates and walls block it, and it disappears when its capacity is full. When the last alien is gone, the level is done. My first generator placed pieces at random, solved the result and kept the best of many tries.&lt;/p&gt;

&lt;p&gt;It worked, and I played through to level 334. My verdict was that it was nice but far too easy, the kind of game an ordinary player would finish in a few hours. The numbers agreed. The fewest drags needed to finish a level, which the game calls par, was mostly between 4 and 10, and the solver got through after expanding only 7 to 40 states. Adding more gates did not raise par. Picking the best of many random layouts does not create depth. It only picks the best of the shallow ones.&lt;/p&gt;

&lt;h2&gt;
  
  
  What counts as a move
&lt;/h2&gt;

&lt;p&gt;A drag is one stretch of moving the same gate. Every step moves a gate by one cell, but a run of steps with the same gate counts as a single move, and a new move starts only when you switch to another gate. The game counts it that way even if you lift your finger and carry on with the same gate.&lt;/p&gt;

&lt;p&gt;Level 1 shows the idea. It has one gate with room for six aliens, and its stored solution is eight single-cell steps, which makes one drag. Par is the fewest drags over all possible solutions. That is the number I try to raise, because it matches how effort feels to a player: not how many cells you cross, but how many times you have to stop, think and choose a different gate.&lt;/p&gt;

&lt;h2&gt;
  
  
  Two solvers for two jobs
&lt;/h2&gt;

&lt;p&gt;The first solver measures par. It is an A star search where continuing with the same gate costs nothing and switching gates costs one. The state includes which gate moved last, so the search knows when a switch happens. Its guess for the remaining cost is the number of gates still on the board, minus one if the gate you just moved is still there. That guess never overestimates, because every remaining gate needs at least one drag, so the answer is the true minimum. A budget of expanded states keeps the search from running forever.&lt;/p&gt;

&lt;p&gt;Levels with patrolling asteroids, edge portals or rotating gates can blow that budget, because time becomes part of the state. For those the program falls back to a second solver, a weighted A star. With weight zero it is a plain breadth-first search over single steps. With a positive weight it uses a cheaper guess, six per remaining alien plus each gate's distance to the nearest alien of its color, and it finds a good solution fast but not always the shortest. So on timed levels the stored par is an upper bound: the best solution found, not a proof of the minimum.&lt;/p&gt;

&lt;p&gt;The weighted solver also runs on the phone: after each move it searches in the background. If it exhausts the whole search space without a win, the position is a dead end, the game says so and undo becomes free. If it merely runs out of budget, the game stays quiet. The hint button uses the same search and plays the first drag of what it finds.&lt;/p&gt;

&lt;h2&gt;
  
  
  Building backwards, then climbing
&lt;/h2&gt;

&lt;p&gt;Construction starts from the end. The generator takes the solved board, with every gate gone, and plays in reverse: a gate appears, steps back one cell and leaves aliens behind on the cells it just uncovered. Each reverse step matches a legal forward move, so the level that comes out can be solved by construction, and its solution is the steps in reverse order. Patrols are added only if replaying that solution still works. Edge portals change the solution, so those levels are checked by the solver instead.&lt;/p&gt;

&lt;p&gt;That gives solvable levels, not deep ones. The deepening step is a hill climb. It makes a small random change: move an alien to another empty cell, shift a gate's start by up to two cells, add one capacity and one alien of that color, or add or remove a wall. About half of the changes move an alien. After each change the solver measures par again, and the change is kept when par does not go down. Accepting equal values lets the layout wander across flat stretches. The climb stops when par reaches the target for that level, after a set number of tries, or at a time limit. In the first experiment, 400 tries lifted par from 4 to 12, 4 to 11, 4 to 10 and 5 to 19.&lt;/p&gt;

&lt;p&gt;If a level cannot be built with the full rules of its region, the generator drops features in up to six stages, portals and patrols first, and the last resort is a tiny always-solvable level. For easy and medium levels from level 8 on, ten random playthroughs of 10 to 40 moves must all end in positions the solver can still finish, so a beginner cannot trap themselves. It is a preference: hard levels may keep an unavoidable trap, and undo is free when you are stuck.&lt;/p&gt;

&lt;h2&gt;
  
  
  The target curve, and what the pack delivers
&lt;/h2&gt;

&lt;p&gt;The target par for a level depends only on its position. The 400 levels are 40 regions of ten. The base grows with the region as 3 plus 21 times the region number divided by 39, raised to the power 0.85, and a multiplier by position inside the region shapes the wave: 0.5, 0.6, 0.8, 0.95, 1.1, then 0.5 as a breather, then 1.0, 1.25, 1.5 and 2.0 for the boss. So level 1 aims for par 2, level 10 for 6, and level 400 for 48.&lt;/p&gt;

&lt;p&gt;A target is a wish and the file is the fact, so I measured the pack with a small script that counts drags the way the game does. Par ranges from 1 to 49, with a mean of 14.9 and a median of 13. Averages for each block of 50 levels are 5.5, 8.3, 12.5, 12.0, 18.1, 20.5, 23.2 and 19.0. The wave is there: averaged by position inside the region, the breather level has 8.1 and the boss level has 26.8.&lt;/p&gt;

&lt;p&gt;It is not perfect. 317 of the 400 levels reach or pass their target, and 58 stay under 80 percent of it. The last block is the weakest: its average dips to 19.0, and level 400 has par 21 against a target of 48. Late levels combine many element types, and in those regions only about 5 to 20 percent of build attempts succeed. A fix mode reruns weak levels with more time, but the gap I measured is still open.&lt;/p&gt;

&lt;h2&gt;
  
  
  Stars come from par
&lt;/h2&gt;

&lt;p&gt;Nobody finds the best solution on the first try, so the star limits are generous. Three stars up to 1.5 times par rounded up, plus 1. Two stars up to 2.5 times par rounded up, plus 2. Otherwise one star. For par 6 the limits are 10 and 17, for par 13 they are 21 and 35, and for par 20 they are 31 and 52. Every level carries its own par, so nothing needs hand tuning.&lt;/p&gt;

&lt;h2&gt;
  
  
  Testing the pack
&lt;/h2&gt;

&lt;p&gt;The pack is one text file with 400 lines. Each line holds size, walls, gates, start positions, aliens, patrols, portals, paint, fog and the stored solution, separated by hash signs, with the solution written as a gate number plus a direction letter, like 0R0R0D. PackTest has five tests. Three run only when the GEN_PACK environment variable is set: one generates all 400 levels in parallel and writes the file, one fixes weak levels, one regenerates levels whose stored solution stopped being legal after a rule change. The two that always run are a round trip that encodes and decodes sample levels, and the pack check, which requires 400 lines and replays every stored solution through the real game rules. A level whose solution does not win fails the test.&lt;/p&gt;

&lt;p&gt;The solver also had a bad day in production. Version 1.0.3 ran the weighted search after every move for the stuck check, with a budget of 300,000 states, and ran hints on the main thread with 400,000, without a memory limit. On level 180 the search frontier outgrew the heap, and Crashlytics showed many OutOfMemoryError reports. Version 1.0.4 added a cap on stored states, cancellation when a new move arrives, a stop when the heap passes 55 percent, and moved hints to a background thread. SolverGuardTest runs the limited search on level 180 and requires it to finish in under 30 seconds with less than 120 MB of heap growth. My notes recorded 218 milliseconds and about 46 MB.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I would change
&lt;/h2&gt;

&lt;p&gt;Two difficulty measures live in the code. The older one counts how many states a breadth-first search expands. The shipped pack uses par. I have not proven which tracks player frustration better, and the game now records when a player leaves a level unfinished, with moves and time, so real data can answer that.&lt;/p&gt;

&lt;p&gt;The late regions need a faster way to build deep levels, and timed levels need a tighter bound than a weighted search gives. Beamies: Beam Home is the Android puzzle where all of this lives, with 400 levels from the Moon to the Galaxy.&lt;/p&gt;

&lt;h2&gt;
  
  
  FAQ
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;What does par mean in Beamies?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;It is the fewest drags needed to finish a level. Moving the same gate in a row counts as one drag, and switching to another gate starts a new one.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why does the game use two solvers?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;An exact A star search measures par. A weighted A star is faster and is used for hints, dead-end detection and levels with timed elements, but it does not always find the shortest solution.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How are levels made harder?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A hill climb makes small random changes and keeps a change when par does not drop, until par reaches the target for that level.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How are the three stars decided?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Three stars up to 1.5 times par rounded up plus 1, two stars up to 2.5 times par rounded up plus 2, otherwise one star.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How is the pack tested?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A unit test checks that the file has 400 lines and replays every stored solution through the real game rules, so a level that cannot be won fails the test.&lt;/p&gt;




&lt;p&gt;If you want to see this in action, Beamies is free on &lt;a href="https://play.google.com/store/apps/details?id=com.beamies.nesimapps&amp;amp;referrer=utm_source%3Ddev.to%26utm_medium%3Dpost%26utm_campaign%3Dbeamies-solver-difficulty-curve"&gt;Google Play&lt;/a&gt; and needs no account. More notes like this one live on &lt;a href="https://nesimapps.com/blog/" rel="noopener noreferrer"&gt;my site&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>gamedev</category>
      <category>algorithms</category>
      <category>kotlin</category>
      <category>android</category>
    </item>
    <item>
      <title>Ultimate Tic-Tac-Toe: Why a Solved 3x3 Does Not Solve It</title>
      <dc:creator>Nesim Razon</dc:creator>
      <pubDate>Wed, 02 Dec 2026 13:08:41 +0000</pubDate>
      <link>https://dev.to/nesimrazon/ultimate-tic-tac-toe-why-a-solved-3x3-does-not-solve-it-2j7h</link>
      <guid>https://dev.to/nesimrazon/ultimate-tic-tac-toe-why-a-solved-3x3-does-not-solve-it-2j7h</guid>
      <description>&lt;p&gt;Ordinary Tic-Tac-Toe is a solved draw, so it is tempting to think a version made of nine such boards is just nine times the work. It is not. The extra rule that links the boards changes the whole character of the game, and it makes a computer opponent much harder to build. Here is how the game works, how big it really is, and what we did in our own app.&lt;/p&gt;

&lt;h2&gt;
  
  
  What 'solved' means for the small game
&lt;/h2&gt;

&lt;p&gt;A game is solved when the result with perfect play from both sides is known. For the 3x3 game that result is a draw. There are only 5,478 different positions that can appear on the board when you play from the empty grid and stop at a win or a full board. I checked that number again with a short script before writing this, and it matches.&lt;/p&gt;

&lt;p&gt;A program can look at every one of those positions in the blink of an eye. That is why a perfect opponent for the small game is easy: it simply tries every continuation and assumes you always find your best reply. Nothing in this story carries over automatically to the bigger game, and the reason is the first thing to understand.&lt;/p&gt;

&lt;h2&gt;
  
  
  The rules of Ultimate Tic-Tac-Toe
&lt;/h2&gt;

&lt;p&gt;Picture a big 3x3 grid. Each of its nine squares holds a complete small 3x3 board, so there are 81 cells in total. Players alternate with X and O. The twist is how you choose where to play: the cell you take inside a small board decides which small board your opponent must play in next. If you mark the top-right cell of any small board, your opponent has to move in the top-right small board of the big grid.&lt;/p&gt;

&lt;p&gt;Winning a small board works as usual: three of your marks in a row there claims that board for you. To win the whole game you claim three small boards in a line on the big grid. That means every move matters twice. It is a move in a local fight, and it is also an instruction about where the next fight happens.&lt;/p&gt;

&lt;h2&gt;
  
  
  The cases people forget
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;The sent board is already won or completely full. Then the rule has no board to point at, and the player to move may choose any small board that is still open. In our app this is exactly the implemented rule.&lt;/li&gt;
&lt;li&gt;A won small board still has empty cells, but nobody can play in them any more. A board is closed as soon as it is won or full.&lt;/li&gt;
&lt;li&gt;A small board that fills up without a winner is closed and belongs to nobody. It does not count for either side on the big grid.&lt;/li&gt;
&lt;li&gt;If every small board is closed and nobody has three in a line on the big grid, the game is a draw.&lt;/li&gt;
&lt;li&gt;The very first move can go anywhere, because there is no previous move to point at a board.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  How big is the game, really?
&lt;/h2&gt;

&lt;p&gt;Counting exactly is hard, so I did not try. Instead I wrote a script that plays 20,000 random legal games and measured them. A typical game lasts about 59 moves, with a range from 27 to 77 in my sample. On an average turn the player has about 9.2 legal cells to choose from, and roughly one turn in ten is a free choice where the sent board was closed.&lt;/p&gt;

&lt;p&gt;Multiplying the number of options along a typical random game gives roughly 10 to the power of 49 distinct move sequences, as an order of magnitude from this sampling. The small game has 255,168 complete games. These are not exact counts and I am not claiming one, but the gap is far too big to close with a faster computer. Even a crude upper bound for filling 81 cells with three possible states, 3 to the power of 81, is about 4.4 times 10 to the power of 38, and that ignores the rules entirely.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why the 3x3 result does not transfer
&lt;/h2&gt;

&lt;p&gt;A draw on every small board does not give a draw on the big one. Winning a small board is the means, not the end, and the order of fights is dictated by the sent-board rule. A move that is the best answer inside one small board can be a disaster for the whole game, because it sends your opponent to a board where they can win immediately. The reverse is also true: a locally weak move can be the right one if it sends the opponent somewhere harmless.&lt;/p&gt;

&lt;p&gt;So you cannot solve the nine small boards separately and glue the answers together. The boards talk to each other through every move. I am not aware of a simple full solution of the complete game that I could point you to, so do not rely on me for a claim either way. What I can say safely is that the answer for 3x3 tells you nothing about it, and that the game is far too large for the naive search that works on the small one.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why the computer opponent is harder to build
&lt;/h2&gt;

&lt;p&gt;For the small game a program searches to the end of every line, so it never has to guess how good a position is: the result is known. In Ultimate it cannot reach the end of the lines from an early position. It has to stop after a few moves and ask how good the position looks right now. That judgement is called an evaluation function, and writing it is a design job, not a calculation.&lt;/p&gt;

&lt;p&gt;A good evaluation has to weigh several things: small boards already won, threats of two in a row inside open boards, two claimed boards in a line on the big grid with the third still open, and the value of getting a free choice. Different weights make the program play differently, and a weak weight can make a deep search play worse than a shallow one. Testing is mostly watching games and checking that the stronger level beats the weaker one.&lt;/p&gt;

&lt;h2&gt;
  
  
  What our Tic-Tac-Toe app does
&lt;/h2&gt;

&lt;p&gt;Version 2.1.0 of our app adds an Ultimate mode next to the classic game, with Easy, Medium, Hard and a two-player option on the same phone. The code follows the rules above, including the free choice when the sent board is closed, and a unit test covers each of those cases.&lt;/p&gt;

&lt;p&gt;Easy sometimes spots a move that wins the whole game, sometimes grabs a small board, and otherwise plays a random legal cell. Medium looks one move ahead with simple scores: it likes winning a small board, blocks the opponent's completion, and avoids sending you to a board where you could win at once or handing you a free choice. Hard runs a search called alpha-beta, which skips branches that cannot change the result. It deepens step by step up to nine moves ahead and stops early when it runs out of its search budget, which is about 350,000 positions, then scores the end of each line with a hand-written evaluation. Its very first move of a game is random.&lt;/p&gt;

&lt;p&gt;That also means Hard is strong but not perfect in Ultimate, unlike Hard in the classic mode, where the minimax search really does reach the end. Our tests check that Hard beats Medium and Easy in practice and that a Hard move arrives in under three seconds on a test run. They do not claim perfection, and neither do I.&lt;/p&gt;

&lt;h2&gt;
  
  
  Playing it well
&lt;/h2&gt;

&lt;p&gt;A few habits help against any opponent. Before every move, look at the board you are about to send your opponent to and ask whether they can win it or force something good there. Be careful about handing out free choices, since the player who can pick any board has the initiative; our own Medium and Hard levels treat that as a cost. Remember that a small board only matters because of the big grid, so a draw on a small board is sometimes a good result if it stops a line of three.&lt;/p&gt;

&lt;p&gt;If you enjoyed the history and the small game, the classic mode is still there for the quick perfect-play practice. When you want to see why the larger version keeps people busy, try Ultimate on Medium first and then step up to Hard.&lt;/p&gt;

&lt;h2&gt;
  
  
  FAQ
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Is Ultimate Tic-Tac-Toe solved like the 3x3 game?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The 3x3 result does not carry over, and the game is vastly larger. I am not aware of a simple full solution I can point to, so treat it as an open question in this post.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What happens if I am sent to a board that is full or already won?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;You may play in any small board that is still open. This is the rule implemented in our app.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How do you win the whole game?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Win three small boards in a row, column or diagonal on the big grid. If every board closes without that, the game is a draw.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How many moves does a game take?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In a sample of 20,000 random games the average was about 59 moves, ranging from 27 to 77. Human games are different, so take that as a rough guide.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Does the Hard level play perfectly?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;No. In Ultimate it searches up to nine moves ahead with a node budget and a hand-written evaluation, so it is strong but not perfect. Classic Hard is perfect.&lt;/p&gt;




&lt;p&gt;If you want to see this in action, Tic-Tac-Toe is free on &lt;a href="https://play.google.com/store/apps/details?id=com.tictactoe.nesimapps&amp;amp;referrer=utm_source%3Ddev.to%26utm_medium%3Dpost%26utm_campaign%3Dultimate-ttt-not-solved"&gt;Google Play&lt;/a&gt; and needs no account. More notes like this one live on &lt;a href="https://nesimapps.com/blog/" rel="noopener noreferrer"&gt;my site&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>gamedev</category>
      <category>algorithms</category>
      <category>android</category>
      <category>programming</category>
    </item>
    <item>
      <title>Who Sees the New Year First and Last: UTC+14 to UTC-12</title>
      <dc:creator>Nesim Razon</dc:creator>
      <pubDate>Wed, 02 Dec 2026 13:08:37 +0000</pubDate>
      <link>https://dev.to/nesimrazon/who-sees-the-new-year-first-and-last-utc14-to-utc-12-1mmg</link>
      <guid>https://dev.to/nesimrazon/who-sees-the-new-year-first-and-last-utc14-to-utc-12-1mmg</guid>
      <description>&lt;p&gt;On the night of December 31st the new year does not arrive at one moment. It walks around the planet over about 26 hours, one zone after another. Here is the order of midnights for the turn from 2026 to 2027, with real offsets checked against the time zone database, and how the New Year countdown in our app Snowlings turns all of this into a single number.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why midnight is a local event
&lt;/h2&gt;

&lt;p&gt;The Earth turns, so the sun is overhead in different places at different times. To keep clocks sensible, the world is cut into time zones, each defined as a fixed distance from UTC, the shared reference time. A zone at UTC+3 has a clock three hours ahead of UTC, a zone at UTC-5 has a clock five hours behind.&lt;/p&gt;

&lt;p&gt;Midnight is simply the moment a local clock reads 00:00 on January 1st. Because the clocks differ, that moment is a different instant for each zone. The same instant on a global timeline can be the first minutes of 2027 in one country and the late afternoon of December 31st in another. A countdown is therefore never just a number of days. It always needs to know whose midnight it is counting toward.&lt;/p&gt;

&lt;h2&gt;
  
  
  The first to arrive: UTC+14
&lt;/h2&gt;

&lt;p&gt;The earliest clock in the world runs at UTC+14. I checked it with the tz database (version 2026f, through Python's zoneinfo module): Pacific/Kiritimati, in the Line Islands of Kiribati, has an offset of +14:00 on January 1st, 2027, with no daylight saving. Its midnight falls at 10:00 UTC on December 31st, 2026.&lt;/p&gt;

&lt;p&gt;That is not an old, stable arrangement. The same database says Kiritimati was at UTC-10 on December 30th, 1994 and at UTC+14 on January 2nd, 1995, a jump of a full day. The islands moved across the date line so that the whole country shares the same calendar day. Samoa did something similar in 2011: Pacific/Apia is at UTC-10 on December 29th, 2011 and at UTC+14 on December 31st, 2011, including its summer time at that point. Today Apia is at UTC+13.&lt;/p&gt;

&lt;p&gt;Right next to the first place sits a useful comparison. At the instant Kiritimati rings in 2027, Pacific/Honolulu (UTC-10) is only starting its own December 31st at 00:00. Two places on the same planet are a whole calendar day apart.&lt;/p&gt;

&lt;h2&gt;
  
  
  The order of midnights
&lt;/h2&gt;

&lt;p&gt;Here is the order for the 2026/2027 turn, with the UTC moment of each local midnight, all computed from the database:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;10:00 UTC, December 31st: Pacific/Kiritimati (+14).&lt;/li&gt;
&lt;li&gt;10:15 UTC: Pacific/Chatham (+13:45 in summer time).&lt;/li&gt;
&lt;li&gt;11:00 UTC: Pacific/Auckland (+13, summer time), Pacific/Tongatapu (+13), Pacific/Apia (+13).&lt;/li&gt;
&lt;li&gt;12:00 UTC: Pacific/Fiji (+12).&lt;/li&gt;
&lt;li&gt;13:00 UTC: Australia/Sydney (+11, summer time).&lt;/li&gt;
&lt;li&gt;18:15 UTC: Asia/Kathmandu (+5:45).&lt;/li&gt;
&lt;li&gt;18:30 UTC: Asia/Kolkata (+5:30).&lt;/li&gt;
&lt;li&gt;21:00 UTC: Europe/Istanbul (+3).&lt;/li&gt;
&lt;li&gt;05:00 UTC, January 1st: America/New_York (-5).&lt;/li&gt;
&lt;li&gt;10:00 UTC: Pacific/Honolulu (-10).&lt;/li&gt;
&lt;li&gt;11:00 UTC: Pacific/Pago_Pago (-11) and Pacific/Niue (-11).&lt;/li&gt;
&lt;li&gt;12:00 UTC: Etc/GMT+12 (-12).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Notice that UTC midnight itself, 00:00 on January 1st, falls in the middle of the list. Western Europe is only reached after most of Asia has already celebrated.&lt;/p&gt;

&lt;h2&gt;
  
  
  The last to arrive: UTC-12 and UTC-11
&lt;/h2&gt;

&lt;p&gt;The latest clock is UTC-12. In the database it exists as Etc/GMT+12, a generic zone that is not tied to a city. I could not confirm from the data files which islands use it or whether anyone lives there, so I will not say more about them than this: it is the end of the list. Its midnight is at 12:00 UTC on January 1st.&lt;/p&gt;

&lt;p&gt;Among zones tied to real places, the late arrivals are at UTC-11, such as Pacific/Pago_Pago and Pacific/Niue, whose midnight is at 11:00 UTC. The gap from the first midnight (10:00 UTC on December 31st) to the last (12:00 UTC on January 1st) is 26 hours. Add one more day, because the first zone is still on January 1st when the last one reaches it, and the calendar date January 1st exists somewhere on Earth for a full 50 hours.&lt;/p&gt;

&lt;h2&gt;
  
  
  Half hours and quarter hours
&lt;/h2&gt;

&lt;p&gt;Not every offset is a whole number of hours. India uses UTC+5:30 (Asia/Kolkata), and Nepal uses UTC+5:45 (Asia/Kathmandu). That makes Nepal's midnight arrive at 18:15 UTC, fifteen minutes before India's at 18:30 UTC, even though both are in south Asia.&lt;/p&gt;

&lt;p&gt;The Chatham Islands (Pacific/Chatham) are the best example. In the southern winter, on July 1st, 2026, their offset is +12:45. In the summer, on January 1st, 2027, it is +13:45. So the Chatham Islands reach the new year 45 minutes before mainland New Zealand's clock, and only 15 minutes after Kiritimati. When someone says that New Zealand is first, that is a rounding of the story.&lt;/p&gt;

&lt;h2&gt;
  
  
  Summer time in the southern hemisphere
&lt;/h2&gt;

&lt;p&gt;Daylight saving works the other way round south of the equator: clocks go forward in the local summer, around the New Year. The database confirms it. Pacific/Auckland is at UTC+12 on July 1st, 2026 (NZST) and at UTC+13 on January 1st, 2027 (NZDT). Australia/Sydney is at UTC+11 on January 1st, 2027 (AEDT), which is its summer time.&lt;/p&gt;

&lt;p&gt;Fiji is a warning against writing offsets into code. Pacific/Fiji has no daylight saving in the data I used: it is at UTC+12 both on December 1st, 2026 and on January 15th, 2027. Tonga and Samoa are at UTC+13 without summer time. These rules are decided by governments and change from time to time. The safe approach is to read them from the time zone database of the operating system, not to remember them.&lt;/p&gt;

&lt;h2&gt;
  
  
  How Snowlings computes the countdown
&lt;/h2&gt;

&lt;p&gt;In the New Year calendar app Snowlings the countdown on the calendar screen takes the current time in milliseconds and the time zone ID reported by the phone (the Android TimeZone default, the iOS local time zone name; if the ID cannot be used, the app falls back to UTC). It finds the local date, builds January 1st of the next year at the start of the day in that zone, and subtracts. Because the start of the day is computed by the time zone rules, summer time is handled for free: the arithmetic never assumes that a day has 24 hours. The screen recalculates once per second and shows days, hours, minutes and seconds.&lt;/p&gt;

&lt;p&gt;A separate midnight screen counts down the same way, updating four times a second, with a large number for the last ten seconds and fireworks when the time is reached. Beneath it the app lists cities that have already entered the new year and the next five. This list works differently from the countdown. It is a fixed list of 22 cities, from Kiritimati at +14 to Honolulu at -10, each with a stored offset chosen for the December and January period, and a city's midnight is January 1st 00:00 UTC minus that offset. That is simple and exact for one night a year, and it needs no zone database. The price is that these offsets have to be checked by hand if a country changes its rules. The app is Snowlings, if you want to watch the walk around the planet in real time.&lt;/p&gt;

&lt;h2&gt;
  
  
  FAQ
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Which time zone sees the New Year first?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;UTC+14. In the tz database it is used by Pacific/Kiritimati in Kiribati's Line Islands, whose midnight is at 10:00 UTC on December 31st.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why do some zones differ by 30 or 45 minutes?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Governments choose offsets freely. India is at UTC+5:30, Nepal at UTC+5:45, and the Chatham Islands at +12:45 in winter and +13:45 in summer.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How long does the New Year take to travel around the world?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;From the first midnight (UTC+14) to the last (UTC-12) it takes 26 hours.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Does daylight saving change when the New Year arrives?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Yes. Auckland is at UTC+13 in January and UTC+12 in July, so its midnight moves by one hour depending on the rule. Read the offset from the time zone database.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How does a countdown handle different time zones?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;It computes January 1st at 00:00 in the device's time zone and subtracts the current time, so each device counts down to its own local midnight.&lt;/p&gt;




&lt;p&gt;If you want to see this in action, Snowlings is free on &lt;a href="https://play.google.com/store/apps/details?id=com.snowlings.nesimapps&amp;amp;referrer=utm_source%3Ddev.to%26utm_medium%3Dpost%26utm_campaign%3Dnew-year-first-last-time-zones"&gt;Google Play&lt;/a&gt; and needs no account. More notes like this one live on &lt;a href="https://nesimapps.com/blog/" rel="noopener noreferrer"&gt;my site&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>programming</category>
      <category>timezones</category>
      <category>kotlin</category>
      <category>devjournal</category>
    </item>
    <item>
      <title>How to Host a Tombala Night at Home: An Organizer's Guide</title>
      <dc:creator>Nesim Razon</dc:creator>
      <pubDate>Sat, 28 Nov 2026 10:22:30 +0000</pubDate>
      <link>https://dev.to/nesimrazon/how-to-host-a-tombala-night-at-home-an-organizers-guide-3n0c</link>
      <guid>https://dev.to/nesimrazon/how-to-host-a-tombala-night-at-home-an-organizers-guide-3n0c</guid>
      <description>&lt;p&gt;Tombala is the Turkish bingo-like number game played with 90 numbers and cards of three rows and nine columns. It suits a family evening or a gathering of friends, but a good night depends on the person running it. This guide covers what to prepare, how to run the draw, how to settle the prizes, and how to keep everybody happy. It is all for fun: no money is staked at any point.&lt;/p&gt;

&lt;h2&gt;
  
  
  Decide the size of the evening
&lt;/h2&gt;

&lt;p&gt;Four to ten players is comfortable. With fewer, rounds feel quiet; with more, the organizer struggles to check claims and the draw drags on. Give each player one card to start with, or two if everybody knows the game. Three cards at once is the most a person can watch without losing track, and it is also the most the Tombalings app allows.&lt;/p&gt;

&lt;p&gt;Cards matter more than their count. A set of six cards can cover every number from 1 to 90 exactly once. Our post on how a tombala card is generated explains how such a set is built. In practice this means: if six players hold one card each from the same set, every drawn number lands on exactly one player's card, so nobody sits through a round with nothing to mark. Cards cut at random from different sources can hold the same number many times or miss some entirely, and the round then feels lopsided.&lt;/p&gt;

&lt;h2&gt;
  
  
  What you need
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Cards: printed or bought tombala cards with 3 rows and 9 columns, 15 numbers each. Check that no two cards in the room are identical.&lt;/li&gt;
&lt;li&gt;The draw: numbers 1 to 90, each exactly once. Paper slips folded to the same size in a bowl work well. A cloth bag with 90 numbered tokens works too. A phone app that draws without repeating is fine as long as it never shows a number twice.&lt;/li&gt;
&lt;li&gt;A master sheet: a page listing 1 to 90 where the organizer crosses out every drawn number. This is your proof when anyone calls.&lt;/li&gt;
&lt;li&gt;Markers: dry beans, buttons or paper squares are the classic choice. Pens are fine if cards are disposable. A sticker dot per number is tidy for small children.&lt;/li&gt;
&lt;li&gt;Prizes and a table big enough for every card to lie flat in full view.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Running the draw
&lt;/h2&gt;

&lt;p&gt;Fold, shuffle and check the slips before guests arrive. Count them: 90 slips, no duplicates, no blanks. Pull one at a time, show it to the table, then read it twice, once as a number and once digit by digit, for example forty-seven, four and seven. The second reading helps people who mix up 16 and 60.&lt;/p&gt;

&lt;p&gt;Cross the number off the master sheet before you reach for the next slip. Never put a slip back. Leave a short pause, about five or six seconds early on and a little less later, so slower players can find and mark the number. If the table is mixed in age, slow the pace once and watch who is behind.&lt;/p&gt;

&lt;h2&gt;
  
  
  Calling numbers and confirming marks
&lt;/h2&gt;

&lt;p&gt;Anyone may call when they believe they have a stage. The caller stops the draw, reads out the numbers of the row or card they are claiming, and the organizer ticks each one against the master sheet. Every number must be on the sheet. One missing number means the claim is not valid, and play continues without punishment or teasing.&lt;/p&gt;

&lt;p&gt;A good habit is to ask everyone to mark only after hearing the number, never in advance, and to keep the marked cards visible on the table. It cuts down on mistakes, and kids learn faster by watching.&lt;/p&gt;

&lt;h2&gt;
  
  
  The prizes, in order
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;1st line (first cinko): all 5 numbers of one row are marked.&lt;/li&gt;
&lt;li&gt;2nd line (second cinko): two full rows are marked on the same card.&lt;/li&gt;
&lt;li&gt;Tombala: all 15 numbers of a card are marked. This ends the round.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The prizes are given in order. Nobody can take the 2nd line before the 1st line has been called, and the Tombala comes last. When a player completes the row they need, they call right away, and the first player to call gets the prize.&lt;/p&gt;

&lt;p&gt;Decide two house rules before the first number: can one person win more than one stage in a round, and what happens if two people call at exactly the same moment. A simple answer to the second is to share the prize, or to let each of them pull a slip and the higher number wins. Say it out loud once; it saves an argument later.&lt;/p&gt;

&lt;h2&gt;
  
  
  Prizes that are not money
&lt;/h2&gt;

&lt;p&gt;Because the evening is for fun, rewards should be small and silly, never cash and never anything that feels like a bet. Ideas that work well:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A bowl of the good snacks, picked first by the winner of the stage.&lt;/li&gt;
&lt;li&gt;A small gift from a shared pile, such as a notebook, a candle or a bar of chocolate.&lt;/li&gt;
&lt;li&gt;The right to choose the next board game or the next song.&lt;/li&gt;
&lt;li&gt;A paper crown for the Tombala, worn until the next one.&lt;/li&gt;
&lt;li&gt;Bragging rights, written on a family scoreboard that stays on the fridge.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Keep the same level of prize for each stage so that the 1st line does not feel like a consolation.&lt;/p&gt;

&lt;h2&gt;
  
  
  Keeping it friendly for mixed ages
&lt;/h2&gt;

&lt;p&gt;Young children can play with one card and a helper sitting next to them. Older relatives may need larger print or a second look at the card; hold the draw a little longer for them. Give the caller role to a teenager sometimes, since reading numbers aloud is good practice and keeps them involved.&lt;/p&gt;

&lt;p&gt;Do not allow teasing about missed numbers. A missed number is the most common thing that happens in tombala, and it should be treated as normal. If a child is clearly upset, let them help with the master sheet for a round.&lt;/p&gt;

&lt;h2&gt;
  
  
  A 60 to 90 minute schedule
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;First 10 minutes: welcome, hand out cards, explain the three stages and the two house rules.&lt;/li&gt;
&lt;li&gt;Next 45 to 60 minutes: three or four rounds, each about 12 to 15 minutes. Tell people to stretch between rounds.&lt;/li&gt;
&lt;li&gt;Last 10 to 15 minutes: a short final round with the best prize, then a thank-you and the crown ceremony.&lt;/li&gt;
&lt;li&gt;Between rounds: snacks, new cards if you have them, and a quick look at who has not won anything yet.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Common mistakes
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Duplicate cards: two identical cards in the same game cause pairs of winners and bad feelings. Count and compare them before you start.&lt;/li&gt;
&lt;li&gt;Missed numbers: the caller forgets to cross a number or a player forgets to mark. Keep the master sheet honest and read slowly.&lt;/li&gt;
&lt;li&gt;Arguments over ties: unclear rules. Fix them before the first draw.&lt;/li&gt;
&lt;li&gt;Too many cards per person: more than three means a player watches the cards, not the room.&lt;/li&gt;
&lt;li&gt;Putting slips back into the bowl: a number comes up twice and the whole round becomes doubtful.&lt;/li&gt;
&lt;li&gt;Rushing: a fast draw rewards the most experienced player only.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Practising before the night
&lt;/h2&gt;

&lt;p&gt;If nobody in the group has played, a short practice round helps. Our app Tombalings has a Tombala mode with 90 balls and a Bingo mode with 75 balls, played against three friendly rivals with no real money, and you can try it on your phone to learn the stages before you explain them to the table. It does not replace paper cards for a real evening, but it is a quick way to feel the rhythm.&lt;/p&gt;

&lt;h2&gt;
  
  
  FAQ
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;How many cards should each player have?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;One is enough for beginners and children. Experienced players can take two or three, but beyond three it gets hard to follow every number.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How can I draw the numbers fairly at home?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Use 90 equal paper slips in a bowl or 90 tokens in a bag, draw one at a time without putting it back, and cross each number off a master sheet.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What if two people call at the same time?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Agree a rule before the game starts, such as sharing the prize or each pulling a slip with the higher number winning.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Can we play tombala for money?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This guide is for friendly play only. Keep prizes small and fun, such as snacks, a small gift or choosing the next game, and stake no money.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How long does one round take?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;About 12 to 15 minutes with five to ten players, so three or four rounds fit in a 60 to 90 minute evening.&lt;/p&gt;




&lt;p&gt;If you want to see this in action, Tombalings is free on &lt;a href="https://play.google.com/store/apps/details?id=com.tombalings.nesimapps&amp;amp;referrer=utm_source%3Ddev.to%26utm_medium%3Dpost%26utm_campaign%3Dhome_tombala_night_organizer"&gt;Google Play&lt;/a&gt; and needs no account. More notes like this one live on &lt;a href="https://nesimapps.com/blog/" rel="noopener noreferrer"&gt;my site&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>games</category>
      <category>tutorial</category>
      <category>beginners</category>
      <category>gamedev</category>
    </item>
    <item>
      <title>300 Maze Levels With Monsters, Checked by a Solver</title>
      <dc:creator>Nesim Razon</dc:creator>
      <pubDate>Sat, 28 Nov 2026 10:21:42 +0000</pubDate>
      <link>https://dev.to/nesimrazon/300-maze-levels-with-monsters-checked-by-a-solver-fae</link>
      <guid>https://dev.to/nesimrazon/300-maze-levels-with-monsters-checked-by-a-solver-fae</guid>
      <description>&lt;p&gt;Grumblings is a turn-based maze where grumpy monsters chase you, and every one of its 300 levels was generated on a computer and accepted only if a solver found a way out. This post is about the part between the rules and the shipped file: why a plain breadth-first search is enough, how the solver acts as a gate, where the star thresholds come from, and how the same rules run in JavaScript for the demo on the website without drifting from the app.&lt;/p&gt;

&lt;h2&gt;
  
  
  The rules, exactly
&lt;/h2&gt;

&lt;p&gt;The hero takes one step in one of four directions, or waits. Then every monster moves one step, and then every monster moves one more step. With two monsters the order is monster A, monster B, monster A, monster B. A monster has a preferred axis, horizontal first or vertical first. It steps one cell toward the hero along that axis. If that step is blocked, it tries the other axis. If that is blocked too, it stays where it is. A blocked step means a wall or a cell that another monster occupies.&lt;/p&gt;

&lt;p&gt;You are caught the moment any monster enters your cell, and the monster steps that were still to come are skipped. If your own move reaches the exit, you win right there and the monsters do not move at all. A move into a wall or off the board is simply not allowed and does not count as a turn.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why the state is only (hero, monsters)
&lt;/h2&gt;

&lt;p&gt;My first plan was a state of hero position, monster positions and a turn counter. The counter turned out to be unnecessary. Nothing in the rules depends on how many moves have been played: monsters have no memory, no random numbers and no timers. The same hero and monster positions always lead to the same result for the same move. So a position is fully described by where the hero is and where each monster is, and two paths that arrive at the same positions are the same state, whatever turn it is.&lt;/p&gt;

&lt;p&gt;That makes the state space small. With n cells and k monsters there are at most n to the power of (1 plus k) states. From the pack's own settings the largest case is a 7 by 7 maze with two monsters: 49 cubed, which is 117,649 states. An 8 by 8 maze with one monster has 4,096. Each state has five possible actions: up, down, left, right and wait.&lt;/p&gt;

&lt;h2&gt;
  
  
  A breadth-first search is all it takes
&lt;/h2&gt;

&lt;p&gt;The solver packs a state into one integer, hero cell first and then each monster cell, and keeps two flat arrays indexed by that integer: where it came from and which move led there. It then runs an ordinary breadth-first search from the start. For every state it tries the five actions through the same move function the game uses. A caught result is thrown away. A new position is queued if it has not been seen. The first time a move wins, the search stops and the path is rebuilt backwards from the arrays.&lt;/p&gt;

&lt;p&gt;Because breadth-first search expands states in order of how many moves it took to reach them, that first win is a shortest solution, counted in moves where a wait is a move. This matters more than it looks. The solver is not a separate model of the game. It calls the real rules, so it cannot disagree with them, and when a rule changes the solver changes with it for free.&lt;/p&gt;

&lt;h2&gt;
  
  
  Generated offline, gated by the solver
&lt;/h2&gt;

&lt;p&gt;A candidate level starts as a perfect maze made with a depth-first backtracker. Then a few extra walls are removed, about a sixth of the cell count plus up to two, so that loops exist. My first experiment used perfect mazes only and the shortest escape on a 5 by 5 board was 31 moves, far too long, because a tree-shaped maze slows the monsters down more than it slows you. Loops fixed that.&lt;/p&gt;

&lt;p&gt;The exit goes on the border, the hero somewhere random, and each monster at least three cells away from the hero by Manhattan distance and never on the exit. Then the analyzer runs a full breadth-first search over everything reachable. If no winning move exists, it returns nothing and the candidate is dropped. That is the gate: an unsolvable board cannot enter the pool, whatever the generator did.&lt;/p&gt;

&lt;p&gt;Surviving candidates must also have a minimum solution length, between 4 and 14 depending on the level, and no more than 45 moves. Level 6 has to contain at least one wait, because that is where the game teaches it. Each level gets a pool of 400 candidates for one monster, 110 for two. The pool is sorted by a difficulty score, the solution length plus six per wait, one and a half per move that ends within two cells of a monster, and thirty times the share of reachable states from which winning is no longer possible. A target percentile picks the level. It rises across the game and follows a sawtooth inside each group of ten, easy first and a harder finale. If the chosen candidate was already used, the next nearest one is taken, so no level repeats.&lt;/p&gt;

&lt;h2&gt;
  
  
  Stars come from the best solution
&lt;/h2&gt;

&lt;p&gt;Because the solver returns the shortest solution, the number of stars needs no hand tuning. Three stars if you finish in no more moves than the stored best. Two stars if you are within the larger of two moves or a quarter of the best length, rounded down. Otherwise one star. For a best of 8 the limits are 8 and 10. For a best of 20 they are 20 and 25.&lt;/p&gt;

&lt;p&gt;The move count is the length of the history, waits included, and undo removes the last entry, so a mistake you take back costs nothing. Hints are computed live: the hint button runs the solver from the current position and shows the first move of its answer. If no solution exists from where you stand, it shows a question mark instead, because levels can contain positions where the hero is already lost, and undo is the way out. The stored solution is therefore only used for stars and for tests, never for hints.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why the shipped file is plain text
&lt;/h2&gt;

&lt;p&gt;The pack is one text file with 300 lines, one level per line: size, hero cell, exit cell, monster axes, monster cells, then the vertical walls and the horizontal walls as strings of zeros and ones, and finally the best solution. The first level reads 5;4,3;3,0;H;1,4; followed by two 25-character wall strings and LLUL, a four-move escape.&lt;/p&gt;

&lt;p&gt;Plain text has practical advantages for a small project. It diffs in version control, so a regenerated pack shows exactly which levels changed. A unit test can read it without Android. The website demo embeds the very same lines, and a test can compare them character by character. And the solution at the end makes the file its own answer key, which is what the validation test replays.&lt;/p&gt;

&lt;h2&gt;
  
  
  The same rules in JavaScript, kept honest by a golden test
&lt;/h2&gt;

&lt;p&gt;The demo on the website needs the rules and the solver in the browser, so I ported the move function, the monster step, the breadth-first search and the star formula to JavaScript. A port is a promise that two implementations agree, and promises need a test. The test file first repeats the rule cases from the Kotlin tests: the preferred axis, the fall back to the other axis, being caught on the first monster step so the second is skipped, winning before the monsters move, and the two-monster order.&lt;/p&gt;

&lt;p&gt;The golden test works on the 30 levels embedded in the demo. For each one it replays the stored best solution through the JavaScript rules, which must end in a win without ever being caught. Then it runs the JavaScript solver from the start and requires the same length as the stored solution. So the best solution found by the solver wins the level and is as short as the one in the file, in a second implementation of the rules. A last test checks that the 30 embedded lines equal the first 30 lines of the app's file, so a regenerated pack breaks the build instead of silently showing different levels.&lt;/p&gt;

&lt;p&gt;As a one-off check for this article I ran the JavaScript solver over all 300 lines of the file. Every stored solution had exactly the length the solver found.&lt;/p&gt;

&lt;h2&gt;
  
  
  Numbers from the pack
&lt;/h2&gt;

&lt;p&gt;A small script over the file gives these facts. There are 300 levels: 20 on a 5 by 5 board, 50 on 6 by 6, 166 on 7 by 7 and 64 on 8 by 8. 180 have one monster and 120 have two. Solutions run from 4 to 37 moves, with a median of 16 and a mean of 16.4. The 30 levels in the browser demo range from 4 to 13 moves.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I would do differently
&lt;/h2&gt;

&lt;p&gt;Waiting is a core rule, yet only 57 of the 300 solutions contain a wait, and none contains more than two. The difficulty score rewards waits but the pool rarely offers them. Next time I would generate with a wait target for part of the pack instead of hoping the random mazes provide it.&lt;/p&gt;

&lt;p&gt;The solver returns one shortest path, not how many exist. A level with a single narrow solution feels different from one with five equivalent ones, and counting shortest paths would be a cheap extra measurement. I would also share one file of test cases between Kotlin and JavaScript. Today the JavaScript tests were written by hand from the Kotlin ones, which is fine until someone adds a case to only one side.&lt;/p&gt;

&lt;p&gt;Grumblings is my maze game for Android, and the browser demo with its first 30 levels is on its page at nesimapps.com if you want to try the rules before reading more.&lt;/p&gt;

&lt;h2&gt;
  
  
  FAQ
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;What does being caught mean in a turn-based maze with monsters?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A monster enters the hero's cell during its steps. The remaining steps are skipped and the move ends in a loss, which the player can undo.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why is a breadth-first search enough to solve it?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The rules are deterministic and have no memory, so a state is just the hero and monster positions. The state count stays small and the first win found is a shortest solution.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How are the three stars decided?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Three stars at or below the stored best length, two within the larger of two moves or a quarter of it, otherwise one star.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Can a level be unsolvable?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Not in the pack. A candidate without a winning move is dropped by the analyzer before it can enter, and a test replays every stored solution through the game rules.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How is the website demo kept in sync with the app?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A golden test replays each embedded level's best solution and requires the JavaScript solver to find the same length, and the embedded lines must equal the app's file.&lt;/p&gt;




&lt;p&gt;If you want to see this in action, Grumblings is free on &lt;a href="https://play.google.com/store/apps/details?id=com.grumblings.nesimapps&amp;amp;referrer=utm_source%3Ddev.to%26utm_medium%3Dpost%26utm_campaign%3Dgrumblings-300-levels-solver-gate"&gt;Google Play&lt;/a&gt; and needs no account. More notes like this one live on &lt;a href="https://nesimapps.com/blog/" rel="noopener noreferrer"&gt;my site&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>gamedev</category>
      <category>algorithms</category>
      <category>javascript</category>
      <category>android</category>
    </item>
    <item>
      <title>Testing a Camera App on Several Phones: Flash and Lens Position</title>
      <dc:creator>Nesim Razon</dc:creator>
      <pubDate>Sat, 28 Nov 2026 10:21:29 +0000</pubDate>
      <link>https://dev.to/nesimrazon/testing-a-camera-app-on-several-phones-flash-and-lens-position-5g5o</link>
      <guid>https://dev.to/nesimrazon/testing-a-camera-app-on-several-phones-flash-and-lens-position-5g5o</guid>
      <description>&lt;p&gt;A camera app that works on your own phone has told you very little. When the signal comes from a fingertip lit by the flash, small hardware differences decide whether the app works at all. This post covers what I learned testing one app on three family phones, which Android flash features I used, and a routine you can reuse for any camera app. The app is a wellness tool that is not a medical device, so nothing here is about diagnosis.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why the flash level matters
&lt;/h2&gt;

&lt;p&gt;In a finger-on-camera app, the flash is the light source. The camera sees light that has passed through the fingertip, and the tiny changes in that light are the signal. If the light is too dim, the picture is dark and noisy. If it is too bright, the image saturates, the values hit the top of the range and the small changes disappear.&lt;/p&gt;

&lt;p&gt;There is also a human side. In my prototype tests, full flash power made the finger uncomfortable, and even a low level warms the finger if it rests on the flash for a long time. So the right answer is the lowest level that still gives a usable image, not the brightest one.&lt;/p&gt;

&lt;h2&gt;
  
  
  Torch strength on newer Android
&lt;/h2&gt;

&lt;p&gt;Older Android versions give you torch on or off. Newer versions let an app choose a level. In Pulselings the code does this through Camera2 inside CameraX: it reads the maximum level from the camera characteristics key FLASH_INFO_STRENGTH_MAXIMUM_LEVEL and sets the level with the capture request key FLASH_STRENGTH_LEVEL. Both calls are guarded by a check for Android API 35 or higher, and wrapped so that a failure just leaves the torch at its default.&lt;/p&gt;

&lt;p&gt;Android also has a CameraManager call for turning the torch on at a given strength, and a default-level characteristic. I did not use either in this app, and I am not certain which version each one starts at, so check the official documentation before relying on them. Two lessons apply anyway. First, read the maximum level instead of assuming one: if it is 1 or missing, there is nothing to adjust. Second, treat the whole feature as optional, because many phones will not offer it.&lt;/p&gt;

&lt;h2&gt;
  
  
  How the app uses the level
&lt;/h2&gt;

&lt;p&gt;The app starts at the lowest level, so the finger is not hit with full power on the first frame. Every second or so it looks at the average red value of the picture. If red is above 235 and the level is above the minimum, it steps down. If a finger is detected and red is below 90, it steps up. This keeps the image inside a usable range without the user doing anything.&lt;/p&gt;

&lt;p&gt;On a phone without strength control, none of this is possible. The torch simply runs at full power, so the app relies on a short measurement, an early finish when the signal is clean, and a hint to lift the finger if it gets warm. That is a real behavioural difference between phones, and it is the reason the test list below includes an older Android version on purpose.&lt;/p&gt;

&lt;h2&gt;
  
  
  Choosing the camera, and not being clever
&lt;/h2&gt;

&lt;p&gt;Phones have several rear lenses, and the finger covers only one of them, usually the one next to the flash. My first idea was to try each camera and keep the one that looked like it was covered by a finger. It did not work well: the upper lens stayed dark, the app read that as no finger and kept jumping between cameras. The automatic search is switched off. The app binds the default back camera and tells the user what it sees.&lt;/p&gt;

&lt;p&gt;Finger detection is a simple colour rule on the middle of the picture: red above 45, green below 70 percent of red, blue below 85 percent of red. If the picture is very dark, the hint says so. If green is too high compared with red, the hint says the finger does not cover the lens fully. Plain rules like these are easy to log and easy to reason about across phones.&lt;/p&gt;

&lt;h2&gt;
  
  
  Flash position is the real difference
&lt;/h2&gt;

&lt;p&gt;The most useful finding was not about software. Where the flash sits relative to the lens changes how the user must hold the finger. When the flash is close to the lens, laying the finger on its side across both gives a fast, high-quality signal. On the S24 Ultra, the flash is to the right of the lens and not very close, so the finger has to lie sideways and be moved toward the flash. Explaining this clearly is the hardest part of the interface.&lt;/p&gt;

&lt;p&gt;The notes also record a limit: the flash position cannot be read from the camera API. The lens position can be read, which is a possible basis for a per-model diagram, but for the flash the app would have to ask the user or run a short calibration. I have not built that yet, so I do not claim it.&lt;/p&gt;

&lt;h2&gt;
  
  
  What differed between the three phones
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Samsung Note 10+ on Android 12: no torch strength control, so the torch runs at full power. The app warns and keeps the measurement short.&lt;/li&gt;
&lt;li&gt;Samsung S24 Ultra: the flash sits to the right of the lens, not right next to it. The finger position needs more guidance. An early artefact from this phone, a steady but wrong rhythm, led to the stricter checks described in the earlier post on the signal.&lt;/li&gt;
&lt;li&gt;Family S25 FE on Android 17: the frame rate was about 26 to 28 per second, slow drift and exposure swings produced a false low rhythm with the old filter, and the signal settled late, after roughly 40 to 60 seconds. A better band-pass filter fixed the false rhythm.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I did not test other brands such as Pixel or Xiaomi yet. The thresholds were calibrated on these three phones only, and the notes list wider testing as open work. Any claim about other phones would be a guess.&lt;/p&gt;

&lt;h2&gt;
  
  
  A test routine for any camera app
&lt;/h2&gt;

&lt;p&gt;Pick phones that differ on purpose: one old Android version, one new, one with the flash far from the lens, one with a low frame rate if you can find it. Write the list before you start. For each phone, record a header line with model, Android API level, camera id, focal length and the torch level range. Pulselings writes exactly this kind of line at the top of each debug recording.&lt;/p&gt;

&lt;p&gt;Then repeat the same scenario several times per phone, with the same person, same room and same finger. Log the raw values, not only the final result, so you can replay them later in a unit test. Compare phones on stable things: frame rate, how long until the signal settles, how often the app says not clear, and whether saturation or darkness warnings appear.&lt;/p&gt;

&lt;h2&gt;
  
  
  What to mark as could not verify
&lt;/h2&gt;

&lt;p&gt;Write down every claim you cannot reproduce. If a feature exists in the documentation but you have no phone that supports it, note that it is untested. If a result happened once, note it as one observation. If you have no reference device in the room, do not publish accuracy numbers at all, and do not imply medical meaning for a wellness app.&lt;/p&gt;

&lt;p&gt;For Pulselings, the honest list is short and clear: three phones, one person at a time, no other brands, no accuracy claims, and no medical use. If you want to see how these checks turned into an everyday app, Pulselings is the small free wellness tool I built around them.&lt;/p&gt;

&lt;h2&gt;
  
  
  FAQ
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Does every Android phone let an app set the flash brightness?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;No. Control of torch strength exists only on newer Android versions and only on phones whose camera reports a maximum level. Read it from the camera characteristics and treat the feature as optional.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why is a low flash level often better for a finger signal?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Too much light saturates the image and hides the small changes, and it can make the finger uncomfortable. The lowest level that gives a usable picture is the better target.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How many phones do I need to test a camera app?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;At least three that differ on purpose: an older Android version, a recent one, and one with a different flash and lens layout. More is better, and untested brands should be listed as unverified.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Can the app find which lens my finger is on?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Not reliably in my tests. Trying several lenses automatically confused the app, so it uses the default back camera and guides the user to cover it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Is this app a medical device?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;No. Pulselings is a wellness app, not a medical device, and it does not diagnose anything.&lt;/p&gt;




&lt;p&gt;If you want to see this in action, Pulselings is free on &lt;a href="https://play.google.com/store/apps/details?id=com.pulselings.nesimapps&amp;amp;referrer=utm_source%3Ddev.to%26utm_medium%3Dpost%26utm_campaign%3Dflash-strength-multi-phone-testing"&gt;Google Play&lt;/a&gt; and needs no account. More notes like this one live on &lt;a href="https://nesimapps.com/blog/" rel="noopener noreferrer"&gt;my site&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>android</category>
      <category>camera</category>
      <category>testing</category>
      <category>mobile</category>
    </item>
    <item>
      <title>Secret Santa Draw Algorithm: No Self-Picks, No Swaps</title>
      <dc:creator>Nesim Razon</dc:creator>
      <pubDate>Sat, 28 Nov 2026 10:20:41 +0000</pubDate>
      <link>https://dev.to/nesimrazon/secret-santa-draw-algorithm-no-self-picks-no-swaps-37h6</link>
      <guid>https://dev.to/nesimrazon/secret-santa-draw-algorithm-no-self-picks-no-swaps-37h6</guid>
      <description>&lt;p&gt;A Secret Santa draw sounds trivial: everyone picks a name. Then someone picks their own, two people end up giving to each other, and a couple draws each other when they wanted to surprise someone else. This post explains the algorithm behind my free draw page: build one big cycle, respect exclusion pairs, fall back when no cycle exists, and prove the result with tests.&lt;/p&gt;

&lt;h2&gt;
  
  
  The naive draw and where it breaks
&lt;/h2&gt;

&lt;p&gt;The first idea is a hat: each person in turn takes a random name from the hat that is not their own. It fails in a quiet way. When the last person reaches the hat, the only name left can be their own. In a simulation of 100,000 draws with 10 people, about 7 or 8 in 100 got stuck like this.&lt;/p&gt;

&lt;p&gt;The second idea is to shuffle all names, check that nobody got themselves, and shuffle again if someone did. That always ends with a valid result, but it wastes work. A shuffle with no self-pick is called a derangement, and for 10 people it took 2.7 tries on average in the same simulation.&lt;/p&gt;

&lt;h2&gt;
  
  
  A valid shuffle can still contain swaps
&lt;/h2&gt;

&lt;p&gt;Take 4 people. There are 24 ways to assign gifts. Only 9 have no self-pick. Look at those 9:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;6 of them are one loop: A gives to B, B to C, C to D, D to A.&lt;/li&gt;
&lt;li&gt;3 of them are two swaps: A and B give to each other, and C and D give to each other.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So a third of the valid results for 4 people are swaps. With 10 people, about 4 in 10 of the valid shuffles contained at least one swap in my simulation. A swap is not wrong, but it is dull: you learn who your gift-giver is the moment you pick. Most groups want it avoided.&lt;/p&gt;

&lt;h2&gt;
  
  
  One big cycle: shuffle and hand to the neighbor
&lt;/h2&gt;

&lt;p&gt;The fix is to stop thinking of a table of picks and think of a ring. Shuffle the names into a line, then let each person give to the next one in the line, and the last to the first. In the code this is one line:&lt;/p&gt;

&lt;p&gt;res[cycle[i]] = cycle[(i + 1) % n]&lt;/p&gt;

&lt;p&gt;Four people shuffled to C, A, D, B give C to A, A to D, D to B and B to C. Everyone gives once, everyone receives once, nobody gives to themselves. For more than two people, nobody can swap either, because a swap would need two people pointing at each other, and in one ring each person points only to the next.&lt;/p&gt;

&lt;p&gt;The count matches the idea: there are (n - 1)! distinct rings. That is 2 for 3 people, 6 for 4 people and 362,880 for 10 people, plenty of variety.&lt;/p&gt;

&lt;h2&gt;
  
  
  The shuffle underneath: Fisher-Yates
&lt;/h2&gt;

&lt;p&gt;Everything above depends on a fair shuffle. The code uses the Fisher-Yates method: walk from the last position down to the second, pick a random position from the start up to the current one, and swap the two. When the random numbers are good, each of the n! orders is equally likely. The loop in short:&lt;/p&gt;

&lt;p&gt;for (i = n - 1; i &amp;gt; 0; i--) { j = floor(rnd() * (i + 1)); swap(a[i], a[j]); }&lt;/p&gt;

&lt;p&gt;A common mistake is sorting with a random comparison, which does not give every order the same chance. Another detail: the function shuffles a copy, so your original list of names is never changed. The random source is a parameter that defaults to Math.random, so a test could pass a fixed sequence and repeat a draw exactly.&lt;/p&gt;

&lt;p&gt;Fisher-Yates makes a plain ring fair. With exclusion pairs, the search takes the first ring the backtracking finds from a random start, and I do not claim that every valid ring is equally likely. For a gift draw that is fine. The whole thing runs in the page, and no names are sent to any server.&lt;/p&gt;

&lt;h2&gt;
  
  
  Adding rules: couples and exclusion pairs
&lt;/h2&gt;

&lt;p&gt;Real groups have rules: partners should not draw each other, or two coworkers who already exchange gifts. The draw page stores each rule as a pair and writes it into a ban table in both directions, so one pair blocks A giving to B and B giving to A. Every name also bans itself, which is how self-picks are removed.&lt;/p&gt;

&lt;p&gt;Now a plain shuffle is not enough, because a random neighbor may be banned. The code builds the ring step by step: start from the first name in a shuffled list, try the remaining names in random order, skip anyone already used or banned, and if the chain gets stuck, step back and try another name. This is called backtracking. When the ring is full, the last person must also be allowed to give to the first.&lt;/p&gt;

&lt;p&gt;Example with 4 people where A and B must not draw each other. Of the 6 rings, only 2 keep A and B apart: A to C to B to D to A, and A to D to B to C to A. The code finds one of them within a few steps.&lt;/p&gt;

&lt;h2&gt;
  
  
  The fallback and the impossible case
&lt;/h2&gt;

&lt;p&gt;Sometimes no ring exists but a valid assignment does. Take 4 people with exclusions A-B, B-C, C-D and D-A. A can give only to C, B only to D, and so on, so the only answer is A and C swapping and B and D swapping. No ring can do that.&lt;/p&gt;

&lt;p&gt;So the code works in two stages. First it makes up to 60 attempts at a ring, each with a budget of 4,000 steps. If none works, it runs a plain random backtracking assignment with a budget of 50,000 steps. The result says which one it was: cycle true or cycle false. The page can then tell the group that swaps were unavoidable.&lt;/p&gt;

&lt;p&gt;If both stages fail, the function returns null. With 3 people where A is excluded with both B and C, nobody can give to A and A can give to nobody, so null is the right answer. Note that null also means not found within the budget, so for very large and very tight rule sets it is a practical limit, not a proof. With 2 people the only result is a swap; the helper that checks feasibility returns false for fewer than 3 names.&lt;/p&gt;

&lt;h2&gt;
  
  
  How I know it is correct
&lt;/h2&gt;

&lt;p&gt;The guarantees are simple to state. Everyone gives once and receives once. Nobody gets themselves. No excluded pair appears in either direction. When the result says cycle true, walking from the first name returns to it after exactly n steps.&lt;/p&gt;

&lt;p&gt;The test file draws 400 times for each of four groups: 3 people, 4 people with one exclusion, 10 people with three couples and 50 people with two exclusion pairs. After every draw it checks four things: the receiver exists and is not the giver, no receiver appears twice, no excluded pair appears, and for ring results the walk takes exactly n steps. One more test checks that the impossible 3-person case returns null.&lt;/p&gt;

&lt;p&gt;If you only want to run a draw, the page is at nesimapps.com/secret-santa/ and the user side is covered in the post on running an online Secret Santa draw with no sign-up.&lt;/p&gt;

&lt;h2&gt;
  
  
  FAQ
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Why does picking names from a hat sometimes get stuck?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The last person can be left with only their own name. In a 10-person simulation this happened in about 7 to 8 of 100 draws.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is a derangement?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A shuffle in which nobody ends up in their original place, so nobody draws themselves. It can still contain two people giving to each other.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How does one big cycle avoid mutual swaps?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In one ring each person gives only to the next person in the ring, so two people cannot point at each other when there are more than two people.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What if the exclusion rules make a ring impossible?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The algorithm falls back to a general backtracking assignment, where swaps may appear, and returns nothing if that also fails.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Do names need to be unique?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Yes. The function uses each name as a key in its tables, so two identical names would be treated as one person.&lt;/p&gt;

</description>
      <category>algorithms</category>
      <category>javascript</category>
      <category>webdev</category>
      <category>programming</category>
    </item>
    <item>
      <title>Measuring Play Installs: UTM Links and Listing Experiments</title>
      <dc:creator>Nesim Razon</dc:creator>
      <pubDate>Sat, 28 Nov 2026 10:20:28 +0000</pubDate>
      <link>https://dev.to/nesimrazon/measuring-play-installs-utm-links-and-listing-experiments-3hp</link>
      <guid>https://dev.to/nesimrazon/measuring-play-installs-utm-links-and-listing-experiments-3hp</guid>
      <description>&lt;p&gt;A store page gets visitors from search, from ads, from your website and from QR codes, and by default you cannot tell the last three apart. Two Play Console tools help: tagged links show where a visitor came from, and store listing experiments show which version of the page converts better. Here is how I tag my own links, where the reports live, what an experiment can and cannot test, and why small traffic limits what you can conclude.&lt;/p&gt;

&lt;h2&gt;
  
  
  How I tag a link to the store page
&lt;/h2&gt;

&lt;p&gt;Tagged links answer: which link sent this person to my store page? Listing experiments answer: when people arrive, which version of the page makes them install?&lt;/p&gt;

&lt;p&gt;They work at different steps of the same path. First the visitor clicks a link. Then the store page either convinces them or it does not. Mixing the two questions gives confusing numbers, so keep them separate.&lt;/p&gt;

&lt;p&gt;My website sends visitors to Google Play with a referrer parameter added to the store address. The value is percent-encoded, so the equals sign becomes %3D and the ampersand becomes %26:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Normal badge on the site: referrer=utm_source%3Dnrazon.github.io%26utm_medium%3Dweb&lt;/li&gt;
&lt;li&gt;QR code image on the site: referrer=utm_source%3Dnrazon.github.io%26utm_medium%3Dqr&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The source still shows the old address of my site. It was the first label I used, and I kept it so that the history stays in one row instead of splitting in two. The medium is the part that changes: web for the normal badge, qr for the code. Both patterns are in the site generator scripts, and the QR images are generated by a separate script. The same lowercase-only rule applies as everywhere else, because Google treats utm_source=google and utm_source=Google as different values.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where Play Console shows it
&lt;/h2&gt;

&lt;p&gt;The path I use is Grow users, then Store performance, then Conversion analysis. The page lets you filter by traffic source, store listing, country, language, UTM source and campaign, and acquisition state. A few details from Google's help pages matter when you read it:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Store listing visitors are people who opened your page and did not already have the app on any device.&lt;/li&gt;
&lt;li&gt;The UTM source and campaign filters only appear when the traffic source is filtered to ads and referrals.&lt;/li&gt;
&lt;li&gt;Values with too few visitors or acquisitions are grouped under Other, so a rare source can vanish into that row.&lt;/li&gt;
&lt;li&gt;Installs that cannot be tied to a source, such as reinstalls or restores from backup, are counted as not attributed.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;One honest limit: Google's help pages name the UTM source and campaign dimensions. They do not list the medium as a filter. I still send a medium, because it is a standard part of the tagging format, but I would check in your own console whether it appears before building a plan on it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Putting the website side next to the store side
&lt;/h2&gt;

&lt;p&gt;The site records its own event whenever a visitor clicks a Play link. In Google Analytics 4 that event is called play_click, and it carries the app name and the page where the click happened. So the website knows how many people left for the store, and Play Console knows how many arrived and installed.&lt;/p&gt;

&lt;p&gt;Put the two numbers side by side:&lt;/p&gt;

&lt;p&gt;Website: 40 play_click events on the weekly summary, as an example of the shape.&lt;/p&gt;

&lt;p&gt;Play Console: the visitors from that referral source over the same week.&lt;/p&gt;

&lt;p&gt;They will not match exactly. Some people click twice, some already have the app, some close the page, and the reports use different counting rules. The gap is still useful: if clicks are high and visitors are low, check the link. If visitors are high and installs are low, look at the page itself.&lt;/p&gt;

&lt;h2&gt;
  
  
  What a store listing experiment can test
&lt;/h2&gt;

&lt;p&gt;Under Grow users, Store presence, Store listing experiments, you can run an A/B test on the page. From Google's help page for experiments:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A default graphics experiment tests the icon, the feature graphic and the screenshots.&lt;/li&gt;
&lt;li&gt;A localized experiment can also test the descriptions, in one language at a time.&lt;/li&gt;
&lt;li&gt;An app can run one default graphics experiment or up to five localized ones at the same time.&lt;/li&gt;
&lt;li&gt;You test up to two variants against your current listing, and traffic is split equally between variants.&lt;/li&gt;
&lt;li&gt;You choose the experiment audience percentage, which is the share of store impressions that see a variant.&lt;/li&gt;
&lt;li&gt;The target metric is a unique user count of install clicks, open clicks or pre-registration clicks.&lt;/li&gt;
&lt;li&gt;An experiment stops by itself after six months.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Notice what is missing from that page: it does not say that a promo video or a short description can be tested. Do not plan around those until you see them in your own console.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to read the result
&lt;/h2&gt;

&lt;p&gt;When you create the experiment, Play Console estimates how long it needs and how many installs are required for a significant result. Two settings shape the answer. The confidence level controls how often the reported range contains the true value, so a higher level means fewer false winners. The minimum detectable effect is the smallest difference that counts. Anything smaller is reported as a draw.&lt;/p&gt;

&lt;p&gt;The outcomes are simple: apply a variant, more data needed, or draw. On a draw you can keep the current page. That is a valid result, not a failure.&lt;/p&gt;

&lt;h2&gt;
  
  
  The limits that matter for a small developer
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Small traffic means long waits. A page with a few visitors per day cannot show a small difference within months. Test big changes, not a slightly different shade.&lt;/li&gt;
&lt;li&gt;Change one thing per experiment. If you replace the icon and the screenshots together, you will not know which one worked.&lt;/li&gt;
&lt;li&gt;Do not change your tagged links in the middle of an experiment. You want one moving part at a time.&lt;/li&gt;
&lt;li&gt;A source row of three installs is a story, not a statistic. Count in dozens and compare channels over weeks.&lt;/li&gt;
&lt;li&gt;Keep a log of dates: when you changed a graphic, when you started an experiment, when you published a new link.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;About my own record: I have planned experiments, for example a test of a page with and without a store video, written as an unchecked item in my release checklists. I have no finished experiment to report, so I will not claim any result. What I can show is the tagging that is already in place.&lt;/p&gt;

&lt;h2&gt;
  
  
  A routine you can repeat for every new link
&lt;/h2&gt;

&lt;p&gt;Before you publish a link anywhere, run the same short routine. It takes two minutes and removes most mistakes.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Write the source and medium on a note first, using only lowercase letters.&lt;/li&gt;
&lt;li&gt;Build the store address with the referrer value percent-encoded.&lt;/li&gt;
&lt;li&gt;Open it once in a private window and check that the store page loads.&lt;/li&gt;
&lt;li&gt;Add the link to a small log with the date and the place it was published.&lt;/li&gt;
&lt;li&gt;A few days later, open Conversion analysis and look for the new source row.&lt;/li&gt;
&lt;li&gt;If the row is missing, remember that rows with too few visitors fall under Other. Wait before you blame the link.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That last step saves the most time. A new link with five visitors will not appear on its own row, and that is normal, not a bug.&lt;/p&gt;

&lt;h2&gt;
  
  
  FAQ
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Where do I see which link brought a Play visitor?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In Play Console under Grow users, Store performance, Conversion analysis. Filter the traffic source to ads and referrals to use the UTM source and campaign filters.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How long does a store listing experiment run?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Google gives no fixed minimum. The creation page estimates the time and installs needed, and an experiment stops automatically after six months.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What can a default graphics experiment test?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The icon, the feature graphic and the screenshots. Localized experiments can also test the descriptions.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Are values like utm_source case sensitive?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Yes. Google treats utm_source=google and utm_source=Google as different values, so use lowercase everywhere.&lt;/p&gt;

</description>
      <category>googleplay</category>
      <category>analytics</category>
      <category>android</category>
      <category>indiedev</category>
    </item>
    <item>
      <title>Is Your Nonogram Unique? Line Solvers and No-Guess Puzzles</title>
      <dc:creator>Nesim Razon</dc:creator>
      <pubDate>Thu, 26 Nov 2026 09:30:06 +0000</pubDate>
      <link>https://dev.to/nesimrazon/is-your-nonogram-unique-line-solvers-and-no-guess-puzzles-5d9f</link>
      <guid>https://dev.to/nesimrazon/is-your-nonogram-unique-line-solvers-and-no-guess-puzzles-5d9f</guid>
      <description>&lt;p&gt;A nonogram looks simple: numbers on the edges, squares to fill. The hard part for a puzzle maker is making sure the picture has one answer and that a player can reach it by pure logic. Here is how a small line solver does that check, and how I use it to generate snowflake pictures in a winter puzzle app.&lt;/p&gt;

&lt;h2&gt;
  
  
  What a nonogram is
&lt;/h2&gt;

&lt;p&gt;A nonogram is a grid with numbers beside every row and above every column. Each number says how many filled squares in a row sit together on that line. Between two groups there is at least one empty square.&lt;/p&gt;

&lt;p&gt;Example for a line of 5 squares:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Clue 3 1: three filled, one empty, one filled. Only one arrangement fits: filled, filled, filled, empty, filled.&lt;/li&gt;
&lt;li&gt;Clue 2 1: three arrangements fit: filled-filled-empty-filled-empty, filled-filled-empty-empty-filled, or empty-filled-filled-empty-filled.&lt;/li&gt;
&lt;li&gt;Clue 0: the whole line is empty.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;When every row and column is correct, the filled squares form a picture. In Snowlings, the winter picture appears once the numbers all match.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why a unique solution matters
&lt;/h2&gt;

&lt;p&gt;Take a 2 by 2 grid where every row clue and every column clue is 1. Two pictures fit: one diagonal or the other. The clues cannot tell them apart, so the player must guess, and a wrong guess shows up only much later.&lt;/p&gt;

&lt;p&gt;That is the failure a puzzle maker wants to avoid. If a puzzle has several answers, the player cannot be sure any move is certain, and the "just think harder" promise breaks. A unique answer means each step can be justified by the clues alone.&lt;/p&gt;

&lt;h2&gt;
  
  
  The line solver: find the certain cells
&lt;/h2&gt;

&lt;p&gt;The core idea is to look at one line at a time. List every way the clue can be laid out on that line without breaking the cells already known. A cell that is filled in every arrangement is certainly filled. A cell that is empty in every arrangement is certainly empty. Everything else stays unknown.&lt;/p&gt;

&lt;p&gt;The classic shortcut is the overlap. With clue 7 on a line of 10 squares, the block can start anywhere from the first to the fourth square. Slide it all the way left and all the way right and compare:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Leftmost position covers squares 1 to 7.&lt;/li&gt;
&lt;li&gt;Rightmost position covers squares 4 to 10.&lt;/li&gt;
&lt;li&gt;Squares 4, 5, 6 and 7 are in both, so they are certainly filled.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The solver in the Snowlings code does not use only this shortcut. It first checks with memoized recursion that the clue can be placed at all given the known cells, then walks through the valid placements and records, for every square, whether it can be filled and whether it can be empty. If it can only be filled, it becomes filled. If it can only be empty, it becomes empty. If the clue cannot be placed at all, the function returns null, which means a contradiction.&lt;/p&gt;

&lt;h2&gt;
  
  
  Repeat over rows and columns
&lt;/h2&gt;

&lt;p&gt;One pass over a line rarely finishes the picture, but what you learn in a row helps the columns, and the other way round. The check is a loop, written here in plain steps:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Start with a grid where every square is unknown.&lt;/li&gt;
&lt;li&gt;For each row, run the line solver and write back the new certain squares.&lt;/li&gt;
&lt;li&gt;For each column, do the same.&lt;/li&gt;
&lt;li&gt;If anything changed in this round, go back to step 2.&lt;/li&gt;
&lt;li&gt;Stop when nothing changes.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;At the end, look at the grid. If no unknown square is left, the puzzle is solvable by line logic alone. If unknown squares remain, like in the 2 by 2 example, the line solver is stuck and a human would have to guess or use deeper reasoning. If a line reports a contradiction, the clues describe no picture at all.&lt;/p&gt;

&lt;h2&gt;
  
  
  The no-guess rule, and why it implies uniqueness
&lt;/h2&gt;

&lt;p&gt;In the Snowlings nonogram code the rule is written in the file header: a picture becomes a level only if the line solver solves it completely. The function that checks it is called lineSolvable.&lt;/p&gt;

&lt;p&gt;This also proves uniqueness. Every square the solver fills is forced by the clues, so any valid picture must agree with it. If all squares end up decided, only one picture is possible. The reverse is not true: a puzzle can have a single answer and still need harder reasoning than lines. The rule is therefore stricter than uniqueness, which is the point: it removes guessing, not just ambiguity.&lt;/p&gt;

&lt;p&gt;The rule is enforced in tests. One test checks that the generated 10 by 10 pictures for ids 0 to 4 and a 12 by 12 picture are line-solvable, another test requires at least three of the hand-drawn pictures to pass, and a level test asserts lineSolvable for the nonogram levels it builds. The hand-drawn pictures that fail are simply filtered out of the game.&lt;/p&gt;

&lt;h2&gt;
  
  
  Generating symmetric snowflake pictures
&lt;/h2&gt;

&lt;p&gt;Hand-drawn pictures are limited, so the generator makes decorative snowflake-like ones. The recipe is short:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Fill the top-left quarter at random. For a 10 by 10 grid that is 5 by 5, so 25 cells; for 12 by 12 it is 36.&lt;/li&gt;
&lt;li&gt;Each cell is filled with a probability between 0.5 and 0.64, picked per attempt.&lt;/li&gt;
&lt;li&gt;Mirror the quarter left to right and top to bottom, so the picture has four-fold symmetry.&lt;/li&gt;
&lt;li&gt;Reject it if any row or any column is completely empty.&lt;/li&gt;
&lt;li&gt;Run the line solver. If it solves the picture, keep it. If not, try again with a new seed.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The seed comes from the level id, the size and the attempt number, so the same level id always gives the same picture on every device. After 300 failed attempts the generator relaxes to mirroring left to right only. In practice the symmetric version is expected to succeed first; I have not measured how many attempts it usually needs, so I will not quote a number.&lt;/p&gt;

&lt;h2&gt;
  
  
  Levels, hints and where this runs
&lt;/h2&gt;

&lt;p&gt;The same solver decides what players see. In free play the first three pictures are 5 by 5 teaching pictures, then the hand-drawn 10 by 10 ones, then generated pictures: 10 by 10 below index 20 and 12 by 12 after that. In the Advent calendar the first nonogram door uses a 5 by 5 picture, and days 24, 25 and 31 have fixed pictures: a gift, a tree and a star.&lt;/p&gt;

&lt;p&gt;The hint button works differently from the solver. It does not reason; it compares your marks with the stored picture and fixes the first wrong or missing square it finds, scanning row by row. That is fine because the picture is known to be the one solvable answer.&lt;/p&gt;

&lt;p&gt;If you like this kind of puzzle, the nonogram game in Snowlings is built on exactly this solver, so you can finish every picture without guessing.&lt;/p&gt;

&lt;h2&gt;
  
  
  FAQ
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;What is a nonogram?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A grid puzzle where the numbers beside each row and column tell how many filled squares sit together on that line. Solving it reveals a picture.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How can I tell if a nonogram has only one solution?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Run a solver. If a line solver alone fills every square, the answer is unique. If it gets stuck, the puzzle may have several answers or need deeper reasoning.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is the overlap method?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Place the clue at its leftmost and rightmost positions on the line. Squares covered in both positions are certainly filled.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Does a unique solution mean no guessing is needed?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Not always. A puzzle can have one answer but still need reasoning beyond single lines. A line-solvable puzzle needs none.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why do generated nonograms use symmetry?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Mirroring a random quarter gives a tidy snowflake-like picture, and the solver check removes the ones that would need guessing.&lt;/p&gt;




&lt;p&gt;If you want to see this in action, Snowlings is free on &lt;a href="https://play.google.com/store/apps/details?id=com.snowlings.nesimapps&amp;amp;referrer=utm_source%3Ddev.to%26utm_medium%3Dpost%26utm_campaign%3Dnonogram-unique-solution-row-solver"&gt;Google Play&lt;/a&gt; and needs no account. More notes like this one live on &lt;a href="https://nesimapps.com/blog/" rel="noopener noreferrer"&gt;my site&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>algorithms</category>
      <category>gamedev</category>
      <category>puzzle</category>
      <category>kotlin</category>
    </item>
    <item>
      <title>Same Seed, Same Level on Android and iOS in Kotlin Multiplatform</title>
      <dc:creator>Nesim Razon</dc:creator>
      <pubDate>Thu, 26 Nov 2026 09:30:05 +0000</pubDate>
      <link>https://dev.to/nesimrazon/same-seed-same-level-on-android-and-ios-in-kotlin-multiplatform-4ccj</link>
      <guid>https://dev.to/nesimrazon/same-seed-same-level-on-android-and-ios-in-kotlin-multiplatform-4ccj</guid>
      <description>&lt;p&gt;My winter puzzle app shares one Kotlin codebase between Android and iOS, and its levels are generated, not stored. If the two platforms drew different random numbers from the same seed, a friend on an iPhone would see a different door puzzle than I do on Android. The fix is small: a 20-line random generator that lives in shared code. Here is how it works, how each level gets its seed, and how the result is verified and kept off the main thread.&lt;/p&gt;

&lt;h2&gt;
  
  
  The problem: one seed, two different levels
&lt;/h2&gt;

&lt;p&gt;Generated levels only make sense if the seed decides everything. Level 14 of a sorting game must be the same puzzle for every player, on every device, today and after the next update. That is easy on one platform. It gets fragile with two.&lt;/p&gt;

&lt;p&gt;Common Kotlin code cannot use java.util.Random at all, because that class exists only on the JVM. The default random source, Random.Default, cannot be seeded. Kotlin also has a seedable Random(seed), but I chose not to depend on a library detail for something that defines my levels. If an update ever changed its algorithm, every level in the app would silently change with it.&lt;/p&gt;

&lt;p&gt;So the rule is: the generator is my own code, in the shared module, and nothing else may produce randomness for a level.&lt;/p&gt;

&lt;h2&gt;
  
  
  The generator: xorshift in about 20 lines
&lt;/h2&gt;

&lt;p&gt;The class is called Rng and sits in the shared core package. It is xorshift64 with a multiplication, often written xorshift64*. State is one 64-bit Long. Each step does three shifts and xors, then multiplies:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;x = x xor (x ushr 12)&lt;/li&gt;
&lt;li&gt;x = x xor (x shl 25)&lt;/li&gt;
&lt;li&gt;x = x xor (x ushr 27)&lt;/li&gt;
&lt;li&gt;result = x * 0x2545F4914F6CDD1D&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Why this is safe on both platforms: a Kotlin Long is always 64 bits, overflow wraps around, and ushr is a logical shift. Android and iOS run the same arithmetic, so they produce the same sequence. Two small details protect it. A seed of 0 is replaced by the constant 0x2545F4914F6CDD1D, because an all-zero xorshift state never moves. And the constructor throws away the first four outputs, so that similar seeds do not start with similar numbers.&lt;/p&gt;

&lt;h2&gt;
  
  
  From a raw number to what a level needs
&lt;/h2&gt;

&lt;p&gt;Everything else is built on nextLong. Each helper is one line you can follow by hand:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;nextInt(n): take nextLong ushr 1 (so it is never negative), then the remainder when divided by n.&lt;/li&gt;
&lt;li&gt;nextFloat(): take the top 24 bits of the number and divide by 16777216, which is 2 to the power 24. A Float holds 24 bits exactly, so no rounding differs between platforms.&lt;/li&gt;
&lt;li&gt;chance(p): nextFloat() is less than p.&lt;/li&gt;
&lt;li&gt;pick(list) and shuffled(list): shuffled is a Fisher-Yates loop from the last index down to 1.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The remainder in nextInt has a tiny bias for large n. For a grid of a few dozen cells that is irrelevant, and it is the same bias on both platforms, which is the property that matters here.&lt;/p&gt;

&lt;h2&gt;
  
  
  One seed per level, and one per retry
&lt;/h2&gt;

&lt;p&gt;Seeds are built by a second function, seedOf. It takes any parts, such as a game name and a level number, and folds every UTF-16 character of their text into a 64-bit hash with an xor and a multiplication by 1099511628211, starting from 1469598103934665603. It is a hash in the FNV style; I use it only to spread text and numbers into one Long, not for security.&lt;/p&gt;

&lt;p&gt;A real call from the gift sorting game looks like this: Rng(seedOf("sort", id, attempt)). The game name keeps different games from sharing sequences. The id is the level. The attempt counter matters most: when a generated level is rejected, the next try uses attempt plus one, which is again a fixed seed. Retries are therefore deterministic too. Level 14 always ends on the same attempt, on every device.&lt;/p&gt;

&lt;p&gt;The calendar part works the same way. Door puzzles in the app get their level id from the day: 1000 plus the day number for most doors of the season. Because the id is a plain Int, no locale, time zone or float formatting can change what goes into the hash.&lt;/p&gt;

&lt;h2&gt;
  
  
  Generate, then let a solver say yes
&lt;/h2&gt;

&lt;p&gt;Random alone does not give playable levels. The generator makes a candidate and a solver checks it. For the sorting game, difficulty d from 1 to 10 gives colors = 3 + (d + 1) / 2, capped at 8, and the generator starts from a solved board and makes 25 + d * 14 reverse moves. So d = 1 means 4 colors and 39 shuffles, d = 5 means 6 colors and 95, d = 10 means 8 colors and 165.&lt;/p&gt;

&lt;p&gt;A candidate is skipped if it ended up already solved, or if too many tubes are still sorted. Otherwise a best-first search with a limit of 60000 nodes must find a solution. If it does not, the loop continues with the next attempt. The ice sliding game does the same with up to 400 attempts and keeps the closest result if none lands in the wanted move range. The picture puzzle tries 300 symmetric patterns before it falls back to a mirrored one, and in every case a row solver must solve it completely.&lt;/p&gt;

&lt;p&gt;The longer story of this check is in the article How Puzzle Levels Are Generated and Checked. The part that matters here is that the solver is also shared code, so both platforms accept and reject the same candidates.&lt;/p&gt;

&lt;h2&gt;
  
  
  Build it off the main thread
&lt;/h2&gt;

&lt;p&gt;A search with up to 60000 nodes can take a noticeable time, and a code comment in the project says why it matters: on Kotlin/Native heavy levels must not freeze the main thread. All six game screens therefore use one small Compose function, rememberLevel(key, build). Inside it, produceState starts with null and sets the value from withContext(Dispatchers.Default) { build() }.&lt;/p&gt;

&lt;p&gt;In practice a screen asks for its level like this: rememberLevel(req.levelId to req.difficulty) { GiftSort.generate(req.levelId, req.difficulty) }. The key tells Compose when to start again. While the value is null the screen shows a loading box, a small turning snowflake. When the value arrives, the game appears. Because generation is deterministic, running it on a background thread cannot change the result, only when it arrives.&lt;/p&gt;

&lt;h2&gt;
  
  
  Testing: same seed, same result
&lt;/h2&gt;

&lt;p&gt;The repository has a test class, AllLevelsTest, that builds every level a player can reach: doors 1 to 31 and every free-play level, and asserts that each one has a solution. It runs as a host test on the JVM side, so it proves solvability, not equality between platforms.&lt;/p&gt;

&lt;p&gt;For the equality itself the check is short. Create two generators with the same seed, draw 1000 numbers from each and compare the lists. Then generate the same level twice and compare the boards. A third check is worth adding when you have an iOS build: write the first 100 outputs for a few fixed seeds into the test as expected values, so any change to the generator, on any platform, breaks the build instead of changing levels quietly. I describe this as a pattern; the stored-values test is the one you would add, not one I can point to in the repo today.&lt;/p&gt;

&lt;p&gt;Rules I follow: never pass Floats or locale-dependent text into a seed, never read the clock inside generation, and never add a second random source to a level.&lt;/p&gt;

&lt;h2&gt;
  
  
  FAQ
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Why not use java.util.Random in shared Kotlin code?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;It exists only on the JVM, so it is not available in common code that also targets iOS.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is xorshift64*?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A small random generator with one 64-bit state. Each step uses three shift-and-xor operations and a final multiplication. It is fast and fully defined by integer arithmetic.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why include the attempt number in the seed?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Rejected candidates are retried with a new seed, and keeping the attempt in the seed makes the retries deterministic, so a level always ends on the same attempt.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why generate levels on Dispatchers.Default?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A solver search can take time. Running it in produceState with Dispatchers.Default keeps the screen responsive, and determinism guarantees the same result.&lt;/p&gt;




&lt;p&gt;If you want to see this in action, Snowlings is free on &lt;a href="https://play.google.com/store/apps/details?id=com.snowlings.nesimapps&amp;amp;referrer=utm_source%3Ddev.to%26utm_medium%3Dpost%26utm_campaign%3Dkotlin-multiplatform-deterministic-random-xorshift-levels"&gt;Google Play&lt;/a&gt; and needs no account. More notes like this one live on &lt;a href="https://nesimapps.com/blog/" rel="noopener noreferrer"&gt;my site&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>kotlin</category>
      <category>kmp</category>
      <category>gamedev</category>
      <category>algorithms</category>
    </item>
  </channel>
</rss>
