Beispiel #1
0
        //������
        private void OpenFile()
        {
            OpenFileDialog openDlg = new OpenFileDialog();
            openDlg.Filter  = "sgf files (*.sgf)|*.sgf|All Files (*.*)|*.*";
            openDlg.FileName = "" ;
            openDlg.DefaultExt = ".sgf";
            openDlg.CheckFileExists = true;
            openDlg.CheckPathExists = true;

            DialogResult res = openDlg.ShowDialog ();

            if(res == DialogResult.OK)
            {
                if( !(openDlg.FileName).EndsWith(".sgf") && !(openDlg.FileName).EndsWith(".SGF"))
                    MessageBox.Show("Unexpected file format","Super Go Format",MessageBoxButtons.OK);
                else
                {
                    FileStream f = new FileStream(openDlg.FileName, FileMode.Open);
                    StreamReader r = new StreamReader(f);
                    string s = r.ReadToEnd();
                    gameTree = new GoTree(s);
                    gameTree.reset();
                    resetBoard();
                    r.Close();
                    f.Close();
                }
            }
        }
Beispiel #2
0
        public GoBoard(int nSize)
        {
            //һ��Component��ʼ��
            InitializeComponent();

            this.nSize = nSize;  //��ʼ�����̴�С

            //��������
            m_colorToPlay = StoneColor.black;

            Grid = new Spot[nSize,nSize];
            for (int i=0; i<nSize; i++)
                for (int j=0; j<nSize; j++)
                    Grid[i,j] = new Spot();
            penGrid = new Pen(Color.Brown, (float)0.5);
            penStoneW = new Pen(Color.WhiteSmoke, (float)1);
            penStoneB = new Pen(Color.Black,(float)1);
            penMarkW = new Pen(Color.Blue, (float) 1);
            penMarkB = new Pen(Color.Beige, (float) 1);

            brStar = new SolidBrush(Color.Black);
            brBoard = new SolidBrush(Color.Orange);
            brBlack = new SolidBrush(Color.Black);
            brWhite = new SolidBrush(Color.White);
            m_brMark = new SolidBrush(Color.Red);

            rGrid = new Rectangle(nEdgeLen, nEdgeLen,nTotalGridWidth, nTotalGridWidth);
            strLabels = new string [] {"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t"};
            gameTree = new GoTree();
        }