refactor
This commit is contained in:
parent
a36b57ed2e
commit
267a34fe90
|
@ -15,12 +15,12 @@ _global_script_class_icons={
|
|||
[application]
|
||||
|
||||
config/name="Word Hunt"
|
||||
run/main_scene="res://Main.tscn"
|
||||
run/main_scene="res://scenes/Main.tscn"
|
||||
config/icon="res://icon.png"
|
||||
|
||||
[autoload]
|
||||
|
||||
Game="*res://Game.gd"
|
||||
Game="*res://src/Game.gd"
|
||||
|
||||
[display]
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
[gd_scene load_steps=3 format=2]
|
||||
|
||||
[ext_resource path="res://KeyboardPanel.gd" type="Script" id=1]
|
||||
[ext_resource path="res://WordContainer.tscn" type="PackedScene" id=2]
|
||||
[ext_resource path="res://scenes/WordContainer.tscn" type="PackedScene" id=1]
|
||||
[ext_resource path="res://src/KeyboardPanel.gd" type="Script" id=2]
|
||||
|
||||
[node name="Control" type="Control"]
|
||||
anchor_right = 1.0
|
||||
|
@ -39,63 +39,63 @@ size_flags_horizontal = 3
|
|||
text = "Your Solution"
|
||||
align = 1
|
||||
|
||||
[node name="WordContainer" parent="VBoxContainer/GuessesPanel" instance=ExtResource( 2 )]
|
||||
[node name="WordContainer" parent="VBoxContainer/GuessesPanel" instance=ExtResource( 1 )]
|
||||
margin_right = 208.0
|
||||
|
||||
[node name="WordContainer2" parent="VBoxContainer/GuessesPanel" instance=ExtResource( 2 )]
|
||||
[node name="WordContainer2" parent="VBoxContainer/GuessesPanel" instance=ExtResource( 1 )]
|
||||
margin_left = 212.0
|
||||
margin_right = 420.0
|
||||
|
||||
[node name="WordContainer3" parent="VBoxContainer/GuessesPanel" instance=ExtResource( 2 )]
|
||||
[node name="WordContainer3" parent="VBoxContainer/GuessesPanel" instance=ExtResource( 1 )]
|
||||
margin_top = 54.0
|
||||
margin_right = 208.0
|
||||
margin_bottom = 86.0
|
||||
|
||||
[node name="WordContainer4" parent="VBoxContainer/GuessesPanel" instance=ExtResource( 2 )]
|
||||
[node name="WordContainer4" parent="VBoxContainer/GuessesPanel" instance=ExtResource( 1 )]
|
||||
margin_left = 212.0
|
||||
margin_top = 54.0
|
||||
margin_right = 420.0
|
||||
margin_bottom = 86.0
|
||||
|
||||
[node name="WordContainer5" parent="VBoxContainer/GuessesPanel" instance=ExtResource( 2 )]
|
||||
[node name="WordContainer5" parent="VBoxContainer/GuessesPanel" instance=ExtResource( 1 )]
|
||||
margin_top = 90.0
|
||||
margin_right = 208.0
|
||||
margin_bottom = 122.0
|
||||
|
||||
[node name="WordContainer6" parent="VBoxContainer/GuessesPanel" instance=ExtResource( 2 )]
|
||||
[node name="WordContainer6" parent="VBoxContainer/GuessesPanel" instance=ExtResource( 1 )]
|
||||
margin_left = 212.0
|
||||
margin_top = 90.0
|
||||
margin_right = 420.0
|
||||
margin_bottom = 122.0
|
||||
|
||||
[node name="WordContainer7" parent="VBoxContainer/GuessesPanel" instance=ExtResource( 2 )]
|
||||
[node name="WordContainer7" parent="VBoxContainer/GuessesPanel" instance=ExtResource( 1 )]
|
||||
margin_top = 126.0
|
||||
margin_right = 208.0
|
||||
margin_bottom = 158.0
|
||||
|
||||
[node name="WordContainer8" parent="VBoxContainer/GuessesPanel" instance=ExtResource( 2 )]
|
||||
[node name="WordContainer8" parent="VBoxContainer/GuessesPanel" instance=ExtResource( 1 )]
|
||||
margin_left = 212.0
|
||||
margin_top = 126.0
|
||||
margin_right = 420.0
|
||||
margin_bottom = 158.0
|
||||
|
||||
[node name="WordContainer9" parent="VBoxContainer/GuessesPanel" instance=ExtResource( 2 )]
|
||||
[node name="WordContainer9" parent="VBoxContainer/GuessesPanel" instance=ExtResource( 1 )]
|
||||
margin_top = 162.0
|
||||
margin_right = 208.0
|
||||
margin_bottom = 194.0
|
||||
|
||||
[node name="WordContainer10" parent="VBoxContainer/GuessesPanel" instance=ExtResource( 2 )]
|
||||
[node name="WordContainer10" parent="VBoxContainer/GuessesPanel" instance=ExtResource( 1 )]
|
||||
margin_left = 212.0
|
||||
margin_top = 162.0
|
||||
margin_right = 420.0
|
||||
margin_bottom = 194.0
|
||||
|
||||
[node name="WordContainer11" parent="VBoxContainer/GuessesPanel" instance=ExtResource( 2 )]
|
||||
[node name="WordContainer11" parent="VBoxContainer/GuessesPanel" instance=ExtResource( 1 )]
|
||||
margin_top = 198.0
|
||||
margin_right = 208.0
|
||||
margin_bottom = 230.0
|
||||
|
||||
[node name="WordContainer12" parent="VBoxContainer/GuessesPanel" instance=ExtResource( 2 )]
|
||||
[node name="WordContainer12" parent="VBoxContainer/GuessesPanel" instance=ExtResource( 1 )]
|
||||
margin_left = 212.0
|
||||
margin_top = 198.0
|
||||
margin_right = 420.0
|
||||
|
@ -106,17 +106,17 @@ margin_top = 482.0
|
|||
margin_right = 420.0
|
||||
margin_bottom = 600.0
|
||||
size_flags_horizontal = 3
|
||||
script = ExtResource( 1 )
|
||||
script = ExtResource( 2 )
|
||||
|
||||
[node name="PlayGameDialog" type="ColorRect" parent="."]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
color = Color( 0, 0, 0, 0.705882 )
|
||||
color = Color( 0, 0, 0.129412, 0.27451 )
|
||||
|
||||
[node name="Label" type="Label" parent="PlayGameDialog"]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
margin_bottom = -300.0
|
||||
margin_bottom = -320.0
|
||||
text = "A bot is trying to hunt you down!
|
||||
When it guesses a word, choose a word to hide behind.
|
||||
You can change words each turn,
|
||||
|
@ -124,7 +124,7 @@ but you can't contradict your previous clues!
|
|||
|
||||
Try to last 6 turns!"
|
||||
align = 1
|
||||
valign = 1
|
||||
valign = 2
|
||||
|
||||
[node name="NewGameButton" type="Button" parent="PlayGameDialog"]
|
||||
anchor_top = 1.0
|
|
@ -1,7 +1,7 @@
|
|||
[gd_scene load_steps=3 format=2]
|
||||
|
||||
[ext_resource path="res://letter_empty.tres" type="Theme" id=1]
|
||||
[ext_resource path="res://WordContainer.gd" type="Script" id=2]
|
||||
[ext_resource path="res://src/WordContainer.gd" type="Script" id=2]
|
||||
|
||||
[node name="WordContainer" type="HBoxContainer"]
|
||||
margin_top = 18.0
|
|
@ -220,8 +220,8 @@ func _exhaustive_search_fast() -> String:
|
|||
for soli in len(ValidWords):
|
||||
var solw: Array = ValidWords[soli]
|
||||
var remainder := 0
|
||||
var reqmask: Array = required_charmask | (guessmask & solw[1])
|
||||
var banmask: Array = absent_charmask | (guessmask & ~solw[1])
|
||||
var reqmask: int = required_charmask | (guessmask & solw[1])
|
||||
var banmask: int = absent_charmask | (guessmask & ~solw[1])
|
||||
for w in ValidWords:
|
||||
if (w[1] & reqmask == reqmask) and (w[1] & banmask == 0):
|
||||
remainder += 1
|
||||
|
@ -387,7 +387,9 @@ func _estimated_answer_judgement(solution: String) -> String:
|
|||
return '??'
|
||||
|
||||
func _answer_judgement(solution: String) -> String:
|
||||
if len(ValidWords) < 2:
|
||||
if len(Words) >= MAX_TURNS*2-1 and solution != Words[-1]:
|
||||
return 'WIN'
|
||||
if solution != Words[-1] and len(ValidWords) <= 1:
|
||||
return '#'
|
||||
elif len(ValidWords) > 2400:
|
||||
return _estimated_answer_judgement(solution)
|
Loading…
Reference in New Issue