1
0
Fork 0
mirror of https://gitlab.rlp.net/mobitar/julia_course.git synced 2024-11-16 13:28:10 +00:00

Add input workaround

This commit is contained in:
Mo8it 2022-03-29 01:31:02 +02:00
parent 3a15f98a4e
commit 01c2bdf9c1

View file

@ -222,7 +222,7 @@ md"""
Now that you know about matrices in Julia, use a matrix to present a Tick-tack-toe board.
To place `X` or `O`, take the user input for the column and row using the function `readline`. Unfortunately, this does not work in Pluto, so you would have to write a script in a `.jl` file and then run it using `julia FILENAME.jl` in the command line where you replace `FILENAME` with the filename you did choose.
To place `X` or `O`, take the user input for the row and column using the the form below. The input is stored in the variables `input_row` and `input_column`. Click on "Submit Query" to submit the input.
Make sure you update the board after the user input.
@ -235,6 +235,27 @@ You want more?
*BTW: You can use Julia for AI, so the programming language is not the limitation here* 😅
"""
# ╔═╡ f112da8a-5157-4748-aeee-63b688a6c79f
@bind input_values confirm(
PlutoUI.combine() do Child
md"""
Row: $(Child(TextField(; default="1")))
Column: $(Child(TextField(; default="1")))
"""
end
)
# ╔═╡ cff6a5a8-10b7-4082-a39f-608cb330d408
input_row = parse(Int64, input_values[1])
# ╔═╡ 8279b799-e426-4032-9460-af803e4aa091
input_column = parse(Int64, input_values[2])
# ╔═╡ 901205ab-7d76-4abb-8665-dfa86b0f6458
# Your code starts here
# ╔═╡ 00000000-0000-0000-0000-000000000001
PLUTO_PROJECT_TOML_CONTENTS = """
[deps]
@ -470,6 +491,10 @@ uuid = "3f19e933-33d8-53b3-aaab-bd5110c3b7a0"
# ╠═53b585dd-aa13-44c1-a3de-988e027ab0c4
# ╟─b08055c9-b6de-4495-9788-ff79928a85ef
# ╟─b6fe803e-1300-4d00-97fa-de6646743f94
# ╟─f112da8a-5157-4748-aeee-63b688a6c79f
# ╠═cff6a5a8-10b7-4082-a39f-608cb330d408
# ╠═8279b799-e426-4032-9460-af803e4aa091
# ╠═901205ab-7d76-4abb-8665-dfa86b0f6458
# ╟─a9cadc7e-10ce-4242-82af-2849b5f258f8
# ╟─00000000-0000-0000-0000-000000000001
# ╟─00000000-0000-0000-0000-000000000002