task_id int64 0 2.26k | repository stringclasses 18
values | commit_hash stringclasses 241
values | filepath stringclasses 237
values | original_method stringlengths 21 4.65k | context listlengths 0 77 | masking dict |
|---|---|---|---|---|---|---|
200 | https://github.com/matijakljajic/oxo-pharo | fe4bc55acb051acaba3102fe72af60a210bc2217 | src/OXO/OXOGrid.class.st | checkInCol: idx
"Check column on said index for a winner."
| set |
winner ifNil: [
set := ((self grid atColumn: idx) collect: [ :x | x state ]) asSet.
self checkSet: set ].
^ winner | [
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOCell.class.st",
"code": "Object subclass: #OXOCell\n\tinstanceVariableNames: 'row col state'\n\tclassVariableNames: ''\n\tpackage: 'OXO'"
},
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOCell.class.st",
"code": "row\n\t\"Get cell's row.\"\n\n\t^ ro... | {
"fim_idx": 1,
"mask_type": "assignment",
"n_masked_tokens": 8,
"prefix": "checkInCol: idx\n\t\"Check column on said index for a winner.\"\n\n\t| set |\n\twinner ifNil: [\n\t\tset := ((self grid atColumn: idx) collect: [",
"suffix": ".\n\t\tself checkSet: set ].\n\t^ winner",
"completion": " :x | x state ]... |
201 | https://github.com/matijakljajic/oxo-pharo | fe4bc55acb051acaba3102fe72af60a210bc2217 | src/OXO/OXOGrid.class.st | checkInDiagonals
"Check diagonals for a winner."
| set1 set2 |
winner ifNil: [
set1 := (self grid diagonal collect: [ :x | x state ]) asSet.
set2 := Set newFrom: {
(self grid at: 1 at: 3) state.
(self grid at: 2 at: 2) state.
(self grid at: 3 at: 1) state } asOrderedCollectio... | [
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOCell.class.st",
"code": "Object subclass: #OXOCell\n\tinstanceVariableNames: 'row col state'\n\tclassVariableNames: ''\n\tpackage: 'OXO'"
},
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOCell.class.st",
"code": "row\n\t\"Get cell's row.\"\n\n\t^ ro... | {
"fim_idx": 0,
"mask_type": "keyword_message",
"n_masked_tokens": 10,
"prefix": "checkInDiagonals\n\t\"Check diagonals for a winner.\"\n\n\t| set1 set2 |\n\twinner ifNil: [\n\t\tset1 := (self grid diagonal collect: [ :x | x state ]) asSet.\n\t\tset2 := Set newFrom: {\n\t\t\t\t (self grid at: 1 at: 3) st... |
202 | https://github.com/matijakljajic/oxo-pharo | fe4bc55acb051acaba3102fe72af60a210bc2217 | src/OXO/OXOGrid.class.st | checkInDiagonals
"Check diagonals for a winner."
| set1 set2 |
winner ifNil: [
set1 := (self grid diagonal collect: [ :x | x state ]) asSet.
set2 := Set newFrom: {
(self grid at: 1 at: 3) state.
(self grid at: 2 at: 2) state.
(self grid at: 3 at: 1) state } asOrderedCollectio... | [
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOCell.class.st",
"code": "Object subclass: #OXOCell\n\tinstanceVariableNames: 'row col state'\n\tclassVariableNames: ''\n\tpackage: 'OXO'"
},
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOCell.class.st",
"code": "row\n\t\"Get cell's row.\"\n\n\t^ ro... | {
"fim_idx": 1,
"mask_type": "assignment",
"n_masked_tokens": 7,
"prefix": "checkInDiagonals\n\t\"Check diagonals for a winner.\"\n\n\t| set1 set2 |\n\twinner ifNil: [\n\t\tset1 := (self grid diagonal collect: [ :",
"suffix": ".\n\t\tset2 := Set newFrom: {\n\t\t\t\t (self grid at: 1 at: 3) state.\n\t\t... |
203 | https://github.com/matijakljajic/oxo-pharo | fe4bc55acb051acaba3102fe72af60a210bc2217 | src/OXO/OXOGrid.class.st | checkInDiagonals
"Check diagonals for a winner."
| set1 set2 |
winner ifNil: [
set1 := (self grid diagonal collect: [ :x | x state ]) asSet.
set2 := Set newFrom: {
(self grid at: 1 at: 3) state.
(self grid at: 2 at: 2) state.
(self grid at: 3 at: 1) state } asOrderedCollectio... | [
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOCell.class.st",
"code": "Object subclass: #OXOCell\n\tinstanceVariableNames: 'row col state'\n\tclassVariableNames: ''\n\tpackage: 'OXO'"
},
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOCell.class.st",
"code": "row\n\t\"Get cell's row.\"\n\n\t^ ro... | {
"fim_idx": 2,
"mask_type": "assignment",
"n_masked_tokens": 3,
"prefix": "checkInDiagonals\n\t\"Check diagonals for a winner.\"\n\n\t| set1 set2 |\n\twinner ifNil: [\n\t\tset1 := (self grid diagonal collect: [ :x | x state ]) asSet.\n\t\tset2 := Set newFrom: {\n\t\t\t\t (self grid at: 1 at: 3) state.\n... |
204 | https://github.com/matijakljajic/oxo-pharo | fe4bc55acb051acaba3102fe72af60a210bc2217 | src/OXO/OXOGrid.class.st | checkInRow: idx
"Check row on said index for a winner."
| set |
winner ifNil: [
set := ((self grid atRow: idx) collect: [ :x | x state ]) asSet.
self checkSet: set ].
^ winner | [
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOCell.class.st",
"code": "Object subclass: #OXOCell\n\tinstanceVariableNames: 'row col state'\n\tclassVariableNames: ''\n\tpackage: 'OXO'"
},
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOCell.class.st",
"code": "row\n\t\"Get cell's row.\"\n\n\t^ ro... | {
"fim_idx": 0,
"mask_type": "keyword_message",
"n_masked_tokens": 10,
"prefix": "checkInRow: idx\n\t\"Check row on said index for a winner.\"\n\n\t| set |\n\twinner ifNil: [\n\t\tset := ((self grid atRow: idx) collect: [ :x |",
"suffix": ".\n\t^ winner",
"completion": " x state ]) asSet.\n\t\tself checkSet... |
205 | https://github.com/matijakljajic/oxo-pharo | fe4bc55acb051acaba3102fe72af60a210bc2217 | src/OXO/OXOGrid.class.st | checkInRow: idx
"Check row on said index for a winner."
| set |
winner ifNil: [
set := ((self grid atRow: idx) collect: [ :x | x state ]) asSet.
self checkSet: set ].
^ winner | [
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOCell.class.st",
"code": "Object subclass: #OXOCell\n\tinstanceVariableNames: 'row col state'\n\tclassVariableNames: ''\n\tpackage: 'OXO'"
},
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOCell.class.st",
"code": "row\n\t\"Get cell's row.\"\n\n\t^ ro... | {
"fim_idx": 1,
"mask_type": "assignment",
"n_masked_tokens": 9,
"prefix": "checkInRow: idx\n\t\"Check row on said index for a winner.\"\n\n\t| set |\n\twinner ifNil: [\n\t\tset := ((self grid atRow: idx) collect:",
"suffix": ".\n\t\tself checkSet: set ].\n\t^ winner",
"completion": " [ :x | x state ]) asSe... |
206 | https://github.com/matijakljajic/oxo-pharo | fe4bc55acb051acaba3102fe72af60a210bc2217 | src/OXO/OXOGrid.class.st | checkSet: aSet
"Check if all symbols are the same."
aSet size == 1 ifFalse: [ ^ self ].
(aSet includes: 'X') ifTrue: [ winner := 'X' ].
(aSet includes: 'O') ifTrue: [ winner := 'O' ] | [
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOCell.class.st",
"code": "Object subclass: #OXOCell\n\tinstanceVariableNames: 'row col state'\n\tclassVariableNames: ''\n\tpackage: 'OXO'"
},
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOCell.class.st",
"code": "row\n\t\"Get cell's row.\"\n\n\t^ ro... | {
"fim_idx": 0,
"mask_type": "keyword_message",
"n_masked_tokens": 7,
"prefix": "checkSet: aSet\n\t\"Check if all symbols are the same.\"\n\n\taSet size",
"suffix": ".\n\t(aSet includes: 'X') ifTrue: [ winner := 'X' ].\n\t(aSet includes: 'O') ifTrue: [ winner := 'O' ]",
"completion": " == 1 ifFalse: [ ^ sel... |
207 | https://github.com/matijakljajic/oxo-pharo | fe4bc55acb051acaba3102fe72af60a210bc2217 | src/OXO/OXOGrid.class.st | checkSet: aSet
"Check if all symbols are the same."
aSet size == 1 ifFalse: [ ^ self ].
(aSet includes: 'X') ifTrue: [ winner := 'X' ].
(aSet includes: 'O') ifTrue: [ winner := 'O' ] | [
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOCell.class.st",
"code": "Object subclass: #OXOCell\n\tinstanceVariableNames: 'row col state'\n\tclassVariableNames: ''\n\tpackage: 'OXO'"
},
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOCell.class.st",
"code": "row\n\t\"Get cell's row.\"\n\n\t^ ro... | {
"fim_idx": 1,
"mask_type": "keyword_message",
"n_masked_tokens": 5,
"prefix": "checkSet: aSet\n\t\"Check if all symbols are the same.\"\n\n\taSet size == 1 ifFalse: [ ^ self ].\n\t(aSet includes: 'X') ifTrue:",
"suffix": ".\n\t(aSet includes: 'O') ifTrue: [ winner := 'O' ]",
"completion": " [ winner := 'X... |
208 | https://github.com/matijakljajic/oxo-pharo | fe4bc55acb051acaba3102fe72af60a210bc2217 | src/OXO/OXOGrid.class.st | checkSet: aSet
"Check if all symbols are the same."
aSet size == 1 ifFalse: [ ^ self ].
(aSet includes: 'X') ifTrue: [ winner := 'X' ].
(aSet includes: 'O') ifTrue: [ winner := 'O' ] | [
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOCell.class.st",
"code": "Object subclass: #OXOCell\n\tinstanceVariableNames: 'row col state'\n\tclassVariableNames: ''\n\tpackage: 'OXO'"
},
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOCell.class.st",
"code": "row\n\t\"Get cell's row.\"\n\n\t^ ro... | {
"fim_idx": 2,
"mask_type": "keyword_message",
"n_masked_tokens": 5,
"prefix": "checkSet: aSet\n\t\"Check if all symbols are the same.\"\n\n\taSet size == 1 ifFalse: [ ^ self ].\n\t(aSet includes: 'X') ifTrue: [ winner := 'X' ].\n\t(aSet includes: 'O') ifTrue:",
"suffix": "",
"completion": " [ winner := 'O... |
209 | https://github.com/matijakljajic/oxo-pharo | fe4bc55acb051acaba3102fe72af60a210bc2217 | src/OXO/OXOGrid.class.st | fillWithCells
"Initalization helper."
cells indicesDo: [ :row :col |
cells at: row at: col put: (OXOCell at: row at: col) ] | [
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOCell.class.st",
"code": "Object subclass: #OXOCell\n\tinstanceVariableNames: 'row col state'\n\tclassVariableNames: ''\n\tpackage: 'OXO'"
},
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOCell.class.st",
"code": "row\n\t\"Get cell's row.\"\n\n\t^ ro... | {
"fim_idx": 0,
"mask_type": "keyword_message",
"n_masked_tokens": 9,
"prefix": "fillWithCells\n\t\"Initalization helper.\"\n\n\tcells indicesDo: [ :row :col |\n\t\tcells at: row at: col",
"suffix": "",
"completion": " put: (OXOCell at: row at: col) ]"
} |
210 | https://github.com/matijakljajic/oxo-pharo | fe4bc55acb051acaba3102fe72af60a210bc2217 | src/OXO/OXOGrid.class.st | fillWithCells
"Initalization helper."
cells indicesDo: [ :row :col |
cells at: row at: col put: (OXOCell at: row at: col) ] | [
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOCell.class.st",
"code": "Object subclass: #OXOCell\n\tinstanceVariableNames: 'row col state'\n\tclassVariableNames: ''\n\tpackage: 'OXO'"
},
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOCell.class.st",
"code": "row\n\t\"Get cell's row.\"\n\n\t^ ro... | {
"fim_idx": 1,
"mask_type": "keyword_message",
"n_masked_tokens": 6,
"prefix": "fillWithCells\n\t\"Initalization helper.\"\n\n\tcells indicesDo: [ :row :col |\n\t\tcells at: row at: col put: (",
"suffix": " ]",
"completion": "OXOCell at: row at: col)"
} |
211 | https://github.com/matijakljajic/oxo-pharo | fe4bc55acb051acaba3102fe72af60a210bc2217 | src/OXO/OXOGrid.class.st | initialize
"Initialize new OXO model with a 3x3 grid."
cells := Array2D new: 3.
self fillWithCells.
moves := 0 | [
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOCell.class.st",
"code": "Object subclass: #OXOCell\n\tinstanceVariableNames: 'row col state'\n\tclassVariableNames: ''\n\tpackage: 'OXO'"
},
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOCell.class.st",
"code": "row\n\t\"Get cell's row.\"\n\n\t^ ro... | {
"fim_idx": 0,
"mask_type": "assignment",
"n_masked_tokens": 4,
"prefix": "initialize\n\t\"Initialize new OXO model with a 3x3 grid.\"\n\n\tcells",
"suffix": ".\n\tself fillWithCells.\n\tmoves := 0",
"completion": " := Array2D new: 3"
} |
212 | https://github.com/matijakljajic/oxo-pharo | fe4bc55acb051acaba3102fe72af60a210bc2217 | src/OXO/OXOGrid.class.st | isOver
"Check if game's over."
moves >= 5 ifFalse: [ ^ false ].
1 to: 3 do: [ :idx |
self checkInRow: idx.
self checkInCol: idx ].
self checkInDiagonals.
(moves == 9 or: winner isNotNil)
ifTrue: [ ^ true ]
ifFalse: [ ^ false ] | [
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOCell.class.st",
"code": "Object subclass: #OXOCell\n\tinstanceVariableNames: 'row col state'\n\tclassVariableNames: ''\n\tpackage: 'OXO'"
},
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOCell.class.st",
"code": "row\n\t\"Get cell's row.\"\n\n\t^ ro... | {
"fim_idx": 0,
"mask_type": "keyword_message",
"n_masked_tokens": 5,
"prefix": "isOver\n\t\"Check if game's over.\"\n\n\tmoves >= 5",
"suffix": ".\n\t1 to: 3 do: [ :idx |\n\t\tself checkInRow: idx.\n\t\tself checkInCol: idx ].\n\tself checkInDiagonals.\n\n\t(moves == 9 or: winner isNotNil)\n\t\tifTrue: [ ^ t... |
213 | https://github.com/matijakljajic/oxo-pharo | fe4bc55acb051acaba3102fe72af60a210bc2217 | src/OXO/OXOGrid.class.st | isOver
"Check if game's over."
moves >= 5 ifFalse: [ ^ false ].
1 to: 3 do: [ :idx |
self checkInRow: idx.
self checkInCol: idx ].
self checkInDiagonals.
(moves == 9 or: winner isNotNil)
ifTrue: [ ^ true ]
ifFalse: [ ^ false ] | [
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOCell.class.st",
"code": "Object subclass: #OXOCell\n\tinstanceVariableNames: 'row col state'\n\tclassVariableNames: ''\n\tpackage: 'OXO'"
},
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOCell.class.st",
"code": "row\n\t\"Get cell's row.\"\n\n\t^ ro... | {
"fim_idx": 1,
"mask_type": "keyword_message",
"n_masked_tokens": 6,
"prefix": "isOver\n\t\"Check if game's over.\"\n\n\tmoves >= 5 ifFalse: [ ^ false ].\n\t1 to: 3 do: [ :idx |\n\t\tself checkInRow:",
"suffix": ".\n\tself checkInDiagonals.\n\n\t(moves == 9 or: winner isNotNil)\n\t\tifTrue: [ ^ true ]\n\t\ti... |
214 | https://github.com/matijakljajic/oxo-pharo | fe4bc55acb051acaba3102fe72af60a210bc2217 | src/OXO/OXOGrid.class.st | isOver
"Check if game's over."
moves >= 5 ifFalse: [ ^ false ].
1 to: 3 do: [ :idx |
self checkInRow: idx.
self checkInCol: idx ].
self checkInDiagonals.
(moves == 9 or: winner isNotNil)
ifTrue: [ ^ true ]
ifFalse: [ ^ false ] | [
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOCell.class.st",
"code": "Object subclass: #OXOCell\n\tinstanceVariableNames: 'row col state'\n\tclassVariableNames: ''\n\tpackage: 'OXO'"
},
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOCell.class.st",
"code": "row\n\t\"Get cell's row.\"\n\n\t^ ro... | {
"fim_idx": 2,
"mask_type": "keyword_message",
"n_masked_tokens": 3,
"prefix": "isOver\n\t\"Check if game's over.\"\n\n\tmoves >= 5 ifFalse: [ ^ false ].\n\t1 to: 3 do: [ :idx |\n\t\tself checkInRow: idx.\n\t\tself checkInCol: idx ].\n\tself checkInDiagonals.\n\n\t(moves == 9 or: winner isNotNil)\n\t\tifTrue: ... |
215 | https://github.com/matijakljajic/oxo-pharo | fe4bc55acb051acaba3102fe72af60a210bc2217 | src/OXO/OXOGrid.class.st | turn
"Get who plays / whose turn it is based on number of moves played."
turn := moves % 2 = 0
ifTrue: [ 'O' ]
ifFalse: [ 'X' ].
^ turn | [
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOCell.class.st",
"code": "Object subclass: #OXOCell\n\tinstanceVariableNames: 'row col state'\n\tclassVariableNames: ''\n\tpackage: 'OXO'"
},
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOCell.class.st",
"code": "row\n\t\"Get cell's row.\"\n\n\t^ ro... | {
"fim_idx": 0,
"mask_type": "assignment",
"n_masked_tokens": 7,
"prefix": "turn\n\t\"Get who plays / whose turn it is based on number of moves played.\"\n\n\tturn := moves % 2 = 0\n\t\t ifTrue:",
"suffix": ".\n\t^ turn",
"completion": " [ 'O' ]\n\t\t ifFalse: [ 'X' ]"
} |
216 | https://github.com/matijakljajic/oxo-pharo | e310f53b5864c96dfa49225006a2c6c8a1d54c67 | src/OXO-Tests/OXOGridTest.class.st | testMakeMove
self assert: oxo moves equals: 0.
oxo makeMove: (oxo grid asArray at: 1).
self
assert: (oxo grid asArray at: 1) state equals: 'O';
assert: oxo moves equals: 1.
self should: [ oxo makeMove: (oxo grid asArray at: 1) ] raise: Error | [
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOGrid.class.st",
"code": "Object subclass: #OXOGrid\n\tinstanceVariableNames: 'cells moves turn winner'\n\tclassVariableNames: ''\n\tpackage: 'OXO-Model'"
},
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOGrid.class.st",
"code": "checkInCol: idx\n\t\... | {
"fim_idx": 0,
"mask_type": "keyword_message",
"n_masked_tokens": 4,
"prefix": "testMakeMove\n\n\tself assert:",
"suffix": ".\n\toxo makeMove: (oxo grid asArray at: 1).\n\tself\n\t\tassert: (oxo grid asArray at: 1) state equals: 'O';\n\t\tassert: oxo moves equals: 1.\n\n\tself should: [ oxo makeMove: (oxo gr... |
217 | https://github.com/matijakljajic/oxo-pharo | e310f53b5864c96dfa49225006a2c6c8a1d54c67 | src/OXO-Tests/OXOGridTest.class.st | testMakeMove
self assert: oxo moves equals: 0.
oxo makeMove: (oxo grid asArray at: 1).
self
assert: (oxo grid asArray at: 1) state equals: 'O';
assert: oxo moves equals: 1.
self should: [ oxo makeMove: (oxo grid asArray at: 1) ] raise: Error | [
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOGrid.class.st",
"code": "Object subclass: #OXOGrid\n\tinstanceVariableNames: 'cells moves turn winner'\n\tclassVariableNames: ''\n\tpackage: 'OXO-Model'"
},
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOGrid.class.st",
"code": "checkInCol: idx\n\t\... | {
"fim_idx": 3,
"mask_type": "keyword_message",
"n_masked_tokens": 5,
"prefix": "testMakeMove\n\n\tself assert: oxo moves equals: 0.\n\toxo makeMove: (oxo grid asArray at: 1).\n\tself\n\t\tassert: (oxo grid asArray at: 1) state equals: 'O';\n\t\tassert: oxo moves equals: 1.\n\n\tself should: [ oxo makeMove: (ox... |
218 | https://github.com/matijakljajic/oxo-pharo | e310f53b5864c96dfa49225006a2c6c8a1d54c67 | src/OXO-Tests/OXOGridTest.class.st | testMakeMove
self assert: oxo moves equals: 0.
oxo makeMove: (oxo grid asArray at: 1).
self
assert: (oxo grid asArray at: 1) state equals: 'O';
assert: oxo moves equals: 1.
self should: [ oxo makeMove: (oxo grid asArray at: 1) ] raise: Error | [
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOGrid.class.st",
"code": "Object subclass: #OXOGrid\n\tinstanceVariableNames: 'cells moves turn winner'\n\tclassVariableNames: ''\n\tpackage: 'OXO-Model'"
},
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOGrid.class.st",
"code": "checkInCol: idx\n\t\... | {
"fim_idx": 4,
"mask_type": "keyword_message",
"n_masked_tokens": 4,
"prefix": "testMakeMove\n\n\tself assert: oxo moves equals: 0.\n\toxo makeMove: (oxo grid asArray at: 1).\n\tself\n\t\tassert: (oxo grid asArray at: 1) state equals: 'O';\n\t\tassert: oxo moves equals: 1.\n\n\tself should: [ oxo makeMove: (ox... |
219 | https://github.com/matijakljajic/oxo-pharo | e310f53b5864c96dfa49225006a2c6c8a1d54c67 | src/OXO/OXOGrid.class.st | makeMove: aCell
"Make move at said row and at said column if it's empty."
(aCell state: self turn)
ifTrue: [ self addMove ] | [
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOGrid.class.st",
"code": "Object subclass: #OXOGrid\n\tinstanceVariableNames: 'cells moves turn winner'\n\tclassVariableNames: ''\n\tpackage: 'OXO-Model'"
},
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOGrid.class.st",
"code": "addMove\n\t\"Increme... | {
"fim_idx": 0,
"mask_type": "keyword_message",
"n_masked_tokens": 8,
"prefix": "makeMove: aCell\n\t\"Make move at said row and at said column if it's empty.\"\n\n\t(aCell state:",
"suffix": "",
"completion": " self turn)\n\t\tifTrue: [ self addMove ]"
} |
220 | https://github.com/matijakljajic/oxo-pharo | ba6f596d8851590b9c1e846ffca2b91e74efb0e0 | src/OXO/OXO.class.st | initialize
| game |
game := OXOGridElement new: self.
space := BlSpace new.
space title: 'OXO'.
space root addChild: game.
space root whenLayoutedDoOnce: [ space extent: game size ].
space position: 300 @ 150.
space resizable: false.
space show | [
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOGrid.class.st",
"code": "Object subclass: #OXOGrid\n\tinstanceVariableNames: 'cells moves turn winner'\n\tclassVariableNames: ''\n\tpackage: 'OXO-Model'"
},
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOGrid.class.st",
"code": "grid\n\t\"Get Array2... | {
"fim_idx": 4,
"mask_type": "keyword_message",
"n_masked_tokens": 3,
"prefix": "initialize\n\t\n\t| game |\n\tgame := OXOGridElement new: self.\n\t\n\tspace := BlSpace new.\n\tspace title: 'OXO'.\n\tspace root addChild: game.\n\tspace root whenLayoutedDoOnce: [ space",
"suffix": " ].\n\tspace position: 300 @... |
221 | https://github.com/matijakljajic/oxo-pharo | ba6f596d8851590b9c1e846ffca2b91e74efb0e0 | src/OXO/OXO.class.st | initialize
| game |
game := OXOGridElement new: self.
space := BlSpace new.
space title: 'OXO'.
space root addChild: game.
space root whenLayoutedDoOnce: [ space extent: game size ].
space position: 300 @ 150.
space resizable: false.
space show | [
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOGrid.class.st",
"code": "Object subclass: #OXOGrid\n\tinstanceVariableNames: 'cells moves turn winner'\n\tclassVariableNames: ''\n\tpackage: 'OXO-Model'"
},
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOGrid.class.st",
"code": "grid\n\t\"Get Array2... | {
"fim_idx": 1,
"mask_type": "assignment",
"n_masked_tokens": 3,
"prefix": "initialize\n\t\n\t| game |\n\tgame := OXOGridElement new: self.\n\t\n\tspace",
"suffix": ".\n\tspace title: 'OXO'.\n\tspace root addChild: game.\n\tspace root whenLayoutedDoOnce: [ space extent: game size ].\n\tspace position: 300 @ 1... |
222 | https://github.com/matijakljajic/oxo-pharo | ba6f596d8851590b9c1e846ffca2b91e74efb0e0 | src/OXO/OXO.class.st | initialize
| game |
game := OXOGridElement new: self.
space := BlSpace new.
space title: 'OXO'.
space root addChild: game.
space root whenLayoutedDoOnce: [ space extent: game size ].
space position: 300 @ 150.
space resizable: false.
space show | [
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOGrid.class.st",
"code": "Object subclass: #OXOGrid\n\tinstanceVariableNames: 'cells moves turn winner'\n\tclassVariableNames: ''\n\tpackage: 'OXO-Model'"
},
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOGrid.class.st",
"code": "grid\n\t\"Get Array2... | {
"fim_idx": 5,
"mask_type": "keyword_message",
"n_masked_tokens": 3,
"prefix": "initialize\n\t\n\t| game |\n\tgame := OXOGridElement new: self.\n\t\n\tspace := BlSpace new.\n\tspace title: 'OXO'.\n\tspace root addChild: game.\n\tspace root whenLayoutedDoOnce: [ space extent: game size ].\n\tspace position:",
... |
223 | https://github.com/matijakljajic/oxo-pharo | ba6f596d8851590b9c1e846ffca2b91e74efb0e0 | src/OXO/OXO.class.st | reset
| game |
game := OXOGridElement new: self.
space root removeChildren.
space root addChild: game | [
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOGrid.class.st",
"code": "Object subclass: #OXOGrid\n\tinstanceVariableNames: 'cells moves turn winner'\n\tclassVariableNames: ''\n\tpackage: 'OXO-Model'"
},
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOGrid.class.st",
"code": "grid\n\t\"Get Array2... | {
"fim_idx": 0,
"mask_type": "assignment",
"n_masked_tokens": 4,
"prefix": "reset\n\n\t| game |\n\tgame",
"suffix": ".\n\n\tspace root removeChildren.\n\tspace root addChild: game",
"completion": " := OXOGridElement new: self"
} |
224 | https://github.com/matijakljajic/oxo-pharo | ba6f596d8851590b9c1e846ffca2b91e74efb0e0 | src/OXO/OXO.class.st | reset
| game |
game := OXOGridElement new: self.
space root removeChildren.
space root addChild: game | [
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOGrid.class.st",
"code": "Object subclass: #OXOGrid\n\tinstanceVariableNames: 'cells moves turn winner'\n\tclassVariableNames: ''\n\tpackage: 'OXO-Model'"
},
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOGrid.class.st",
"code": "grid\n\t\"Get Array2... | {
"fim_idx": 1,
"mask_type": "keyword_message",
"n_masked_tokens": 3,
"prefix": "reset\n\n\t| game |\n\tgame := OXOGridElement new: self.\n\n\tspace root removeChildren.\n\tspace",
"suffix": "",
"completion": " root addChild: game"
} |
225 | https://github.com/matijakljajic/oxo-pharo | ba6f596d8851590b9c1e846ffca2b91e74efb0e0 | src/OXO/OXOCellElement.class.st | new: anOXOCell
^ self new cell: anOXOCell. | [
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOGrid.class.st",
"code": "Object subclass: #OXOGrid\n\tinstanceVariableNames: 'cells moves turn winner'\n\tclassVariableNames: ''\n\tpackage: 'OXO-Model'"
},
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOGrid.class.st",
"code": "grid\n\t\"Get Array2... | {
"fim_idx": 0,
"mask_type": "return",
"n_masked_tokens": 4,
"prefix": "new: anOXOCell\n\n\t^",
"suffix": ".",
"completion": " self new cell: anOXOCell"
} |
226 | https://github.com/matijakljajic/oxo-pharo | ba6f596d8851590b9c1e846ffca2b91e74efb0e0 | src/OXO/OXOCellElement.class.st | click
(self parent model moves = 9 or: self parent model winner isNotNil)
ifTrue: [ ^ self parent game reset ].
self parent model makeMove: self cell.
self fillCell: self parent model turn.
(self parent model isOver and: self parent model winner = 'O')
ifTrue: [ self parent changeChildrenColor: Color green tw... | [
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOGrid.class.st",
"code": "Object subclass: #OXOGrid\n\tinstanceVariableNames: 'cells moves turn winner'\n\tclassVariableNames: ''\n\tpackage: 'OXO-Model'"
},
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOGrid.class.st",
"code": "grid\n\t\"Get Array2... | {
"fim_idx": 2,
"mask_type": "keyword_message",
"n_masked_tokens": 4,
"prefix": "click\n\n\t(self parent model moves = 9 or: self parent model winner isNotNil)\n\t\tifTrue: [ ^ self parent game reset ].\n\n\tself parent",
"suffix": ".\n\tself fillCell: self parent model turn.\n\t(self parent model isOver and:... |
227 | https://github.com/matijakljajic/oxo-pharo | ba6f596d8851590b9c1e846ffca2b91e74efb0e0 | src/OXO/OXOCellElement.class.st | click
(self parent model moves = 9 or: self parent model winner isNotNil)
ifTrue: [ ^ self parent game reset ].
self parent model makeMove: self cell.
self fillCell: self parent model turn.
(self parent model isOver and: self parent model winner = 'O')
ifTrue: [ self parent changeChildrenColor: Color green tw... | [
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOGrid.class.st",
"code": "Object subclass: #OXOGrid\n\tinstanceVariableNames: 'cells moves turn winner'\n\tclassVariableNames: ''\n\tpackage: 'OXO-Model'"
},
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOGrid.class.st",
"code": "grid\n\t\"Get Array2... | {
"fim_idx": 0,
"mask_type": "keyword_message",
"n_masked_tokens": 5,
"prefix": "click\n\n\t(self parent model moves = 9 or: self parent model winner isNotNil)\n\t\tifTrue: [ ^",
"suffix": ".\n\n\tself parent model makeMove: self cell.\n\tself fillCell: self parent model turn.\n\t(self parent model isOver and... |
228 | https://github.com/matijakljajic/oxo-pharo | ba6f596d8851590b9c1e846ffca2b91e74efb0e0 | src/OXO/OXOCellElement.class.st | click
(self parent model moves = 9 or: self parent model winner isNotNil)
ifTrue: [ ^ self parent game reset ].
self parent model makeMove: self cell.
self fillCell: self parent model turn.
(self parent model isOver and: self parent model winner = 'O')
ifTrue: [ self parent changeChildrenColor: Color green tw... | [
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOGrid.class.st",
"code": "Object subclass: #OXOGrid\n\tinstanceVariableNames: 'cells moves turn winner'\n\tclassVariableNames: ''\n\tpackage: 'OXO-Model'"
},
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOGrid.class.st",
"code": "grid\n\t\"Get Array2... | {
"fim_idx": 3,
"mask_type": "keyword_message",
"n_masked_tokens": 4,
"prefix": "click\n\n\t(self parent model moves = 9 or: self parent model winner isNotNil)\n\t\tifTrue: [ ^ self parent game reset ].\n\n\tself parent model makeMove: self cell.\n\tself fillCell:",
"suffix": ".\n\t(self parent model isOver a... |
229 | https://github.com/matijakljajic/oxo-pharo | ba6f596d8851590b9c1e846ffca2b91e74efb0e0 | src/OXO/OXOCellElement.class.st | fillCell: aState
"Set cell state in String form."
text text: (self cell state asRopedText fontSize: 64; foreground: Color white).
self addChild: text | [
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOGrid.class.st",
"code": "Object subclass: #OXOGrid\n\tinstanceVariableNames: 'cells moves turn winner'\n\tclassVariableNames: ''\n\tpackage: 'OXO-Model'"
},
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOGrid.class.st",
"code": "grid\n\t\"Get Array2... | {
"fim_idx": 0,
"mask_type": "keyword_message",
"n_masked_tokens": 8,
"prefix": "fillCell: aState\n\t\"Set cell state in String form.\"\n\n\ttext text: (self cell state",
"suffix": ".\n\tself addChild: text",
"completion": " asRopedText fontSize: 64; foreground: Color white)"
} |
230 | https://github.com/matijakljajic/oxo-pharo | ba6f596d8851590b9c1e846ffca2b91e74efb0e0 | src/OXO/OXOCellElement.class.st | initialize
super initialize.
self initializeText.
self size: 68 @ 68.
self layout: BlLinearLayout new alignCenter.
self background: (BlColorPaint color: Color black).
self cell: OXOCell new.
self addEventHandlerOn: BlClickEvent do: [ :anEvent | self click ] | [
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOGrid.class.st",
"code": "Object subclass: #OXOGrid\n\tinstanceVariableNames: 'cells moves turn winner'\n\tclassVariableNames: ''\n\tpackage: 'OXO-Model'"
},
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOGrid.class.st",
"code": "grid\n\t\"Get Array2... | {
"fim_idx": 3,
"mask_type": "keyword_message",
"n_masked_tokens": 3,
"prefix": "initialize\n\n\tsuper initialize.\n\tself initializeText.\n\n\tself size: 68 @ 68.\n\tself layout: BlLinearLayout new alignCenter.\n\tself background: (BlColorPaint color: Color black).\n\n\tself",
"suffix": ".\n\tself addEventHa... |
231 | https://github.com/matijakljajic/oxo-pharo | ba6f596d8851590b9c1e846ffca2b91e74efb0e0 | src/OXO/OXOCellElement.class.st | initialize
super initialize.
self initializeText.
self size: 68 @ 68.
self layout: BlLinearLayout new alignCenter.
self background: (BlColorPaint color: Color black).
self cell: OXOCell new.
self addEventHandlerOn: BlClickEvent do: [ :anEvent | self click ] | [
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOGrid.class.st",
"code": "Object subclass: #OXOGrid\n\tinstanceVariableNames: 'cells moves turn winner'\n\tclassVariableNames: ''\n\tpackage: 'OXO-Model'"
},
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOGrid.class.st",
"code": "grid\n\t\"Get Array2... | {
"fim_idx": 4,
"mask_type": "keyword_message",
"n_masked_tokens": 3,
"prefix": "initialize\n\n\tsuper initialize.\n\tself initializeText.\n\n\tself size: 68 @ 68.\n\tself layout: BlLinearLayout new alignCenter.\n\tself background: (BlColorPaint color: Color black).\n\n\tself cell: OXOCell new.\n\tself addEvent... |
232 | https://github.com/matijakljajic/oxo-pharo | ba6f596d8851590b9c1e846ffca2b91e74efb0e0 | src/OXO/OXOCellElement.class.st | initialize
super initialize.
self initializeText.
self size: 68 @ 68.
self layout: BlLinearLayout new alignCenter.
self background: (BlColorPaint color: Color black).
self cell: OXOCell new.
self addEventHandlerOn: BlClickEvent do: [ :anEvent | self click ] | [
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOGrid.class.st",
"code": "Object subclass: #OXOGrid\n\tinstanceVariableNames: 'cells moves turn winner'\n\tclassVariableNames: ''\n\tpackage: 'OXO-Model'"
},
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOGrid.class.st",
"code": "grid\n\t\"Get Array2... | {
"fim_idx": 0,
"mask_type": "keyword_message",
"n_masked_tokens": 3,
"prefix": "initialize\n\n\tsuper initialize.\n\tself initializeText.\n\n\tself size:",
"suffix": ".\n\tself layout: BlLinearLayout new alignCenter.\n\tself background: (BlColorPaint color: Color black).\n\n\tself cell: OXOCell new.\n\tself ... |
233 | https://github.com/matijakljajic/oxo-pharo | ba6f596d8851590b9c1e846ffca2b91e74efb0e0 | src/OXO/OXOCellElement.class.st | initializeText
text := BlTextElement new | [
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOGrid.class.st",
"code": "Object subclass: #OXOGrid\n\tinstanceVariableNames: 'cells moves turn winner'\n\tclassVariableNames: ''\n\tpackage: 'OXO-Model'"
},
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOGrid.class.st",
"code": "grid\n\t\"Get Array2... | {
"fim_idx": 0,
"mask_type": "assignment",
"n_masked_tokens": 3,
"prefix": "initializeText\n\n\ttext",
"suffix": "",
"completion": " := BlTextElement new"
} |
234 | https://github.com/matijakljajic/oxo-pharo | ba6f596d8851590b9c1e846ffca2b91e74efb0e0 | src/OXO/OXOGridElement.class.st | new: aBlSpace
^ self new game: aBlSpace | [
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOGrid.class.st",
"code": "Object subclass: #OXOGrid\n\tinstanceVariableNames: 'cells moves turn winner'\n\tclassVariableNames: ''\n\tpackage: 'OXO-Model'"
},
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOGrid.class.st",
"code": "grid\n\t\"Get Array2... | {
"fim_idx": 0,
"mask_type": "return",
"n_masked_tokens": 3,
"prefix": "new: aBlSpace\n\n\t^ self",
"suffix": "",
"completion": " new game: aBlSpace"
} |
235 | https://github.com/matijakljajic/oxo-pharo | ba6f596d8851590b9c1e846ffca2b91e74efb0e0 | src/OXO/OXOGridElement.class.st | changeChildrenColor: aColor
self childrenDo: [ :x | x background: aColor ] | [
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOGrid.class.st",
"code": "Object subclass: #OXOGrid\n\tinstanceVariableNames: 'cells moves turn winner'\n\tclassVariableNames: ''\n\tpackage: 'OXO-Model'"
},
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOGrid.class.st",
"code": "grid\n\t\"Get Array2... | {
"fim_idx": 0,
"mask_type": "keyword_message",
"n_masked_tokens": 9,
"prefix": "changeChildrenColor: aColor\n\n\tself",
"suffix": "",
"completion": " childrenDo: [ :x | x background: aColor ]"
} |
236 | https://github.com/matijakljajic/oxo-pharo | ba6f596d8851590b9c1e846ffca2b91e74efb0e0 | src/OXO/OXOGridElement.class.st | initialize
super initialize.
self background: Color white.
self layout: (BlGridLayout horizontal cellSpacing: 5).
self layout columnCount: 3.
self constraintsDo: [ :layoutConstraints |
layoutConstraints horizontal fitContent.
layoutConstraints vertical fitContent ].
self model: OXOGrid new | [
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOGrid.class.st",
"code": "Object subclass: #OXOGrid\n\tinstanceVariableNames: 'cells moves turn winner'\n\tclassVariableNames: ''\n\tpackage: 'OXO-Model'"
},
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOGrid.class.st",
"code": "grid\n\t\"Get Array2... | {
"fim_idx": 4,
"mask_type": "keyword_message",
"n_masked_tokens": 3,
"prefix": "initialize\n\n\tsuper initialize.\n\tself background: Color white.\n\tself layout: (BlGridLayout horizontal cellSpacing: 5).\n\tself layout columnCount: 3.\n\n\tself constraintsDo: [ :layoutConstraints |\n\t\tlayoutConstraints hori... |
237 | https://github.com/matijakljajic/oxo-pharo | ba6f596d8851590b9c1e846ffca2b91e74efb0e0 | src/OXO/OXOGridElement.class.st | initialize
super initialize.
self background: Color white.
self layout: (BlGridLayout horizontal cellSpacing: 5).
self layout columnCount: 3.
self constraintsDo: [ :layoutConstraints |
layoutConstraints horizontal fitContent.
layoutConstraints vertical fitContent ].
self model: OXOGrid new | [
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOGrid.class.st",
"code": "Object subclass: #OXOGrid\n\tinstanceVariableNames: 'cells moves turn winner'\n\tclassVariableNames: ''\n\tpackage: 'OXO-Model'"
},
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOGrid.class.st",
"code": "grid\n\t\"Get Array2... | {
"fim_idx": 0,
"mask_type": "keyword_message",
"n_masked_tokens": 3,
"prefix": "initialize\n\n\tsuper initialize.\n\tself",
"suffix": ".\n\tself layout: (BlGridLayout horizontal cellSpacing: 5).\n\tself layout columnCount: 3.\n\n\tself constraintsDo: [ :layoutConstraints |\n\t\tlayoutConstraints horizontal f... |
238 | https://github.com/matijakljajic/oxo-pharo | ba6f596d8851590b9c1e846ffca2b91e74efb0e0 | src/OXO/OXOGridElement.class.st | initialize
super initialize.
self background: Color white.
self layout: (BlGridLayout horizontal cellSpacing: 5).
self layout columnCount: 3.
self constraintsDo: [ :layoutConstraints |
layoutConstraints horizontal fitContent.
layoutConstraints vertical fitContent ].
self model: OXOGrid new | [
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOGrid.class.st",
"code": "Object subclass: #OXOGrid\n\tinstanceVariableNames: 'cells moves turn winner'\n\tclassVariableNames: ''\n\tpackage: 'OXO-Model'"
},
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOGrid.class.st",
"code": "grid\n\t\"Get Array2... | {
"fim_idx": 2,
"mask_type": "keyword_message",
"n_masked_tokens": 3,
"prefix": "initialize\n\n\tsuper initialize.\n\tself background: Color white.\n\tself layout: (BlGridLayout horizontal cellSpacing: 5).\n\tself",
"suffix": ".\n\n\tself constraintsDo: [ :layoutConstraints |\n\t\tlayoutConstraints horizontal... |
239 | https://github.com/matijakljajic/oxo-pharo | ba6f596d8851590b9c1e846ffca2b91e74efb0e0 | src/OXO/OXOGridElement.class.st | model: anOXOGrid
model := anOXOGrid.
model grid do: [ :anOXOCell |
self addChild: (OXOCellElement new: anOXOCell) ] | [
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOGrid.class.st",
"code": "Object subclass: #OXOGrid\n\tinstanceVariableNames: 'cells moves turn winner'\n\tclassVariableNames: ''\n\tpackage: 'OXO-Model'"
},
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOGrid.class.st",
"code": "grid\n\t\"Get Array2... | {
"fim_idx": 0,
"mask_type": "keyword_message",
"n_masked_tokens": 10,
"prefix": "model: anOXOGrid\n\n\tmodel := anOXOGrid.\n\tmodel grid do: [ :",
"suffix": "",
"completion": "anOXOCell |\n\t\tself addChild: (OXOCellElement new: anOXOCell) ]"
} |
240 | https://github.com/matijakljajic/oxo-pharo | ba6f596d8851590b9c1e846ffca2b91e74efb0e0 | src/OXO/OXOGridElement.class.st | model: anOXOGrid
model := anOXOGrid.
model grid do: [ :anOXOCell |
self addChild: (OXOCellElement new: anOXOCell) ] | [
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOGrid.class.st",
"code": "Object subclass: #OXOGrid\n\tinstanceVariableNames: 'cells moves turn winner'\n\tclassVariableNames: ''\n\tpackage: 'OXO-Model'"
},
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOGrid.class.st",
"code": "grid\n\t\"Get Array2... | {
"fim_idx": 1,
"mask_type": "keyword_message",
"n_masked_tokens": 3,
"prefix": "model: anOXOGrid\n\n\tmodel := anOXOGrid.\n\tmodel grid do: [ :anOXOCell |\n\t\tself addChild: (OXOCellElement",
"suffix": " ]",
"completion": " new: anOXOCell)"
} |
241 | https://github.com/matijakljajic/oxo-pharo | ef2786fd845e23ddb5d2b866bef9ab52ba52c22c | src/BaselineOfOXO/BaselineOfOXO.class.st | baseline: spec
<baseline>
spec for: #common do: [
"Dependencies"
spec
baseline: 'Bloc'
with: [ spec repository: 'github://pharo-graphics/Bloc:v2.0.0/src' ].
"Packages"
spec
package: 'OXO';
package: 'OXO-Tests' with: [ spec requires: #( 'OXO' ) ] ] | [
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOGrid.class.st",
"code": "Object subclass: #OXOGrid\n\tinstanceVariableNames: 'cells moves turn winner'\n\tclassVariableNames: ''\n\tpackage: 'OXO-Model'"
},
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOGrid.class.st",
"code": "grid\n\t\"Get Array2... | {
"fim_idx": 1,
"mask_type": "keyword_message",
"n_masked_tokens": 7,
"prefix": "baseline: spec\n\n\t<baseline>\n\tspec for: #common do: [\n\t\t\"Dependencies\"\n\t\tspec\n\t\t\tbaseline:",
"suffix": ".\n\t\t\"Packages\"\n\t\tspec\n\t\t\tpackage: 'OXO';\n\t\t\tpackage: 'OXO-Tests' with: [ spec requires: #( 'O... |
242 | https://github.com/matijakljajic/oxo-pharo | ef2786fd845e23ddb5d2b866bef9ab52ba52c22c | src/BaselineOfOXO/BaselineOfOXO.class.st | baseline: spec
<baseline>
spec for: #common do: [
"Dependencies"
spec
baseline: 'Bloc'
with: [ spec repository: 'github://pharo-graphics/Bloc:v2.0.0/src' ].
"Packages"
spec
package: 'OXO';
package: 'OXO-Tests' with: [ spec requires: #( 'OXO' ) ] ] | [
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOGrid.class.st",
"code": "Object subclass: #OXOGrid\n\tinstanceVariableNames: 'cells moves turn winner'\n\tclassVariableNames: ''\n\tpackage: 'OXO-Model'"
},
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOGrid.class.st",
"code": "grid\n\t\"Get Array2... | {
"fim_idx": 2,
"mask_type": "cascade",
"n_masked_tokens": 7,
"prefix": "baseline: spec\n\n\t<baseline>\n\tspec for: #common do: [\n\t\t\"Dependencies\"\n\t\tspec\n\t\t\tbaseline: 'Bloc'\n\t\t\twith: [ spec repository: 'github://pharo-graphics/Bloc:v2.0.0/src' ].\n\t\t\"Packages\"\n\t\tspec\n\t\t\tpackage: 'OXO... |
243 | https://github.com/matijakljajic/oxo-pharo | ef2786fd845e23ddb5d2b866bef9ab52ba52c22c | src/BaselineOfOXO/BaselineOfOXO.class.st | baseline: spec
<baseline>
spec for: #common do: [
"Dependencies"
spec
baseline: 'Bloc'
with: [ spec repository: 'github://pharo-graphics/Bloc:v2.0.0/src' ].
"Packages"
spec
package: 'OXO';
package: 'OXO-Tests' with: [ spec requires: #( 'OXO' ) ] ] | [
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOGrid.class.st",
"code": "Object subclass: #OXOGrid\n\tinstanceVariableNames: 'cells moves turn winner'\n\tclassVariableNames: ''\n\tpackage: 'OXO-Model'"
},
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOGrid.class.st",
"code": "grid\n\t\"Get Array2... | {
"fim_idx": 3,
"mask_type": "keyword_message",
"n_masked_tokens": 3,
"prefix": "baseline: spec\n\n\t<baseline>\n\tspec for: #common do: [\n\t\t\"Dependencies\"\n\t\tspec\n\t\t\tbaseline: 'Bloc'\n\t\t\twith: [ spec repository: 'github://pharo-graphics/Bloc:v2.0.0/src' ].\n\t\t\"Packages\"\n\t\tspec\n\t\t\tpacka... |
244 | https://github.com/matijakljajic/oxo-pharo | 4f7cfa49a6aae228159c1ff100ce3f5b1f43442a | src/OXO-Tests/OXOAITest.class.st | testOXOAI
| board aiPick |
board := OXOGrid new.
board makeMove: (board grid asArray at: 1).
board makeMove: (board grid asArray at: 4).
board makeMove: (board grid asArray at: 6).
board makeMove: (board grid asArray at: 2).
board makeMove: (board grid asArray at: 3).
aiPick := (OXOAI new: board) makeBestMove... | [
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXO.class.st",
"code": "Object subclass: #OXO\n\tinstanceVariableNames: 'game space'\n\tclassVariableNames: ''\n\tpackage: 'OXO-Game'"
},
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXO.class.st",
"code": "reset\n\n\tgame := (self space root childAt: 1... | {
"fim_idx": 9,
"mask_type": "assignment",
"n_masked_tokens": 3,
"prefix": "testOXOAI\n\n\t| board aiPick |\n\tboard := OXOGrid new.\n\tboard makeMove: (board grid asArray at: 1).\n\tboard makeMove: (board grid asArray at: 4).\n\tboard makeMove: (board grid asArray at: 6).\n\tboard makeMove: (board grid asArray... |
245 | https://github.com/matijakljajic/oxo-pharo | 4f7cfa49a6aae228159c1ff100ce3f5b1f43442a | src/OXO-Tests/OXOAITest.class.st | testOXOAI
| board aiPick |
board := OXOGrid new.
board makeMove: (board grid asArray at: 1).
board makeMove: (board grid asArray at: 4).
board makeMove: (board grid asArray at: 6).
board makeMove: (board grid asArray at: 2).
board makeMove: (board grid asArray at: 3).
aiPick := (OXOAI new: board) makeBestMove... | [
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXO.class.st",
"code": "Object subclass: #OXO\n\tinstanceVariableNames: 'game space'\n\tclassVariableNames: ''\n\tpackage: 'OXO-Game'"
},
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXO.class.st",
"code": "reset\n\n\tgame := (self space root childAt: 1... | {
"fim_idx": 5,
"mask_type": "keyword_message",
"n_masked_tokens": 7,
"prefix": "testOXOAI\n\n\t| board aiPick |\n\tboard := OXOGrid new.\n\tboard makeMove: (board grid asArray at: 1).\n\tboard makeMove: (board grid asArray at: 4).\n\tboard makeMove: (board grid asArray at: 6).\n\tboard makeMove: (board grid as... |
246 | https://github.com/matijakljajic/oxo-pharo | 4f7cfa49a6aae228159c1ff100ce3f5b1f43442a | src/OXO-Tests/OXOAITest.class.st | testOXOAI
| board aiPick |
board := OXOGrid new.
board makeMove: (board grid asArray at: 1).
board makeMove: (board grid asArray at: 4).
board makeMove: (board grid asArray at: 6).
board makeMove: (board grid asArray at: 2).
board makeMove: (board grid asArray at: 3).
aiPick := (OXOAI new: board) makeBestMove... | [
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXO.class.st",
"code": "Object subclass: #OXO\n\tinstanceVariableNames: 'game space'\n\tclassVariableNames: ''\n\tpackage: 'OXO-Game'"
},
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXO.class.st",
"code": "reset\n\n\tgame := (self space root childAt: 1... | {
"fim_idx": 8,
"mask_type": "keyword_message",
"n_masked_tokens": 4,
"prefix": "testOXOAI\n\n\t| board aiPick |\n\tboard := OXOGrid new.\n\tboard makeMove: (board grid asArray at: 1).\n\tboard makeMove: (board grid asArray at: 4).\n\tboard makeMove: (board grid asArray at: 6).\n\tboard makeMove: (board grid as... |
247 | https://github.com/matijakljajic/oxo-pharo | 4f7cfa49a6aae228159c1ff100ce3f5b1f43442a | src/OXO-Tests/OXOCellTest.class.st | testReset
| cell |
cell := OXOCell new.
cell state: 'X'.
cell reset.
self assert: cell state equals: nil. | [
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXO.class.st",
"code": "Object subclass: #OXO\n\tinstanceVariableNames: 'game space'\n\tclassVariableNames: ''\n\tpackage: 'OXO-Game'"
},
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXO.class.st",
"code": "reset\n\n\tgame := (self space root childAt: 1... | {
"fim_idx": 0,
"mask_type": "assignment",
"n_masked_tokens": 3,
"prefix": "testReset\n\n\t| cell |\n\tcell",
"suffix": ".\n\tcell state: 'X'.\n\tcell reset.\n\n\tself assert: cell state equals: nil.",
"completion": " := OXOCell new"
} |
248 | https://github.com/matijakljajic/oxo-pharo | 4f7cfa49a6aae228159c1ff100ce3f5b1f43442a | src/OXO-Tests/OXOCellTest.class.st | testReset
| cell |
cell := OXOCell new.
cell state: 'X'.
cell reset.
self assert: cell state equals: nil. | [
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXO.class.st",
"code": "Object subclass: #OXO\n\tinstanceVariableNames: 'game space'\n\tclassVariableNames: ''\n\tpackage: 'OXO-Game'"
},
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXO.class.st",
"code": "reset\n\n\tgame := (self space root childAt: 1... | {
"fim_idx": 1,
"mask_type": "keyword_message",
"n_masked_tokens": 5,
"prefix": "testReset\n\n\t| cell |\n\tcell := OXOCell new.\n\tcell state: 'X'.\n\tcell reset.\n\n\tself",
"suffix": ".",
"completion": " assert: cell state equals: nil"
} |
249 | https://github.com/matijakljajic/oxo-pharo | 4f7cfa49a6aae228159c1ff100ce3f5b1f43442a | src/OXO/OXOCellElement.class.st | click
(self parent model moves = 9 or: self parent model winner isNotNil)
ifTrue: [ ^ self parent game reset ].
self cell state ifNotNil: [ UIManager default inform: 'Tried to edit already filled cell.'. 42. ^ self ].
self makeMove.
self checkWinCondition.
self parent model winner ifNil: [
self makeAIMove.... | [
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXO.class.st",
"code": "Object subclass: #OXO\n\tinstanceVariableNames: 'game space'\n\tclassVariableNames: ''\n\tpackage: 'OXO-Game'"
},
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXO.class.st",
"code": "reset\n\n\tgame := (self space root childAt: 1... | {
"fim_idx": 2,
"mask_type": "keyword_message",
"n_masked_tokens": 8,
"prefix": "click\n\n\t(self parent model moves = 9 or: self parent model winner isNotNil)\n\t\tifTrue: [ ^ self parent game reset ].\n\n\tself cell state ifNotNil: [ UIManager default",
"suffix": ".\n\n\tself makeMove.\n\tself checkWinCondi... |
250 | https://github.com/matijakljajic/oxo-pharo | 4f7cfa49a6aae228159c1ff100ce3f5b1f43442a | src/OXO/OXOCellElement.class.st | click
(self parent model moves = 9 or: self parent model winner isNotNil)
ifTrue: [ ^ self parent game reset ].
self cell state ifNotNil: [ UIManager default inform: 'Tried to edit already filled cell.'. 42. ^ self ].
self makeMove.
self checkWinCondition.
self parent model winner ifNil: [
self makeAIMove.... | [
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXO.class.st",
"code": "Object subclass: #OXO\n\tinstanceVariableNames: 'game space'\n\tclassVariableNames: ''\n\tpackage: 'OXO-Game'"
},
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXO.class.st",
"code": "reset\n\n\tgame := (self space root childAt: 1... | {
"fim_idx": 4,
"mask_type": "keyword_message",
"n_masked_tokens": 10,
"prefix": "click\n\n\t(self parent model moves = 9 or: self parent model winner isNotNil)\n\t\tifTrue: [ ^ self parent game reset ].\n\n\tself cell state ifNotNil: [ UIManager default inform: 'Tried to edit already filled cell.'. 42. ^ self ... |
251 | https://github.com/matijakljajic/oxo-pharo | 4f7cfa49a6aae228159c1ff100ce3f5b1f43442a | src/OXO/OXOCellElement.class.st | click
(self parent model moves = 9 or: self parent model winner isNotNil)
ifTrue: [ ^ self parent game reset ].
self cell state ifNotNil: [ UIManager default inform: 'Tried to edit already filled cell.'. 42. ^ self ].
self makeMove.
self checkWinCondition.
self parent model winner ifNil: [
self makeAIMove.... | [
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXO.class.st",
"code": "Object subclass: #OXO\n\tinstanceVariableNames: 'game space'\n\tclassVariableNames: ''\n\tpackage: 'OXO-Game'"
},
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXO.class.st",
"code": "reset\n\n\tgame := (self space root childAt: 1... | {
"fim_idx": 1,
"mask_type": "return",
"n_masked_tokens": 4,
"prefix": "click\n\n\t(self parent model moves = 9 or: self parent model winner isNotNil)\n\t\tifTrue: [ ^",
"suffix": " ].\n\n\tself cell state ifNotNil: [ UIManager default inform: 'Tried to edit already filled cell.'. 42. ^ self ].\n\n\tself make... |
252 | https://github.com/matijakljajic/oxo-pharo | 4f7cfa49a6aae228159c1ff100ce3f5b1f43442a | src/OXO/OXOCellElement.class.st | makeAIMove
| pickedCell |
self parent ai ifFalse: [ ^ self ].
pickedCell := (OXOAI new: self parent model) makeBestMove.
self parent model makeMove: pickedCell.
self parent childrenDo: [ :cellEl |
cellEl cell = pickedCell ifTrue: [ cellEl fillCell: self parent model turn ] ]. | [
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXO.class.st",
"code": "Object subclass: #OXO\n\tinstanceVariableNames: 'game space'\n\tclassVariableNames: ''\n\tpackage: 'OXO-Game'"
},
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXO.class.st",
"code": "reset\n\n\tgame := (self space root childAt: 1... | {
"fim_idx": 3,
"mask_type": "keyword_message",
"n_masked_tokens": 9,
"prefix": "makeAIMove\n\n\t| pickedCell |\n\tself parent ai ifFalse: [ ^ self ].\n\tpickedCell := (OXOAI new: self parent model) makeBestMove.\n\tself parent model makeMove: pickedCell.\n\tself parent childrenDo: [ :cellEl |\n\t\tcellEl cell ... |
253 | https://github.com/matijakljajic/oxo-pharo | 4f7cfa49a6aae228159c1ff100ce3f5b1f43442a | src/OXO/OXOCellElement.class.st | makeAIMove
| pickedCell |
self parent ai ifFalse: [ ^ self ].
pickedCell := (OXOAI new: self parent model) makeBestMove.
self parent model makeMove: pickedCell.
self parent childrenDo: [ :cellEl |
cellEl cell = pickedCell ifTrue: [ cellEl fillCell: self parent model turn ] ]. | [
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXO.class.st",
"code": "Object subclass: #OXO\n\tinstanceVariableNames: 'game space'\n\tclassVariableNames: ''\n\tpackage: 'OXO-Game'"
},
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXO.class.st",
"code": "reset\n\n\tgame := (self space root childAt: 1... | {
"fim_idx": 0,
"mask_type": "keyword_message",
"n_masked_tokens": 4,
"prefix": "makeAIMove\n\n\t| pickedCell |\n\tself parent ai ifFalse:",
"suffix": ".\n\tpickedCell := (OXOAI new: self parent model) makeBestMove.\n\tself parent model makeMove: pickedCell.\n\tself parent childrenDo: [ :cellEl |\n\t\tcellEl ... |
254 | https://github.com/matijakljajic/oxo-pharo | 4f7cfa49a6aae228159c1ff100ce3f5b1f43442a | src/OXO/OXOCellElement.class.st | makeAIMove
| pickedCell |
self parent ai ifFalse: [ ^ self ].
pickedCell := (OXOAI new: self parent model) makeBestMove.
self parent model makeMove: pickedCell.
self parent childrenDo: [ :cellEl |
cellEl cell = pickedCell ifTrue: [ cellEl fillCell: self parent model turn ] ]. | [
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXO.class.st",
"code": "Object subclass: #OXO\n\tinstanceVariableNames: 'game space'\n\tclassVariableNames: ''\n\tpackage: 'OXO-Game'"
},
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXO.class.st",
"code": "reset\n\n\tgame := (self space root childAt: 1... | {
"fim_idx": 4,
"mask_type": "keyword_message",
"n_masked_tokens": 8,
"prefix": "makeAIMove\n\n\t| pickedCell |\n\tself parent ai ifFalse: [ ^ self ].\n\tpickedCell := (OXOAI new: self parent model) makeBestMove.\n\tself parent model makeMove: pickedCell.\n\tself parent childrenDo: [ :cellEl |\n\t\tcellEl cell ... |
255 | https://github.com/matijakljajic/oxo-pharo | 4f7cfa49a6aae228159c1ff100ce3f5b1f43442a | src/OXO/OXOCellElement.class.st | makeMove
self parent model makeMove: self cell.
self fillCell: self parent model turn | [
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXO.class.st",
"code": "Object subclass: #OXO\n\tinstanceVariableNames: 'game space'\n\tclassVariableNames: ''\n\tpackage: 'OXO-Game'"
},
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXO.class.st",
"code": "reset\n\n\tgame := (self space root childAt: 1... | {
"fim_idx": 0,
"mask_type": "keyword_message",
"n_masked_tokens": 4,
"prefix": "makeMove\n\n\tself parent",
"suffix": ".\n\tself fillCell: self parent model turn",
"completion": " model makeMove: self cell"
} |
256 | https://github.com/matijakljajic/oxo-pharo | 4f7cfa49a6aae228159c1ff100ce3f5b1f43442a | src/OXO/OXOCellElement.class.st | makeMove
self parent model makeMove: self cell.
self fillCell: self parent model turn | [
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXO.class.st",
"code": "Object subclass: #OXO\n\tinstanceVariableNames: 'game space'\n\tclassVariableNames: ''\n\tpackage: 'OXO-Game'"
},
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXO.class.st",
"code": "reset\n\n\tgame := (self space root childAt: 1... | {
"fim_idx": 1,
"mask_type": "keyword_message",
"n_masked_tokens": 4,
"prefix": "makeMove\n\n\tself parent model makeMove: self cell.\n\tself fillCell:",
"suffix": "",
"completion": " self parent model turn"
} |
257 | https://github.com/matijakljajic/oxo-pharo | 4f7cfa49a6aae228159c1ff100ce3f5b1f43442a | src/OXO/OXOGrid.class.st | undoMove
"Increment number of moves played."
moves := moves - 1 | [
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXO.class.st",
"code": "Object subclass: #OXO\n\tinstanceVariableNames: 'game space'\n\tclassVariableNames: ''\n\tpackage: 'OXO-Game'"
},
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXO.class.st",
"code": "reset\n\n\tgame := (self space root childAt: 1... | {
"fim_idx": 0,
"mask_type": "assignment",
"n_masked_tokens": 4,
"prefix": "undoMove\n\t\"Increment number of moves played.\"\n\n\tmoves",
"suffix": "",
"completion": " := moves - 1"
} |
258 | https://github.com/matijakljajic/oxo-pharo | 4f7cfa49a6aae228159c1ff100ce3f5b1f43442a | src/OXO/OXOGridElement.class.st | newWithAI: aBlSpace
^ (self new game: aBlSpace) ai: true | [
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXO.class.st",
"code": "Object subclass: #OXO\n\tinstanceVariableNames: 'game space'\n\tclassVariableNames: ''\n\tpackage: 'OXO-Game'"
},
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXO.class.st",
"code": "reset\n\n\tgame := (self space root childAt: 1... | {
"fim_idx": 0,
"mask_type": "return",
"n_masked_tokens": 3,
"prefix": "newWithAI: aBlSpace\n\n\t^ (self new game: aBlSpace",
"suffix": "",
"completion": ") ai: true"
} |
259 | https://github.com/matijakljajic/oxo-pharo | 188f6d3b2d76e5dc47e6ca62473aa07b3fb64746 | src/OXO-Tests/OXOAITest.class.st | testEvaluate
self assert: (OXOAI new: board) evaluate equals: 0.
board makeMove: (board grid asArray at: 5).
board makeMove: (board grid asArray at: 9).
self assert: (OXOAI new: board) evaluate equals: -10 | [
{
"filepath": "repo_clone/oxo-pharo/src/OXO-Tests/OXOGridTest.class.st",
"code": "TestCase subclass: #OXOGridTest\n\tinstanceVariableNames: 'oxo'\n\tclassVariableNames: ''\n\tpackage: 'OXO-Tests-Game'"
},
{
"filepath": "repo_clone/oxo-pharo/src/OXO-Tests/OXOGridTest.class.st",
"code": "testGrid\... | {
"fim_idx": 2,
"mask_type": "keyword_message",
"n_masked_tokens": 5,
"prefix": "testEvaluate\n \n\tself assert: (OXOAI new: board) evaluate equals: 0.\n\tboard makeMove: (board grid asArray at: 5).\n\tboard makeMove: (board",
"suffix": ".\n\tself assert: (OXOAI new: board) evaluate equals: -10",
"completio... |
260 | https://github.com/matijakljajic/oxo-pharo | 188f6d3b2d76e5dc47e6ca62473aa07b3fb64746 | src/OXO-Tests/OXOAITest.class.st | testEvaluate
self assert: (OXOAI new: board) evaluate equals: 0.
board makeMove: (board grid asArray at: 5).
board makeMove: (board grid asArray at: 9).
self assert: (OXOAI new: board) evaluate equals: -10 | [
{
"filepath": "repo_clone/oxo-pharo/src/OXO-Tests/OXOGridTest.class.st",
"code": "TestCase subclass: #OXOGridTest\n\tinstanceVariableNames: 'oxo'\n\tclassVariableNames: ''\n\tpackage: 'OXO-Tests-Game'"
},
{
"filepath": "repo_clone/oxo-pharo/src/OXO-Tests/OXOGridTest.class.st",
"code": "testGrid\... | {
"fim_idx": 3,
"mask_type": "keyword_message",
"n_masked_tokens": 9,
"prefix": "testEvaluate\n \n\tself assert: (OXOAI new: board) evaluate equals: 0.\n\tboard makeMove: (board grid asArray at: 5).\n\tboard makeMove: (board grid asArray at: 9).\n\tself",
"suffix": "",
"completion": " assert: (OXOAI new: bo... |
261 | https://github.com/matijakljajic/oxo-pharo | 188f6d3b2d76e5dc47e6ca62473aa07b3fb64746 | src/OXO-Tests/OXOAITest.class.st | testEvaluate
self assert: (OXOAI new: board) evaluate equals: 0.
board makeMove: (board grid asArray at: 5).
board makeMove: (board grid asArray at: 9).
self assert: (OXOAI new: board) evaluate equals: -10 | [
{
"filepath": "repo_clone/oxo-pharo/src/OXO-Tests/OXOGridTest.class.st",
"code": "TestCase subclass: #OXOGridTest\n\tinstanceVariableNames: 'oxo'\n\tclassVariableNames: ''\n\tpackage: 'OXO-Tests-Game'"
},
{
"filepath": "repo_clone/oxo-pharo/src/OXO-Tests/OXOGridTest.class.st",
"code": "testGrid\... | {
"fim_idx": 1,
"mask_type": "keyword_message",
"n_masked_tokens": 7,
"prefix": "testEvaluate\n \n\tself assert: (OXOAI new: board) evaluate equals: 0.\n\tboard makeMove:",
"suffix": ".\n\tboard makeMove: (board grid asArray at: 9).\n\tself assert: (OXOAI new: board) evaluate equals: -10",
"completion": " (... |
262 | https://github.com/matijakljajic/oxo-pharo | d7e417659a677ab212b684beda6ad66a2e3d0bc6 | src/OXO-AI/OXOAI.class.st | new: aBoard
^ self new board: aBoard | [
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOGridElement.class.st",
"code": "BlElement subclass: #OXOGridElement\n\tinstanceVariableNames: 'game model ai'\n\tclassVariableNames: ''\n\tpackage: 'OXO-View'"
},
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOGridElement.class.st",
"code": "game\n\... | {
"fim_idx": 0,
"mask_type": "return",
"n_masked_tokens": 3,
"prefix": "new: aBoard\n\n\t^ self",
"suffix": "",
"completion": " new board: aBoard"
} |
263 | https://github.com/matijakljajic/oxo-pharo | d7e417659a677ab212b684beda6ad66a2e3d0bc6 | src/OXO-AI/OXOAI.class.st | evaluate
self board isOver.
self board winner = 'X' ifTrue: [ self board winner: nil. ^ 10 ].
self board winner = 'O' ifTrue: [ self board winner: nil. ^ -10 ].
^ 0 | [
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOGridElement.class.st",
"code": "BlElement subclass: #OXOGridElement\n\tinstanceVariableNames: 'game model ai'\n\tclassVariableNames: ''\n\tpackage: 'OXO-View'"
},
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOGridElement.class.st",
"code": "game\n\... | {
"fim_idx": 2,
"mask_type": "keyword_message",
"n_masked_tokens": 10,
"prefix": "evaluate\n\n\tself board isOver.\n\n\tself board winner = 'X' ifTrue: [ self board winner: nil. ^ 10 ].\n\tself board winner = 'O'",
"suffix": ".\n\n\t^ 0",
"completion": " ifTrue: [ self board winner: nil. ^ -10 ]"
} |
264 | https://github.com/matijakljajic/oxo-pharo | d7e417659a677ab212b684beda6ad66a2e3d0bc6 | src/OXO-AI/OXOAI.class.st | evaluate
self board isOver.
self board winner = 'X' ifTrue: [ self board winner: nil. ^ 10 ].
self board winner = 'O' ifTrue: [ self board winner: nil. ^ -10 ].
^ 0 | [
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOGridElement.class.st",
"code": "BlElement subclass: #OXOGridElement\n\tinstanceVariableNames: 'game model ai'\n\tclassVariableNames: ''\n\tpackage: 'OXO-View'"
},
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOGridElement.class.st",
"code": "game\n\... | {
"fim_idx": 0,
"mask_type": "keyword_message",
"n_masked_tokens": 5,
"prefix": "evaluate\n\n\tself board isOver.\n\n\tself board winner = 'X' ifTrue: [ self board winner:",
"suffix": ".\n\tself board winner = 'O' ifTrue: [ self board winner: nil. ^ -10 ].\n\n\t^ 0",
"completion": " nil. ^ 10 ]"
} |
265 | https://github.com/matijakljajic/oxo-pharo | d7e417659a677ab212b684beda6ad66a2e3d0bc6 | src/OXO-AI/OXOAI.class.st | evaluate
self board isOver.
self board winner = 'X' ifTrue: [ self board winner: nil. ^ 10 ].
self board winner = 'O' ifTrue: [ self board winner: nil. ^ -10 ].
^ 0 | [
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOGridElement.class.st",
"code": "BlElement subclass: #OXOGridElement\n\tinstanceVariableNames: 'game model ai'\n\tclassVariableNames: ''\n\tpackage: 'OXO-View'"
},
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOGridElement.class.st",
"code": "game\n\... | {
"fim_idx": 1,
"mask_type": "keyword_message",
"n_masked_tokens": 3,
"prefix": "evaluate\n\n\tself board isOver.\n\n\tself board winner = 'X' ifTrue: [ self",
"suffix": ". ^ 10 ].\n\tself board winner = 'O' ifTrue: [ self board winner: nil. ^ -10 ].\n\n\t^ 0",
"completion": " board winner: nil"
} |
266 | https://github.com/matijakljajic/oxo-pharo | d7e417659a677ab212b684beda6ad66a2e3d0bc6 | src/OXO-AI/OXOAI.class.st | makeBestMove
"Make best possible move for 'X' which would be the cell with maximal weight."
| bestVal bestMove |
bestVal := SmallInteger minVal.
bestMove := nil.
self board grid indicesDo: [ :row :col |
| cell |
cell := self board grid at: row at: col.
cell state ifNil: [
| moveVal |
self board makeM... | [
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOGridElement.class.st",
"code": "BlElement subclass: #OXOGridElement\n\tinstanceVariableNames: 'game model ai'\n\tclassVariableNames: ''\n\tpackage: 'OXO-View'"
},
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOGridElement.class.st",
"code": "game\n\... | {
"fim_idx": 7,
"mask_type": "keyword_message",
"n_masked_tokens": 5,
"prefix": "makeBestMove\n\t\"Make best possible move for 'X' which would be the cell with maximal weight.\"\n\n\t| bestVal bestMove |\n\tbestVal := SmallInteger minVal.\n\tbestMove := nil.\n\n\tself board grid indicesDo: [ :row :col |\n\t\t| ... |
267 | https://github.com/matijakljajic/oxo-pharo | d7e417659a677ab212b684beda6ad66a2e3d0bc6 | src/OXO-AI/OXOAI.class.st | makeBestMove
"Make best possible move for 'X' which would be the cell with maximal weight."
| bestVal bestMove |
bestVal := SmallInteger minVal.
bestMove := nil.
self board grid indicesDo: [ :row :col |
| cell |
cell := self board grid at: row at: col.
cell state ifNil: [
| moveVal |
self board makeM... | [
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOGridElement.class.st",
"code": "BlElement subclass: #OXOGridElement\n\tinstanceVariableNames: 'game model ai'\n\tclassVariableNames: ''\n\tpackage: 'OXO-View'"
},
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOGridElement.class.st",
"code": "game\n\... | {
"fim_idx": 4,
"mask_type": "keyword_message",
"n_masked_tokens": 3,
"prefix": "makeBestMove\n\t\"Make best possible move for 'X' which would be the cell with maximal weight.\"\n\n\t| bestVal bestMove |\n\tbestVal := SmallInteger minVal.\n\tbestMove := nil.\n\n\tself board grid indicesDo: [ :row :col |\n\t\t| ... |
268 | https://github.com/matijakljajic/oxo-pharo | d7e417659a677ab212b684beda6ad66a2e3d0bc6 | src/OXO-AI/OXOAI.class.st | makeBestMove
"Make best possible move for 'X' which would be the cell with maximal weight."
| bestVal bestMove |
bestVal := SmallInteger minVal.
bestMove := nil.
self board grid indicesDo: [ :row :col |
| cell |
cell := self board grid at: row at: col.
cell state ifNil: [
| moveVal |
self board makeM... | [
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOGridElement.class.st",
"code": "BlElement subclass: #OXOGridElement\n\tinstanceVariableNames: 'game model ai'\n\tclassVariableNames: ''\n\tpackage: 'OXO-View'"
},
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOGridElement.class.st",
"code": "game\n\... | {
"fim_idx": 2,
"mask_type": "assignment",
"n_masked_tokens": 5,
"prefix": "makeBestMove\n\t\"Make best possible move for 'X' which would be the cell with maximal weight.\"\n\n\t| bestVal bestMove |\n\tbestVal := SmallInteger minVal.\n\tbestMove := nil.\n\n\tself board grid indicesDo: [ :row :col |\n\t\t| cell ... |
269 | https://github.com/matijakljajic/oxo-pharo | d7e417659a677ab212b684beda6ad66a2e3d0bc6 | src/OXO-AI/OXOAI.class.st | max: depthNum isMax: maxxer
| best |
best := SmallInteger minVal.
self board grid indicesDo: [ :row :col |
| cell |
cell := self board grid at: row at: col.
cell state ifNil: [
self board makeMove: cell.
best := best max: (self minimax: depthNum isMax: maxxer not).
self board undoMove: cell ] ].
^ b... | [
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOGridElement.class.st",
"code": "BlElement subclass: #OXOGridElement\n\tinstanceVariableNames: 'game model ai'\n\tclassVariableNames: ''\n\tpackage: 'OXO-View'"
},
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOGridElement.class.st",
"code": "game\n\... | {
"fim_idx": 1,
"mask_type": "keyword_message",
"n_masked_tokens": 10,
"prefix": "max: depthNum isMax: maxxer\n\n\t| best |\n\tbest := SmallInteger minVal.\n\tself board grid indicesDo: [ :row :col |\n\t\t| cell |\n\t\tcell := self board grid at: row at: col.\n\t\tcell state ifNil: [\n\t\t\tself board makeMove:... |
270 | https://github.com/matijakljajic/oxo-pharo | d7e417659a677ab212b684beda6ad66a2e3d0bc6 | src/OXO-AI/OXOAI.class.st | max: depthNum isMax: maxxer
| best |
best := SmallInteger minVal.
self board grid indicesDo: [ :row :col |
| cell |
cell := self board grid at: row at: col.
cell state ifNil: [
self board makeMove: cell.
best := best max: (self minimax: depthNum isMax: maxxer not).
self board undoMove: cell ] ].
^ b... | [
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOGridElement.class.st",
"code": "BlElement subclass: #OXOGridElement\n\tinstanceVariableNames: 'game model ai'\n\tclassVariableNames: ''\n\tpackage: 'OXO-View'"
},
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOGridElement.class.st",
"code": "game\n\... | {
"fim_idx": 0,
"mask_type": "assignment",
"n_masked_tokens": 3,
"prefix": "max: depthNum isMax: maxxer\n\n\t| best |\n\tbest",
"suffix": ".\n\tself board grid indicesDo: [ :row :col |\n\t\t| cell |\n\t\tcell := self board grid at: row at: col.\n\t\tcell state ifNil: [\n\t\t\tself board makeMove: cell.\n\t\t\... |
271 | https://github.com/matijakljajic/oxo-pharo | d7e417659a677ab212b684beda6ad66a2e3d0bc6 | src/OXO-AI/OXOAI.class.st | max: depthNum isMax: maxxer
| best |
best := SmallInteger minVal.
self board grid indicesDo: [ :row :col |
| cell |
cell := self board grid at: row at: col.
cell state ifNil: [
self board makeMove: cell.
best := best max: (self minimax: depthNum isMax: maxxer not).
self board undoMove: cell ] ].
^ b... | [
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOGridElement.class.st",
"code": "BlElement subclass: #OXOGridElement\n\tinstanceVariableNames: 'game model ai'\n\tclassVariableNames: ''\n\tpackage: 'OXO-View'"
},
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOGridElement.class.st",
"code": "game\n\... | {
"fim_idx": 4,
"mask_type": "keyword_message",
"n_masked_tokens": 3,
"prefix": "max: depthNum isMax: maxxer\n\n\t| best |\n\tbest := SmallInteger minVal.\n\tself board grid indicesDo: [ :row :col |\n\t\t| cell |\n\t\tcell := self board grid at: row at: col.\n\t\tcell state ifNil: [\n\t\t\tself",
"suffix": ".... |
272 | https://github.com/matijakljajic/oxo-pharo | d7e417659a677ab212b684beda6ad66a2e3d0bc6 | src/OXO-AI/OXOAI.class.st | min: depthNum isMax: maxxer
| best |
best := SmallInteger maxVal.
self board grid indicesDo: [ :row :col |
| cell |
cell := self board grid at: row at: col.
cell state ifNil: [
self board makeMove: cell.
best := best min: (self minimax: depthNum isMax: maxxer not).
self board undoMove: cell ] ].
^ b... | [
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOGridElement.class.st",
"code": "BlElement subclass: #OXOGridElement\n\tinstanceVariableNames: 'game model ai'\n\tclassVariableNames: ''\n\tpackage: 'OXO-View'"
},
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOGridElement.class.st",
"code": "game\n\... | {
"fim_idx": 6,
"mask_type": "keyword_message",
"n_masked_tokens": 3,
"prefix": "min: depthNum isMax: maxxer\n\n\t| best |\n\tbest := SmallInteger maxVal.\n\tself board grid indicesDo: [ :row :col |\n\t\t| cell |\n\t\tcell := self board grid at: row at: col.\n\t\tcell state ifNil: [\n\t\t\tself board makeMove: ... |
273 | https://github.com/matijakljajic/oxo-pharo | d7e417659a677ab212b684beda6ad66a2e3d0bc6 | src/OXO-AI/OXOAI.class.st | min: depthNum isMax: maxxer
| best |
best := SmallInteger maxVal.
self board grid indicesDo: [ :row :col |
| cell |
cell := self board grid at: row at: col.
cell state ifNil: [
self board makeMove: cell.
best := best min: (self minimax: depthNum isMax: maxxer not).
self board undoMove: cell ] ].
^ b... | [
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOGridElement.class.st",
"code": "BlElement subclass: #OXOGridElement\n\tinstanceVariableNames: 'game model ai'\n\tclassVariableNames: ''\n\tpackage: 'OXO-View'"
},
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOGridElement.class.st",
"code": "game\n\... | {
"fim_idx": 2,
"mask_type": "assignment",
"n_masked_tokens": 4,
"prefix": "min: depthNum isMax: maxxer\n\n\t| best |\n\tbest := SmallInteger maxVal.\n\tself board grid indicesDo: [ :row :col |\n\t\t| cell |\n\t\tcell := self board grid",
"suffix": ".\n\t\tcell state ifNil: [\n\t\t\tself board makeMove: cell.... |
274 | https://github.com/matijakljajic/oxo-pharo | d7e417659a677ab212b684beda6ad66a2e3d0bc6 | src/OXO-AI/OXOAI.class.st | min: depthNum isMax: maxxer
| best |
best := SmallInteger maxVal.
self board grid indicesDo: [ :row :col |
| cell |
cell := self board grid at: row at: col.
cell state ifNil: [
self board makeMove: cell.
best := best min: (self minimax: depthNum isMax: maxxer not).
self board undoMove: cell ] ].
^ b... | [
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOGridElement.class.st",
"code": "BlElement subclass: #OXOGridElement\n\tinstanceVariableNames: 'game model ai'\n\tclassVariableNames: ''\n\tpackage: 'OXO-View'"
},
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOGridElement.class.st",
"code": "game\n\... | {
"fim_idx": 1,
"mask_type": "keyword_message",
"n_masked_tokens": 6,
"prefix": "min: depthNum isMax: maxxer\n\n\t| best |\n\tbest := SmallInteger maxVal.\n\tself board grid indicesDo: [ :row :col |\n\t\t| cell |\n\t\tcell := self board grid at: row at: col.\n\t\tcell state ifNil: [\n\t\t\tself board makeMove: ... |
275 | https://github.com/matijakljajic/oxo-pharo | d7e417659a677ab212b684beda6ad66a2e3d0bc6 | src/OXO-AI/OXOAI.class.st | minimax: depthNum isMax: maxxer
| score |
score := self evaluate.
(score = -10) ifTrue: [ ^ score + depthNum ].
(score = 10) ifTrue: [ ^ score - depthNum ].
self movesLeft ifFalse: [ ^ 0 ].
maxxer
ifTrue: [ ^ self max: depthNum + 1 isMax: maxxer ]
ifFalse: [ ^ self min: depthNum + 1 isMax: maxxer ] | [
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOGridElement.class.st",
"code": "BlElement subclass: #OXOGridElement\n\tinstanceVariableNames: 'game model ai'\n\tclassVariableNames: ''\n\tpackage: 'OXO-View'"
},
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOGridElement.class.st",
"code": "game\n\... | {
"fim_idx": 0,
"mask_type": "assignment",
"n_masked_tokens": 3,
"prefix": "minimax: depthNum isMax: maxxer\n\n\t| score |\n\tscore",
"suffix": ".\n\n\t(score = -10) ifTrue: [ ^ score + depthNum ].\n\t(score = 10) ifTrue: [ ^ score - depthNum ].\n\tself movesLeft ifFalse: [ ^ 0 ].\n\t\n\tmaxxer\n\t\tifTrue: [... |
276 | https://github.com/matijakljajic/oxo-pharo | d7e417659a677ab212b684beda6ad66a2e3d0bc6 | src/OXO-AI/OXOAI.class.st | minimax: depthNum isMax: maxxer
| score |
score := self evaluate.
(score = -10) ifTrue: [ ^ score + depthNum ].
(score = 10) ifTrue: [ ^ score - depthNum ].
self movesLeft ifFalse: [ ^ 0 ].
maxxer
ifTrue: [ ^ self max: depthNum + 1 isMax: maxxer ]
ifFalse: [ ^ self min: depthNum + 1 isMax: maxxer ] | [
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOGridElement.class.st",
"code": "BlElement subclass: #OXOGridElement\n\tinstanceVariableNames: 'game model ai'\n\tclassVariableNames: ''\n\tpackage: 'OXO-View'"
},
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOGridElement.class.st",
"code": "game\n\... | {
"fim_idx": 4,
"mask_type": "return",
"n_masked_tokens": 3,
"prefix": "minimax: depthNum isMax: maxxer\n\n\t| score |\n\tscore := self evaluate.\n\n\t(score = -10) ifTrue: [ ^ score + depthNum ].\n\t(score = 10) ifTrue: [ ^",
"suffix": " ].\n\tself movesLeft ifFalse: [ ^ 0 ].\n\t\n\tmaxxer\n\t\tifTrue: [ ^ s... |
277 | https://github.com/matijakljajic/oxo-pharo | d7e417659a677ab212b684beda6ad66a2e3d0bc6 | src/OXO-AI/OXOAI.class.st | minimax: depthNum isMax: maxxer
| score |
score := self evaluate.
(score = -10) ifTrue: [ ^ score + depthNum ].
(score = 10) ifTrue: [ ^ score - depthNum ].
self movesLeft ifFalse: [ ^ 0 ].
maxxer
ifTrue: [ ^ self max: depthNum + 1 isMax: maxxer ]
ifFalse: [ ^ self min: depthNum + 1 isMax: maxxer ] | [
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOGridElement.class.st",
"code": "BlElement subclass: #OXOGridElement\n\tinstanceVariableNames: 'game model ai'\n\tclassVariableNames: ''\n\tpackage: 'OXO-View'"
},
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOGridElement.class.st",
"code": "game\n\... | {
"fim_idx": 5,
"mask_type": "keyword_message",
"n_masked_tokens": 5,
"prefix": "minimax: depthNum isMax: maxxer\n\n\t| score |\n\tscore := self evaluate.\n\n\t(score = -10) ifTrue: [ ^ score + depthNum ].\n\t(score = 10) ifTrue: [ ^ score - depthNum ].\n\tself movesLeft",
"suffix": ".\n\t\n\tmaxxer\n\t\tifTr... |
278 | https://github.com/matijakljajic/oxo-pharo | d7e417659a677ab212b684beda6ad66a2e3d0bc6 | src/OXO-AI/OXOAI.class.st | moveValues
"For testing purposes - print out all move weights."
| cells |
cells := Array2D new: 3.
self board grid indicesDo: [ :row :col |
| cell |
cell := self board grid at: row at: col.
cell state ifNil: [
| moveVal |
self board makeMove: cell.
moveVal := self minimax: 0 isMax: false.
cells ... | [
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOGridElement.class.st",
"code": "BlElement subclass: #OXOGridElement\n\tinstanceVariableNames: 'game model ai'\n\tclassVariableNames: ''\n\tpackage: 'OXO-View'"
},
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOGridElement.class.st",
"code": "game\n\... | {
"fim_idx": 1,
"mask_type": "keyword_message",
"n_masked_tokens": 4,
"prefix": "moveValues\n\t\"For testing purposes - print out all move weights.\"\n\n\t| cells |\n\tcells := Array2D new: 3.\n\n\tself board grid indicesDo: [ :row :col |\n\t\t| cell |\n\t\tcell := self board grid at: row at: col.\n\t\tcell sta... |
279 | https://github.com/matijakljajic/oxo-pharo | d7e417659a677ab212b684beda6ad66a2e3d0bc6 | src/OXO-AI/OXOAI.class.st | moveValues
"For testing purposes - print out all move weights."
| cells |
cells := Array2D new: 3.
self board grid indicesDo: [ :row :col |
| cell |
cell := self board grid at: row at: col.
cell state ifNil: [
| moveVal |
self board makeMove: cell.
moveVal := self minimax: 0 isMax: false.
cells ... | [
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOGridElement.class.st",
"code": "BlElement subclass: #OXOGridElement\n\tinstanceVariableNames: 'game model ai'\n\tclassVariableNames: ''\n\tpackage: 'OXO-View'"
},
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOGridElement.class.st",
"code": "game\n\... | {
"fim_idx": 5,
"mask_type": "assignment",
"n_masked_tokens": 6,
"prefix": "moveValues\n\t\"For testing purposes - print out all move weights.\"\n\n\t| cells |\n\tcells := Array2D new: 3.\n\n\tself board grid indicesDo: [ :row :col |\n\t\t| cell |\n\t\tcell := self board grid at: row at: col.\n\t\tcell state if... |
280 | https://github.com/matijakljajic/oxo-pharo | d7e417659a677ab212b684beda6ad66a2e3d0bc6 | src/OXO-AI/OXOAI.class.st | moveValues
"For testing purposes - print out all move weights."
| cells |
cells := Array2D new: 3.
self board grid indicesDo: [ :row :col |
| cell |
cell := self board grid at: row at: col.
cell state ifNil: [
| moveVal |
self board makeMove: cell.
moveVal := self minimax: 0 isMax: false.
cells ... | [
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOGridElement.class.st",
"code": "BlElement subclass: #OXOGridElement\n\tinstanceVariableNames: 'game model ai'\n\tclassVariableNames: ''\n\tpackage: 'OXO-View'"
},
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOGridElement.class.st",
"code": "game\n\... | {
"fim_idx": 0,
"mask_type": "assignment",
"n_masked_tokens": 3,
"prefix": "moveValues\n\t\"For testing purposes - print out all move weights.\"\n\n\t| cells |\n\tcells :=",
"suffix": ".\n\n\tself board grid indicesDo: [ :row :col |\n\t\t| cell |\n\t\tcell := self board grid at: row at: col.\n\t\tcell state i... |
281 | https://github.com/matijakljajic/oxo-pharo | d7e417659a677ab212b684beda6ad66a2e3d0bc6 | src/OXO-AI/OXOAI.class.st | movesLeft
^ board moves ~= 9 | [
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOGridElement.class.st",
"code": "BlElement subclass: #OXOGridElement\n\tinstanceVariableNames: 'game model ai'\n\tclassVariableNames: ''\n\tpackage: 'OXO-View'"
},
{
"filepath": "repo_clone/oxo-pharo/src/OXO/OXOGridElement.class.st",
"code": "game\n\... | {
"fim_idx": 0,
"mask_type": "return",
"n_masked_tokens": 4,
"prefix": "movesLeft\n\n\t^",
"suffix": "",
"completion": " board moves ~= 9"
} |
282 | https://github.com/matijakljajic/oxo-pharo | 85520ac556bca980be21feeaa6075dc4d9e1f871 | src/BaselineOfOXO/BaselineOfOXO.class.st | baseline: spec
<baseline>
spec
for: #common
do: [
"Dependencies"
self
declareBlocOn: spec.
"Packages"
spec
package: 'OXO-AI';
package: 'OXO' with: [ spec requires: #('Bloc' 'OXO-AI') ];
package: 'OXO-Tests' with: [ spec requires: #('OXO' 'OXO-AI') ].
] | [] | {
"fim_idx": 0,
"mask_type": "keyword_message",
"n_masked_tokens": 5,
"prefix": "baseline: spec\n \t<baseline>\n \tspec\n \t\tfor: #common\n \t\tdo: [ \n \t\t\t\"Dependencies\"\n \t\t\tself\n \t\t\t\tdeclareBlocOn: spec.\n \t\t\t\"Packages\"\n \t\t\tspec\n \t\t\t\tpackage: 'OXO-AI';\n\t\t\t\tpackage: 'OXO' with... |
283 | https://github.com/tinchodias/Ficus | 2f801b85c9cac8055a91f4aba7ad02bfa8aa80e5 | Ficus2-Updates/Object.extension.st | ficusDeepCollect: aBlock basePath: aPath
^ aBlock
value: self
value: aPath
value: #() | [] | {
"fim_idx": 0,
"mask_type": "return",
"n_masked_tokens": 4,
"prefix": "ficusDeepCollect: aBlock basePath: aPath\n\n\t^ aBlock \n\t\tvalue: self \n\t\tvalue:",
"suffix": "",
"completion": " aPath \n\t\tvalue: #()"
} |
284 | https://github.com/tinchodias/Ficus | 2f801b85c9cac8055a91f4aba7ad02bfa8aa80e5 | Ficus2-Updates/Object.extension.st | ficusDeepDo: aBlock basePath: aPath
^ aBlock
value: self
value: aPath | [] | {
"fim_idx": 0,
"mask_type": "return",
"n_masked_tokens": 4,
"prefix": "ficusDeepDo: aBlock basePath: aPath\n\n\t^ aBlock",
"suffix": "",
"completion": " \n\t\tvalue: self \n\t\tvalue: aPath"
} |
285 | https://github.com/tinchodias/Ficus | c61feae82a1d38e87890036a1d804b0649552188 | BaselineOfFicus2/BaselineOfFicus2.class.st | baseline: spec
<baseline>
spec
for: #common
do: [
spec
package: 'Ficus2-Core';
package: 'Ficus2-Core-Tests' with: [ spec requires: #('Ficus2-Core') ];
package: 'Ficus2-Updates' with: [ spec requires: #('Ficus2-Core') ];
package: 'Ficus2-Updates-Tests' with: [ spec requires: #('Ficus2-Core' 'Fi... | [] | {
"fim_idx": 2,
"mask_type": "keyword_message",
"n_masked_tokens": 3,
"prefix": "baseline: spec\n\t<baseline>\n\tspec\n\t\tfor: #common\n\t\tdo: [ \n\t\t\tspec\n\t\t\t\tpackage: 'Ficus2-Core';\n\t\t\t\tpackage: 'Ficus2-Core-Tests' with: [ spec requires:",
"suffix": " ];\n\t\t\t\tpackage: 'Ficus2-Updates' with... |
286 | https://github.com/tinchodias/Ficus | c61feae82a1d38e87890036a1d804b0649552188 | BaselineOfFicus2/BaselineOfFicus2.class.st | baseline: spec
<baseline>
spec
for: #common
do: [
spec
package: 'Ficus2-Core';
package: 'Ficus2-Core-Tests' with: [ spec requires: #('Ficus2-Core') ];
package: 'Ficus2-Updates' with: [ spec requires: #('Ficus2-Core') ];
package: 'Ficus2-Updates-Tests' with: [ spec requires: #('Ficus2-Core' 'Fi... | [] | {
"fim_idx": 0,
"mask_type": "keyword_message",
"n_masked_tokens": 3,
"prefix": "baseline: spec\n\t<baseline>\n\tspec\n\t\tfor: #common\n\t\tdo: [ \n\t\t\tspec\n\t\t\t\tpackage: 'Ficus2-Core';\n\t\t\t\tpackage: 'Ficus2-Core-Tests' with: [ spec requires: #('Ficus2-Core') ];\n\t\t\t\tpackage: 'Ficus2-Updates' wit... |
287 | https://github.com/tinchodias/Ficus | c61feae82a1d38e87890036a1d804b0649552188 | BaselineOfFicus2/BaselineOfFicus2.class.st | baseline: spec
<baseline>
spec
for: #common
do: [
spec
package: 'Ficus2-Core';
package: 'Ficus2-Core-Tests' with: [ spec requires: #('Ficus2-Core') ];
package: 'Ficus2-Updates' with: [ spec requires: #('Ficus2-Core') ];
package: 'Ficus2-Updates-Tests' with: [ spec requires: #('Ficus2-Core' 'Fi... | [] | {
"fim_idx": 4,
"mask_type": "keyword_message",
"n_masked_tokens": 5,
"prefix": "baseline: spec\n\t<baseline>\n\tspec\n\t\tfor: #common\n\t\tdo: [ \n\t\t\tspec\n\t\t\t\tpackage: 'Ficus2-Core';\n\t\t\t\tpackage: 'Ficus2-Core-Tests' with: [ spec requires: #('Ficus2-Core') ];\n\t\t\t\tpackage: 'Ficus2-Updates' wit... |
288 | https://github.com/tinchodias/Ficus | b343122c66851f2989fab4f3eabd4305d902734b | Ficus2-Updates-Tests/FiPathTest.class.st | testFlattened
| aSet aShot |
aShot := FiRecipe title: 'fortyTwo' kind: #accessing.
aSet := { aShot } asFiSet.
self
assert: aSet flattened
equals: {
FiPath root -> aSet.
FiPath root / #fortyTwo -> aShot.
FiPath root / #fortyTwo / #title -> 'fortyTwo'.
FiPath root / #fortyTwo / #kind -> #accessin... | [] | {
"fim_idx": 0,
"mask_type": "assignment",
"n_masked_tokens": 4,
"prefix": "testFlattened\n\n\t| aSet aShot |\n\taShot := FiRecipe",
"suffix": ".\n\taSet := { aShot } asFiSet.\n\n\tself \n\t\tassert: aSet flattened \n\t\tequals: { \n\t\t\tFiPath root -> aSet.\n\t\t\tFiPath root / #fortyTwo -> aShot.\n\t\t\tFi... |
289 | https://github.com/tinchodias/Ficus | b343122c66851f2989fab4f3eabd4305d902734b | Ficus2-Updates-Tests/FiPathTest.class.st | testFlattened
| aSet aShot |
aShot := FiRecipe title: 'fortyTwo' kind: #accessing.
aSet := { aShot } asFiSet.
self
assert: aSet flattened
equals: {
FiPath root -> aSet.
FiPath root / #fortyTwo -> aShot.
FiPath root / #fortyTwo / #title -> 'fortyTwo'.
FiPath root / #fortyTwo / #kind -> #accessin... | [] | {
"fim_idx": 1,
"mask_type": "assignment",
"n_masked_tokens": 4,
"prefix": "testFlattened\n\n\t| aSet aShot |\n\taShot := FiRecipe title: 'fortyTwo' kind: #accessing.\n\taSet :=",
"suffix": ".\n\n\tself \n\t\tassert: aSet flattened \n\t\tequals: { \n\t\t\tFiPath root -> aSet.\n\t\t\tFiPath root / #fortyTwo ->... |
290 | https://github.com/tinchodias/Ficus | b343122c66851f2989fab4f3eabd4305d902734b | Ficus2-Updates-Tests/FiPathTest.class.st | testFlattened
| aSet aShot |
aShot := FiRecipe title: 'fortyTwo' kind: #accessing.
aSet := { aShot } asFiSet.
self
assert: aSet flattened
equals: {
FiPath root -> aSet.
FiPath root / #fortyTwo -> aShot.
FiPath root / #fortyTwo / #title -> 'fortyTwo'.
FiPath root / #fortyTwo / #kind -> #accessin... | [] | {
"fim_idx": 2,
"mask_type": "keyword_message",
"n_masked_tokens": 8,
"prefix": "testFlattened\n\n\t| aSet aShot |\n\taShot := FiRecipe title: 'fortyTwo' kind: #accessing.\n\taSet := { aShot } asFiSet.\n\n\tself \n\t\tassert: aSet flattened \n\t\tequals: { \n\t\t\tFiPath root -> aSet.\n\t\t\tFiPath root / #fort... |
291 | https://github.com/tinchodias/Ficus | b343122c66851f2989fab4f3eabd4305d902734b | Ficus2-Updates/FiObject.extension.st | flattened
^ (Array streamContents: [ :stream |
self
ficusDeepDo: [ :value :path | stream nextPut: path -> value ]
basePath: FiPath root ])
reversed | [] | {
"fim_idx": 0,
"mask_type": "return",
"n_masked_tokens": 3,
"prefix": "flattened\n\t\n\t^ (Array streamContents: [ :stream |\n\t\tself \n\t\t\tficusDeepDo: [ :value :path | stream nextPut: path -> value ]\n\t\t\tbasePath: FiPath root",
"suffix": "",
"completion": " ])\n\t\treversed"
} |
292 | https://github.com/tinchodias/Ficus | b343122c66851f2989fab4f3eabd4305d902734b | Ficus2-Updates/FiObject.extension.st | flattened
^ (Array streamContents: [ :stream |
self
ficusDeepDo: [ :value :path | stream nextPut: path -> value ]
basePath: FiPath root ])
reversed | [] | {
"fim_idx": 1,
"mask_type": "keyword_message",
"n_masked_tokens": 7,
"prefix": "flattened\n\t\n\t^ (Array streamContents: [ :stream |\n\t\tself \n\t\t\tficusDeepDo: [ :value :path | stream nextPut:",
"suffix": " ])\n\t\treversed",
"completion": " path -> value ]\n\t\t\tbasePath: FiPath root"
} |
293 | https://github.com/tinchodias/Ficus | b343122c66851f2989fab4f3eabd4305d902734b | Ficus2-Updates/FiObject.extension.st | flattened
^ (Array streamContents: [ :stream |
self
ficusDeepDo: [ :value :path | stream nextPut: path -> value ]
basePath: FiPath root ])
reversed | [] | {
"fim_idx": 2,
"mask_type": "keyword_message",
"n_masked_tokens": 3,
"prefix": "flattened\n\t\n\t^ (Array streamContents: [ :stream |\n\t\tself \n\t\t\tficusDeepDo: [ :value :path | stream nextPut:",
"suffix": " ]\n\t\t\tbasePath: FiPath root ])\n\t\treversed",
"completion": " path -> value"
} |
294 | https://github.com/tinchodias/Ficus | 36f04cf2ffb4dfca2f533faa41879d8d072140a7 | Ficus2-Editor/FiEditorTest.class.st | testFixedObject
| source result |
source := FiRecipe title: 'Spaghetti' kind: 'Pasta'.
result :=
source editor
kind: 'Italian food';
result.
self assert: source kind equals: 'Pasta'.
self assert: result kind equals: 'Italian food'. | [] | {
"fim_idx": 1,
"mask_type": "assignment",
"n_masked_tokens": 5,
"prefix": "testFixedObject\n\n\t| source result |\n\tsource := FiRecipe title: 'Spaghetti' kind: 'Pasta'.\n\t\t\t\n\tresult := \n\t\tsource",
"suffix": ".\n\t\t\n\tself assert: source kind equals: 'Pasta'.\n\tself assert: result kind equals: 'It... |
295 | https://github.com/tinchodias/Ficus | 36f04cf2ffb4dfca2f533faa41879d8d072140a7 | Ficus2-Editor/FiEditorTest.class.st | testFixedObject
| source result |
source := FiRecipe title: 'Spaghetti' kind: 'Pasta'.
result :=
source editor
kind: 'Italian food';
result.
self assert: source kind equals: 'Pasta'.
self assert: result kind equals: 'Italian food'. | [] | {
"fim_idx": 2,
"mask_type": "keyword_message",
"n_masked_tokens": 4,
"prefix": "testFixedObject\n\n\t| source result |\n\tsource := FiRecipe title: 'Spaghetti' kind: 'Pasta'.\n\t\t\t\n\tresult := \n\t\tsource editor\n\t\t\tkind: 'Italian food';\n\t\t\tresult.\n\t\t\n\tself assert:",
"suffix": ".\n\tself asse... |
296 | https://github.com/tinchodias/Ficus | 36f04cf2ffb4dfca2f533faa41879d8d072140a7 | Ficus2-Editor/FiEditorTest.class.st | testFixedObject
| source result |
source := FiRecipe title: 'Spaghetti' kind: 'Pasta'.
result :=
source editor
kind: 'Italian food';
result.
self assert: source kind equals: 'Pasta'.
self assert: result kind equals: 'Italian food'. | [] | {
"fim_idx": 0,
"mask_type": "assignment",
"n_masked_tokens": 3,
"prefix": "testFixedObject\n\n\t| source result |\n\tsource := FiRecipe title:",
"suffix": ".\n\t\t\t\n\tresult := \n\t\tsource editor\n\t\t\tkind: 'Italian food';\n\t\t\tresult.\n\t\t\n\tself assert: source kind equals: 'Pasta'.\n\tself assert:... |
297 | https://github.com/tinchodias/Ficus | 36f04cf2ffb4dfca2f533faa41879d8d072140a7 | Ficus2-Editor/FiFixedObject.extension.st | editor
^ FiFixedObjectEditor for: self | [] | {
"fim_idx": 0,
"mask_type": "return",
"n_masked_tokens": 3,
"prefix": "editor\n\t\n\t^",
"suffix": "",
"completion": " FiFixedObjectEditor for: self"
} |
298 | https://github.com/tinchodias/Ficus | 36f04cf2ffb4dfca2f533faa41879d8d072140a7 | Ficus2-Editor/FiFixedObjectEditor.class.st | for: aShot
^ self basicNew
initializeForBase: aShot;
yourself | [] | {
"fim_idx": 0,
"mask_type": "return",
"n_masked_tokens": 6,
"prefix": "for: aShot\n\n\t^",
"suffix": "",
"completion": " self basicNew\n\t\tinitializeForBase: aShot;\n\t\tyourself"
} |
299 | https://github.com/tinchodias/Ficus | 36f04cf2ffb4dfca2f533faa41879d8d072140a7 | Ficus2-Editor/FiFixedObjectEditor.class.st | doesNotUnderstand: aMessage
aMessage arguments size = 1
ifFalse: [ ^ super doesNotUnderstand: aMessage ].
result := result resultOf:
(result
editAt: aMessage selector allButLast
equal: aMessage arguments first). | [] | {
"fim_idx": 0,
"mask_type": "keyword_message",
"n_masked_tokens": 8,
"prefix": "doesNotUnderstand: aMessage\n\n\taMessage arguments size =",
"suffix": ".\n\n\tresult := result resultOf: \n\t\t(result\n\t\t\teditAt: aMessage selector allButLast\n\t\t\tequal: aMessage arguments first).",
"completion": " 1 \n... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.