Icon representing a recipe

Recipe: intro-to-the-AlphaGo-A.i.-2.Lua

created by zo3xiaJonWeinberg

Profile


Name
intro-to-the-AlphaGo-A.i.-2.Lua
ID
103813
Shared with
Public
Parent
None
Children
Created on
August 20, 2020 at 15:18 PM UTC
Updated on
August 20, 2020 at 15:18 PM UTC
Description

The Game of Go minigame. Work in progress.

Best for


Code


local opt = dialog.CreateDialog("Player "..user.GetPlayerName() .." is black.") cell={} cell[1]="empty" cell[2]="empty" cell[3]="empty" cell[4]="empty" opt.labelMsg=dialog.AddLabel("Black places first. ") repeat print("In a real game, Player " .. user.GetPlayerName() .." can forfeit the game but not the match to save time") --Jon copied from Bruno Kestomont's JET 3.6 --opt.AddAlgorithm1 = dialog.AddCheckbox("160, 70, 2, 34.555, 2.2, 1.2, 0.3 (made up band)", true) --opt.AddAlgorithm2 = dialog.AddCheckbox("160, 70, 2, 34.555, 2.2, 1.2, 0.3 (made up band)", true) --opt.AddAlgorithm3 = dialog.AddCheckbox("black", true) --opt.AddAlgorithm4 = dialog.AddCheckbox("black", true) opt.AddAlgorithm4 = dialog.AddLabel(cell[1].." ---- "..cell[2]) opt.AddAlgorithm5 = dialog.AddLabel(" | ".." ".." | ") --because of sans serif opt.AddAlgorithm6 = dialog.AddLabel(cell[3].." ---- "..cell[4]) opt.oneOne = dialog.AddButton("Row 1 Col 1", 1) opt.oneTwo = dialog.AddButton("Row 1 Col 2", 2) --opt.linebreak=dialog.hr("--") opt.label1=dialog.AddLabel("Place stone at: ") --attempt at linebreak opt.twoOne = dialog.AddButton("Row 2 Col 1", 3) opt.twoTwo = dialog.AddButton("Row 2 Col 2", 4) opt.pass = dialog.AddButton("Pass", 5) opt.cancel = dialog.AddButton("Cancel", 0) res=dialog.Show(opt) whiteTurn=false if(0<res and res<5) then if cell[res]=="empty" then cell[res]="black" whiteTurn=true else opt.labelMsg=dialog.AddLabel("Can't place at cell "..res) end end if(res==5) then whiteTurn=true end if whiteTurn then for i=1, 4 do if(cell[i]=="empty") then cell[i]="white" break end end end until res==0

Comments