Example #1
0
    private void digHole()
    {
        char ch;
        int  i, j, k, m;

        for (i = 0; i < 81; i++)
        {
            hasTryed[i] = false;
        }
        bool flag;

        for (i = 0; i < 81; i++)
        {
            do
            {
                m = MWC.random() >> 8 & 127;
            }while (m >= 81 || hasTryed[m]);
            hasTryed[m] = true;
            ch          = data[m];
            flag        = false;
            for (j = 0; j < 9; j++)
            {
                if (ch != map[j])
                {
                    for (k = 0; k < 81; k++)
                    {
                        tmp[k] = data[k];
                    }
                    tmp[m] = map[j];
                    solver.load(tmp);
                    solver.dfs(0);
                    if (solver.hasResult())
                    {
                        flag = true;
                        break;
                    }
                }
            }
            if (!flag)
            {
                data[m] = '.';
            }
            else
            {
                data[m] = ch;
            }
        }
    }
Example #2
0
    private void randomFill()
    {
        int x;

        MWC.setSeed((int)GetCurrentTimeUnix());
        for (int i = 0; i < 81; i++)
        {
            data[i] = '.';
        }
        for (int i = 0; i < 9; i++)
        {
            do
            {
                x = MWC.random() >> 9 & 15;
            }while (x > 8);
            data[i * 9 + x] = map[i];
        }
        solver.load(data);
        solver.dfs(0);
    }
		/// <summary>
		/// for iPad (SplitViewController)
		/// </summary>
		public ExhibitorElement (BL.Exhibitor showExhibitor, MWC.iOS.Screens.iPad.Exhibitors.ExhibitorSplitView exhibitorSplitView) : base ("")
		{
			exhibitor = showExhibitor;
			splitView = exhibitorSplitView;	// could be null, in current implementation
		}
 /// <summary>
 /// for iPad (SplitViewController)
 /// </summary>
 public UserGroupElement(BL.UserGroup showUserGroup, MWC.iOS.Screens.iPad.UserGroups.UserGroupsSplitView usergroupSplitView)
     : base("")
 {
     usergroup = showUserGroup;
     splitView = usergroupSplitView;	// could be null, in current implementation
 }
Example #5
0
		/// <summary>
		/// for iPad (SplitViewController)
		/// </summary>
		public NewsElement (RSSEntry showEntry, UIImage showImage, MWC.iOS.Screens.iPad.News.NewsSplitView newsSplitView) : base (showEntry.Title)
		{
			entry = showEntry;
			image = showImage;
			splitView = newsSplitView;	// could be null, in current implementation
		}
Example #6
0
 /// <summary>iPad only method</summary>
 void SessionClicked(object sender, MWC.iOS.AL.FavoriteClickedEventArgs args)
 {
     var s = new MWC.iOS.Screens.iPad.SessionPopupScreen(args.SessionClicked, this);
     s.ModalPresentationStyle = UIModalPresentationStyle.FormSheet;
     PresentModalViewController (s, true);
 }
Example #7
0
		/// <summary>iPad only method</summary>
		void SessionClicked (object sender, MWC.iOS.AL.FavoriteClickedEventArgs args)
		{
			var s = new MWC.iOS.Screens.iPad.SessionPopupScreen(args.SessionClicked, this);

			//HACK: UIPresentationStyle doesn't exist anymore
			//s.UIPresentationStyle = UIModalPresentationStyle.FormSheet;

			PresentViewController (s, true, null);
		}
Example #8
0
		/// <summary>for iPad (SplitViewController)</summary>
		public SpeakerElement (Speaker showSpeaker, MWC.iOS.Screens.iPad.Speakers.SpeakerSplitView speakerSplitView) : base (showSpeaker.Name)
		{
			speaker = showSpeaker;
			splitView = speakerSplitView;
		}
Example #9
0
		/// <summary>
		/// for iPad (SplitViewController)
		/// </summary>
		public TweetElement (Tweet showTweet, MWC.iOS.Screens.iPad.Twitter.TwitterSplitView twitterSplitView) : base (showTweet.Author)
		{
			tweet = showTweet;
			splitView = twitterSplitView;	// could be null, in current implementation
		}
    public void handle(char[] data)
    {
        int i, j, k, r, sum;

        for (i = 0; i < 81; i++)
        {
            res[i] = data[i];
        }
        for (i = 0; i < 9; i++)
        {
            hintsAtCloumn[i] = 0;
            for (j = 0; j < 9; j++)
            {
                if (data[j * 9 + i] != '.')
                {
                    hintsAtCloumn[i]++;
                }
            }
        }
        solver.load(res);
        solver.dfs(0);
        sum = 0;
        for (i = 0; i < 9; i++)
        {
            k = 0;
            for (j = 0; j < 9; j++)
            {
                if (data[i * 9 + j] != '.')
                {
                    k++;
                }
            }
            while (k < LowerBound)
            {
                //				do r = MWC.random() >> 9 & 15; while(r > 8 || data[i * 9 + r] != '.');
                int minColumn = 0, minCells;
                minCells = 9;
                for (int m = 0; m < 9; m++)
                {
                    if (data[i * 9 + m] == '.' && hintsAtCloumn[m] < minCells)
                    {
                        minCells  = hintsAtCloumn[m];
                        minColumn = m;
                    }
                }
                data[i * 9 + minColumn] = res[i * 9 + minColumn];
                hintsAtCloumn[minColumn]++;
                k++;
            }
            sum += k;
        }
        if (sum > Total_UperBound)
        {
            isInvalid = true;
            return;
        }
        isInvalid = false;
        k         = random.Next(Total_UperBound - Total);
        for (; sum < Total + k; sum++)
        {
            do
            {
                r = MWC.random() >> 8 & 127;
            } while (r > 80 || data[r] != '.');
            data[r] = res[r];
        }
        Debug.Log("" + sum);
    }
Example #11
0
		/// <summary>for iPad (SplitViewController)</summary>
		public SessionElement (Session session, MWC.iOS.Screens.iPad.Sessions.SessionSplitView sessionSplitView) : this (session)
		{
			splitView = sessionSplitView;
		}
		public SessionsTableSource (List<Session> sessions, MWC.iOS.Screens.iPhone.Speakers.SpeakerDetailsScreen view)
		{
			this.sessions = sessions;
			this.view = view;
		}
		public SpeakersTableSource (List<Speaker> speakers, MWC.iOS.UI.Controls.Views.SessionView view)
		{
			this.speakers = speakers;
			this.view = view;
		}
Example #14
0
		/// <summary>
		/// Change the session info being displayed in the view
		/// </summary>
		public void Update (MWC.BL.Session session)
		{
			if (speakerTable != null) // need to re-set, incase index 10 was selected last time and new session has fewer speakers
				speakerTable.SelectRow (NSIndexPath.FromRowSection (0,0), true, UITableViewScrollPosition.Top);

			showSession = session;
			Update ();
			LayoutSubviews ();
		}