-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGameWindow.t
107 lines (75 loc) · 2.49 KB
/
GameWindow.t
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
% MAIN PROGRAM STEPS %
procedure displayGameWindow
% flag that intro screen is open - global var isIntroWindowOpen
isGameWindowOpen := true
% Open the window
var winID : int
winID := Window.Open ("position:top;center,graphics:1250;700,title:Othello")
Window.Hide (wininID)
fork click
fork backgroundMusic
%The Game
%Othello
% Othello Game. Put pieces into starting position
setBoardStartingPosition
countScores (GameBoardArray)
%displayIntroWindow
% display board with starting black and white chips
DrawBoard (GameBoardArray)
% Player 1's turn.
loop
if Player mod 2 = 0 then
%draw all legal moves
possibleMoves (Player)
% Player pick a cell using a mouse click.
loop
getMove (Player, row, col)
if isOccupied (row, col) = false then
exit when isLegal (Player, row, col, GameBoardArray) = true
end if
% Check if legal click/selection - if not legal go to a.
end loop
PlayerTurn += 1
% Flip white chips to black.
executeMove (Player, row, col, GameBoardArray)
resetDirections
countScores (GameBoardArray)
DrawBoard (GameBoardArray)
% Change Player
Player += 1
% Check for winning condition
if isFullyOccupied (GameBoardArray) = true or endgame (Player) = false then
% if it is full, end Game. displayEngGame will determine a winner by calling ResultWinnerorDraw
Time.Delay (2000)
Window.Close (winID)
displayOutroWindow
end if
else
%draw all legal moves
possibleMoves (Player)
% Player pick a cell using a mouse click.
loop
getMove (Player, row, col)
if isOccupied (row, col) = false then
exit when isLegal (Player, row, col, GameBoardArray) = true
end if
% Check if legal click/selection - if not legal go to a.
end loop
PlayerTurn += 1
% Flip white chips to black.
executeMove (Player, row, col, GameBoardArray)
resetDirections
countScores (GameBoardArray)
DrawBoard (GameBoardArray)
% Change Player
Player += 1
% Check for winning condition
if isFullyOccupied (GameBoardArray) = true or endgame (Player) = false then
% if it is full, end Game. displayEngGame will determine a winner by calling ResultWinnerorDraw
Time.Delay (2000)
Window.Close (winID)
displayOutroWindow
end if
end if
end loop
end displayGameWindow