AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Mal wieder ein Sudoku Problem

Ein Thema von Furious Dragon · begonnen am 21. Mai 2006 · letzter Beitrag vom 30. Jun 2006
 
marabu

Registriert seit: 6. Apr 2005
10.109 Beiträge
 
#5

Re: Mal wieder ein Sudoku Problem

  Alt 21. Mai 2006, 18:30
Du kombinierst einfach Ollis genialen Einfall und meinen Schwachsinn und dann erhältst du sowas:

Delphi-Quellcode:
function BigToSmall(
  iBigCol, iBigRow: Integer;
  var iBlockCol, iBlockRow, iSmallCol, iSmallRow: Integer
): Boolean;
begin
  Result := (iBigCol in [0..8]) and (iBigRow in [0..8]);
  if Result then
  begin
    iBlockCol := iBigCol div 3;
    iBlockRow := iBigRow div 3;
    iSmallCol := iBigCol mod 3;
    iSmallRow := iBigRow mod 3;
  end;
end;

function SmallToBig(
  iBlockCol, iBlockRow, iSmallCol, iSmallRow: Integer;
  var iBigCol, iBigRow: Integer
): Boolean;
begin
  Result := (iBlockCol in [0..2]) and (iBlockRow in [0..2])
    and (iSmallCol in [0..2]) and (iSmallRow in [0..2]);
  if Result then
  begin
    iBigCol := 3 * iBlockCol + iSmallCol;
    iBigRow := 3 * iBlockRow + iSmallRow;
  end;
end;
Freundliche Grüße vom marabu
  Mit Zitat antworten Zitat
 


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 19:27 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz