1 / 5

第2回 解答

第2回 解答. ファンクション Naranda. function Naranda(N : TBangou) : Boolean; {N 番を含む列に同じマークが3つ並んだか調べる } begin case N of 1 : Result := Onaji(1,2,3) or Onaji(1,4,7) or Onaji(1,5,9); 2 : Result := Onaji(1,2,3) or Onaji(2,5,8);

gittel
Download Presentation

第2回 解答

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 第2回 解答

  2. ファンクション Naranda function Naranda(N : TBangou) : Boolean; {N 番を含む列に同じマークが3つ並んだか調べる} begin case N of 1 : Result := Onaji(1,2,3) or Onaji(1,4,7) or Onaji(1,5,9); 2 : Result := Onaji(1,2,3) or Onaji(2,5,8); 3 : Result := Onaji(1,2,3) or Onaji(3,6,9) or Onaji(3,5,7); 4 : Result := Onaji(4,5,6) or Onaji(1,4,7); 5 : Result := Onaji(4,5,6) or Onaji(2,5,8) or Onaji(1,5,9) or Onaji(3,5,7); 6 : Result := Onaji(4,5,6) or Onaji(3,6,9); 7 : Result := Onaji(7,8,9) or Onaji(1,4,7) or Onaji(3,5,7); 8 : Result := Onaji(7,8,9) or Onaji(2,5,8); 9 : Result := Onaji(7,8,9) or Onaji(3,6,9) or Onaji(1,5,9); else Result := False; // 必要ないが,警告が出なくなる end; end; {Naranda}

  3. プロシージャ TebanKoutai 変更前 procedure TebanKoutai(var Player : TPlayer); {手番を交代する} begin case Player of Maru : begin Player := Batu; WriteLn('×の番です'); end; Batu : begin Player := Maru; WriteLn('○の番です'); end; end; end; {TebanKoutai}

  4. プロシージャ TebanKoutai 変更後 procedure TebanKoutai(var Player : TPlayer); {手番を交代する} begin if Player = Maru then begin Player := Batu; WriteLn('×の番です'); end else begin Player := Maru; WriteLn('○の番です'); end; end; {TebanKoutai}

  5. プロシージャ BanWoKaku procedure BanWoKaku; {盤を書く} var N : TBangou; begin WriteLn('┌─┬─┬─┐'); for N := 1 to 9 do begin Write('│'); YousoWoKaku(N); if N in [3,6] then begin WriteLn('│'); WriteLn('├─┼─┼─┤'); end; end; WriteLn('│'); WriteLn('└─┴─┴─┘'); end; {BanWoKaku}

More Related