glimmer-dsl-swt 4.20.13.13 → 4.20.13.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +5 -5
- data/VERSION +1 -1
- data/docs/reference/GLIMMER_SAMPLES.md +30 -1
- data/glimmer-dsl-swt.gemspec +0 -0
- data/samples/elaborate/connect4.rb +118 -0
- data/samples/elaborate/connect4/model/grid.rb +173 -0
- data/samples/elaborate/connect4/model/slot.rb +36 -0
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9e7f58c70a78eb8867dd0116be71fb75a3a369deeb7f5676c673dde098304d55
|
4
|
+
data.tar.gz: '078a62bf56f74b1e156ef520d39c37e15b2324367bd813d0dd6a2a3f66e52e2d'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4bb4fc88a86497ce00a50735ee2c189d9fdfb1698e8fa568e1ddad2565809d40e8602bf309fd29efc933481fe3f7d142c50ba80ee7d571dd2eb7c6d0e4dba405
|
7
|
+
data.tar.gz: c43f3edbc949886f21029c429229b73b4f5c08a89af9f7ad42a02539de8a8bc842eff606ccd090609fe05802cc9685499390bd1997f813be714e730ba2f8f801
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# [<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=85 />](https://github.com/AndyObtiva/glimmer) Glimmer DSL for SWT 4.20.13.
|
1
|
+
# [<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=85 />](https://github.com/AndyObtiva/glimmer) Glimmer DSL for SWT 4.20.13.14
|
2
2
|
## JRuby Desktop Development GUI Framework
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/glimmer-dsl-swt.svg)](http://badge.fury.io/rb/glimmer-dsl-swt)
|
4
4
|
[![Travis CI](https://travis-ci.com/AndyObtiva/glimmer-dsl-swt.svg?branch=master)](https://travis-ci.com/github/AndyObtiva/glimmer-dsl-swt)
|
@@ -15,7 +15,7 @@
|
|
15
15
|
[<img src="https://covers.oreillystatic.com/images/9780596519650/lrg.jpg" width=105 /><br />
|
16
16
|
Featured in JRuby Cookbook](http://shop.oreilly.com/product/9780596519650.do) and [Chalmers/Gothenburg University Software Engineering Master's Lecture Material](http://www.cse.chalmers.se/~bergert/slides/guest_lecture_DSLs.pdf)
|
17
17
|
|
18
|
-
[Glimmer DSL for SWT](https://rubygems.org/gems/glimmer-dsl-swt) 4.20.13.
|
18
|
+
[Glimmer DSL for SWT](https://rubygems.org/gems/glimmer-dsl-swt) 4.20.13.14 includes [SWT 4.20](https://download.eclipse.org/eclipse/downloads/drops4/R-4.20-202106111600/), which was released on June 11, 2021. Gem version numbers are in sync with the SWT library versions. The first two digits represent the SWT version number. The last two digits represent the minor and patch versions of Glimmer DSL for SWT. Note that SWT now supports AARCH64 on Mac and Linux, but it is not fully tested in Glimmer DSL for SWT yet, so deem its support experimental for the time being without guarantees for functionality until declared otherwise (report any issues you may encounter).
|
19
19
|
|
20
20
|
**Starting in version 4.20.0.0, [Glimmer DSL for SWT](https://rubygems.org/gems/glimmer-dsl-swt) comes with the new [***Shine***](/docs/reference/GLIMMER_GUI_DSL_SYNTAX.md#shine) syntax** for highly intuitive and visually expressive View/Model Attribute Mapping, relying on `<=>` for bidirectional (two-way) data-binding and `<=` for unidirectional (one-way) data-binding, providing an alternative to the `bind` keyword (keep in mind that it is still a beta, so default back to `bind` whenever needed).
|
21
21
|
|
@@ -326,7 +326,7 @@ jgem install glimmer-dsl-swt
|
|
326
326
|
|
327
327
|
Or this command if you want a specific version:
|
328
328
|
```
|
329
|
-
jgem install glimmer-dsl-swt -v 4.20.13.
|
329
|
+
jgem install glimmer-dsl-swt -v 4.20.13.14
|
330
330
|
```
|
331
331
|
|
332
332
|
`jgem` is JRuby's version of `gem` command.
|
@@ -354,7 +354,7 @@ Note: if you're using activerecord or activesupport, keep in mind that Glimmer u
|
|
354
354
|
|
355
355
|
Add the following to `Gemfile`:
|
356
356
|
```
|
357
|
-
gem 'glimmer-dsl-swt', '~> 4.20.13.
|
357
|
+
gem 'glimmer-dsl-swt', '~> 4.20.13.14'
|
358
358
|
```
|
359
359
|
|
360
360
|
And, then run:
|
@@ -375,7 +375,7 @@ glimmer
|
|
375
375
|
```
|
376
376
|
|
377
377
|
```
|
378
|
-
Glimmer (JRuby Desktop Development GUI Framework) - JRuby Gem: glimmer-dsl-swt v4.20.13.
|
378
|
+
Glimmer (JRuby Desktop Development GUI Framework) - JRuby Gem: glimmer-dsl-swt v4.20.13.14
|
379
379
|
|
380
380
|
Usage: glimmer [--bundler] [--pd] [--quiet] [--debug] [--log-level=VALUE] [[ENV_VAR=VALUE]...] [[-jruby-option]...] (application.rb or task[task_args]) [[application2.rb]...]
|
381
381
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
4.20.13.
|
1
|
+
4.20.13.14
|
@@ -60,6 +60,7 @@
|
|
60
60
|
- [User Profile](#user-profile)
|
61
61
|
- [Login](#login)
|
62
62
|
- [Tic Tac Toe](#tic-tac-toe)
|
63
|
+
- [Connect 4](#connect-4)
|
63
64
|
- [Contact Manager](#contact-manager)
|
64
65
|
- [Game of Life](#game-of-life)
|
65
66
|
- [Glimmer Tetris](#glimmer-tetris)
|
@@ -1045,6 +1046,34 @@ Code:
|
|
1045
1046
|
![Tic Tac Toe In Progress](/images/glimmer-tic-tac-toe-in-progress.png)
|
1046
1047
|
![Tic Tac Toe Game Over](/images/glimmer-tic-tac-toe-game-over.png)
|
1047
1048
|
|
1049
|
+
#### Connect 4
|
1050
|
+
|
1051
|
+
This sample demonstrates a widget/shape hybrid MVC application, including GUI layout and data-binding.
|
1052
|
+
|
1053
|
+
Code:
|
1054
|
+
|
1055
|
+
[samples/elaborate/connect4.rb](/samples/elaborate/connect4.rb)
|
1056
|
+
|
1057
|
+
Connect 4
|
1058
|
+
|
1059
|
+
![Connect 4](/images/glimmer-connect4.png)
|
1060
|
+
|
1061
|
+
Connect 4 - About To Drop
|
1062
|
+
|
1063
|
+
![Connect 4 About To Drop](/images/glimmer-connect4-about-to-drop.png)
|
1064
|
+
|
1065
|
+
Connect 4 - Dropped Coin
|
1066
|
+
|
1067
|
+
![Connect 4 Dropped Coin](/images/glimmer-connect4-dropped-coin.png)
|
1068
|
+
|
1069
|
+
Connect 4 - Player 1 Wins
|
1070
|
+
|
1071
|
+
![Connect 4 Player 1 Wins](/images/glimmer-connect4-player1-wins.png)
|
1072
|
+
|
1073
|
+
Connect 4 - Game Over Message Box
|
1074
|
+
|
1075
|
+
![Connect 4 Game Over Message Box](/images/glimmer-connect4-game-over-dialog.png)
|
1076
|
+
|
1048
1077
|
#### Contact Manager
|
1049
1078
|
|
1050
1079
|
This sample demonstrates table data-binding, sorting, filtering, GUI layout, MVP pattern, and test-driven development (has [specs](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/spec/samples/elaborate/contact_manager/contact_manager_presenter_spec.rb)).
|
@@ -1075,7 +1104,7 @@ Contact Manager - Edit Done
|
|
1075
1104
|
|
1076
1105
|
#### Game of Life
|
1077
1106
|
|
1078
|
-
This sample demonstrates how to build an interactive canvas-based visualization of Conway's Game of Life (test-first), taking advantage of data-binding and multi-threading.
|
1107
|
+
This sample demonstrates how to build an interactive canvas-based visualization of Conway's Game of Life ([test-first](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/spec/samples/elaborate/game_of_life/model/grid_spec.rb)), taking advantage of data-binding and multi-threading.
|
1079
1108
|
|
1080
1109
|
Code:
|
1081
1110
|
|
data/glimmer-dsl-swt.gemspec
CHANGED
Binary file
|
@@ -0,0 +1,118 @@
|
|
1
|
+
# Copyright (c) 2007-2021 Andy Maleh
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
# a copy of this software and associated documentation files (the
|
5
|
+
# "Software"), to deal in the Software without restriction, including
|
6
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
# the following conditions:
|
10
|
+
#
|
11
|
+
# The above copyright notice and this permission notice shall be
|
12
|
+
# included in all copies or substantial portions of the Software.
|
13
|
+
#
|
14
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
|
+
|
22
|
+
require 'glimmer-dsl-swt'
|
23
|
+
|
24
|
+
require_relative 'connect4/model/grid'
|
25
|
+
|
26
|
+
class Connect4
|
27
|
+
include Glimmer::UI::CustomShell
|
28
|
+
|
29
|
+
WIDTH = 7
|
30
|
+
HEIGHT = 6
|
31
|
+
COLOR_BACKGROUND = rgb(63, 104, 212)
|
32
|
+
COLOR_EMPTY_SLOT = :white
|
33
|
+
COLOR_COIN1 = rgb(236, 223, 56)
|
34
|
+
COLOR_COIN2 = rgb(176, 11, 23)
|
35
|
+
|
36
|
+
attr_accessor :current_player_color
|
37
|
+
|
38
|
+
before_body do
|
39
|
+
@grid = Model::Grid.new(WIDTH, HEIGHT)
|
40
|
+
select_player_color
|
41
|
+
end
|
42
|
+
|
43
|
+
after_body do
|
44
|
+
observe(@grid, :current_player) do
|
45
|
+
select_player_color
|
46
|
+
end
|
47
|
+
|
48
|
+
observe(@grid, :game_over) do |game_over_value|
|
49
|
+
if game_over_value
|
50
|
+
game_over_message = case game_over_value
|
51
|
+
when true
|
52
|
+
"Game over!\nDraw!"
|
53
|
+
when 1
|
54
|
+
"Game over!\nPlayer 1 (yellow) wins!"
|
55
|
+
when 2
|
56
|
+
"Game over!\nPlayer 2 (red) wins!"
|
57
|
+
end
|
58
|
+
|
59
|
+
message_box {
|
60
|
+
text 'Game Over!'
|
61
|
+
message game_over_message
|
62
|
+
}.open
|
63
|
+
|
64
|
+
@grid.restart!
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
body {
|
70
|
+
shell(:no_resize) {
|
71
|
+
grid_layout(7, true)
|
72
|
+
|
73
|
+
text 'Glimmer Connect 4'
|
74
|
+
background COLOR_BACKGROUND
|
75
|
+
|
76
|
+
HEIGHT.times do |row_index|
|
77
|
+
WIDTH.times do |column_index|
|
78
|
+
canvas {
|
79
|
+
layout_data {
|
80
|
+
width_hint 50
|
81
|
+
height_hint 50
|
82
|
+
}
|
83
|
+
|
84
|
+
background :transparent
|
85
|
+
|
86
|
+
the_oval = oval(0, 0, 50, 50) {
|
87
|
+
background <= [@grid.slot_rows[row_index][column_index], :value, on_read: ->(v) { v == 0 ? COLOR_EMPTY_SLOT : (v == 1 ? COLOR_COIN1 : COLOR_COIN2)}]
|
88
|
+
}
|
89
|
+
|
90
|
+
if row_index == 0
|
91
|
+
entered = false
|
92
|
+
on_mouse_enter do
|
93
|
+
entered = true
|
94
|
+
the_oval.background = current_player_color if @grid.slot_rows[row_index][column_index].value == 0
|
95
|
+
end
|
96
|
+
|
97
|
+
on_mouse_exit do
|
98
|
+
entered = false
|
99
|
+
the_oval.background = COLOR_EMPTY_SLOT if @grid.slot_rows[row_index][column_index].value == 0
|
100
|
+
end
|
101
|
+
|
102
|
+
on_mouse_up do
|
103
|
+
@grid.insert!(column_index)
|
104
|
+
the_oval.background = current_player_color if entered && @grid.slot_rows[row_index][column_index].value == 0
|
105
|
+
end
|
106
|
+
end
|
107
|
+
}
|
108
|
+
end
|
109
|
+
end
|
110
|
+
}
|
111
|
+
}
|
112
|
+
|
113
|
+
def select_player_color
|
114
|
+
self.current_player_color = @grid.current_player == 1 ? COLOR_COIN1 : COLOR_COIN2
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
Connect4.launch
|
@@ -0,0 +1,173 @@
|
|
1
|
+
# Copyright (c) 2007-2021 Andy Maleh
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
# a copy of this software and associated documentation files (the
|
5
|
+
# "Software"), to deal in the Software without restriction, including
|
6
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
# the following conditions:
|
10
|
+
#
|
11
|
+
# The above copyright notice and this permission notice shall be
|
12
|
+
# included in all copies or substantial portions of the Software.
|
13
|
+
#
|
14
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
|
+
|
22
|
+
require_relative 'slot'
|
23
|
+
|
24
|
+
class Connect4
|
25
|
+
module Model
|
26
|
+
class Grid
|
27
|
+
attr_reader :width, :height, :slot_rows
|
28
|
+
attr_accessor :current_player, :game_over
|
29
|
+
|
30
|
+
def initialize(width, height)
|
31
|
+
@width = width
|
32
|
+
@height = height
|
33
|
+
build_slots
|
34
|
+
start!
|
35
|
+
end
|
36
|
+
|
37
|
+
def start!
|
38
|
+
self.game_over = false
|
39
|
+
self.current_player = 1
|
40
|
+
reset_slots
|
41
|
+
end
|
42
|
+
alias restart! start!
|
43
|
+
|
44
|
+
def insert!(column_index)
|
45
|
+
found_row_index = bottom_most_free_row_index(column_index)
|
46
|
+
raise "Illegal move at #{column_index}" if found_row_index == -1
|
47
|
+
@slot_rows[found_row_index][column_index].value = @current_player
|
48
|
+
self.current_player = @current_player%2 + 1
|
49
|
+
evaluate_game_over
|
50
|
+
end
|
51
|
+
|
52
|
+
# returns bottom most free row index
|
53
|
+
# returns -1 if none
|
54
|
+
def bottom_most_free_row_index(column_index)
|
55
|
+
found_row_index = @slot_rows.size - 1
|
56
|
+
found_row_index -= 1 until found_row_index == -1 || @slot_rows[found_row_index][column_index].value == 0
|
57
|
+
found_row_index
|
58
|
+
end
|
59
|
+
|
60
|
+
private
|
61
|
+
|
62
|
+
def build_slots
|
63
|
+
@slot_rows = height.times.map do |row_index|
|
64
|
+
width.times.map do |column_index|
|
65
|
+
Slot.new(self)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
def reset_slots
|
71
|
+
@slot_rows.flatten.each {|s| s.value = 0}
|
72
|
+
end
|
73
|
+
|
74
|
+
def evaluate_game_over
|
75
|
+
evaluate_horizontal_win
|
76
|
+
evaluate_vertical_win
|
77
|
+
evaluate_sw_ne_diagonal_win
|
78
|
+
evaluate_se_nw_diagonal_win
|
79
|
+
self.game_over ||= true if @slot_rows.flatten.map(&:value).all? {|v| v > 0}
|
80
|
+
end
|
81
|
+
|
82
|
+
def evaluate_horizontal_win
|
83
|
+
connections = nil
|
84
|
+
last_slot_value = nil
|
85
|
+
height.times do |row_index|
|
86
|
+
connections = nil
|
87
|
+
last_slot_value = nil
|
88
|
+
width.times do |column_index|
|
89
|
+
slot = @slot_rows[row_index][column_index]
|
90
|
+
if slot.value.to_i > 0 && slot.value == last_slot_value
|
91
|
+
connections += 1
|
92
|
+
else
|
93
|
+
last_slot_value = slot.value
|
94
|
+
connections = 1
|
95
|
+
end
|
96
|
+
break if connections == 4
|
97
|
+
end
|
98
|
+
break if connections == 4
|
99
|
+
end
|
100
|
+
self.game_over = last_slot_value if connections == 4
|
101
|
+
end
|
102
|
+
|
103
|
+
def evaluate_vertical_win
|
104
|
+
connections = nil
|
105
|
+
last_slot_value = nil
|
106
|
+
width.times do |column_index|
|
107
|
+
connections = nil
|
108
|
+
last_slot_value = nil
|
109
|
+
height.times do |row_index|
|
110
|
+
slot = @slot_rows[row_index][column_index]
|
111
|
+
if slot.value.to_i > 0 && slot.value == last_slot_value
|
112
|
+
connections += 1
|
113
|
+
else
|
114
|
+
last_slot_value = slot.value
|
115
|
+
connections = 1
|
116
|
+
end
|
117
|
+
break if connections == 4
|
118
|
+
end
|
119
|
+
break if connections == 4
|
120
|
+
end
|
121
|
+
self.game_over = last_slot_value if connections == 4
|
122
|
+
end
|
123
|
+
|
124
|
+
def evaluate_sw_ne_diagonal_win
|
125
|
+
sw_ne_coordinates = [
|
126
|
+
[[3, 0], [2, 1], [1, 2], [0, 3]],
|
127
|
+
[[4, 0], [3, 1], [2, 2], [1, 3], [0, 4]],
|
128
|
+
[[5, 0], [4, 1], [3, 2], [2, 3], [1, 4], [0, 5]],
|
129
|
+
[[5, 1], [4, 2], [3, 3], [2, 4], [1, 5], [0, 6]],
|
130
|
+
[[5, 2], [4, 3], [3, 4], [2, 5], [1, 6]],
|
131
|
+
[[5, 3], [4, 4], [3, 5], [2, 6]],
|
132
|
+
]
|
133
|
+
evaluate_diagonal_win(sw_ne_coordinates)
|
134
|
+
end
|
135
|
+
|
136
|
+
def evaluate_se_nw_diagonal_win
|
137
|
+
sw_ne_coordinates = [
|
138
|
+
[[0, 3], [1, 4], [2, 5], [3, 6]],
|
139
|
+
[[0, 2], [1, 3], [2, 4], [3, 5], [4, 6]],
|
140
|
+
[[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6]],
|
141
|
+
[[0, 0], [1, 1], [2, 2], [3, 3], [4, 4], [5, 5]],
|
142
|
+
[[1, 0], [2, 1], [3, 2], [4, 3], [5, 4]],
|
143
|
+
[[2, 0], [3, 1], [4, 2], [5, 3]],
|
144
|
+
]
|
145
|
+
evaluate_diagonal_win(sw_ne_coordinates)
|
146
|
+
end
|
147
|
+
|
148
|
+
def evaluate_diagonal_win(diagonal_coordinates)
|
149
|
+
connections = nil
|
150
|
+
last_slot_value = nil
|
151
|
+
diagonal_coordinates.each do |group|
|
152
|
+
connections = nil
|
153
|
+
last_slot_value = nil
|
154
|
+
group.each do |row_index, column_index|
|
155
|
+
slot = @slot_rows[row_index][column_index]
|
156
|
+
if slot.value.to_i > 0 && slot.value == last_slot_value
|
157
|
+
connections += 1
|
158
|
+
else
|
159
|
+
last_slot_value = slot.value
|
160
|
+
connections = 1
|
161
|
+
end
|
162
|
+
break if connections == 4
|
163
|
+
end
|
164
|
+
break if connections == 4
|
165
|
+
end
|
166
|
+
self.game_over = last_slot_value if connections == 4
|
167
|
+
end
|
168
|
+
|
169
|
+
end
|
170
|
+
|
171
|
+
end
|
172
|
+
|
173
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# Copyright (c) 2007-2021 Andy Maleh
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
# a copy of this software and associated documentation files (the
|
5
|
+
# "Software"), to deal in the Software without restriction, including
|
6
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
# the following conditions:
|
10
|
+
#
|
11
|
+
# The above copyright notice and this permission notice shall be
|
12
|
+
# included in all copies or substantial portions of the Software.
|
13
|
+
#
|
14
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
|
+
|
22
|
+
class Connect4
|
23
|
+
module Model
|
24
|
+
class Slot
|
25
|
+
attr_reader :grid
|
26
|
+
|
27
|
+
# value 0 means empty, 1 means player 1 coin, and 2 means player 2 coin
|
28
|
+
attr_accessor :value
|
29
|
+
|
30
|
+
def initialize(grid)
|
31
|
+
@value = 0
|
32
|
+
@grid = grid
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: glimmer-dsl-swt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.20.13.
|
4
|
+
version: 4.20.13.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andy Maleh
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-08-
|
11
|
+
date: 2021-08-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -541,6 +541,9 @@ files:
|
|
541
541
|
- samples/elaborate/calculator/model/command/operation/subtract.rb
|
542
542
|
- samples/elaborate/calculator/model/command/point.rb
|
543
543
|
- samples/elaborate/calculator/model/presenter.rb
|
544
|
+
- samples/elaborate/connect4.rb
|
545
|
+
- samples/elaborate/connect4/model/grid.rb
|
546
|
+
- samples/elaborate/connect4/model/slot.rb
|
544
547
|
- samples/elaborate/contact_manager.rb
|
545
548
|
- samples/elaborate/contact_manager/contact.rb
|
546
549
|
- samples/elaborate/contact_manager/contact_manager_presenter.rb
|