-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0da3c46
commit cda6e7b
Showing
26 changed files
with
222 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
extends Node2D | ||
|
||
# Ordem correta das User Stories | ||
var correct_order = [5, 4, 2, 6, 1, 3] | ||
# 1 2 3 4 5 6 | ||
# 5, 4, 2, 6, 3, 1 | ||
|
||
# Ordem clicada pelo jogador | ||
var user_order = [] | ||
var show_order = [] | ||
|
||
func _reset_game(): | ||
# Limpa a ordem do jogador para nova tentativa | ||
user_order.clear() | ||
show_order.clear() | ||
|
||
|
||
func _on_us_1_pressed() -> void: | ||
user_order.push_back(5) | ||
show_order.push_back(1) | ||
$Label.text = "Ordem escolhida: " + str(show_order) | ||
$VBoxContainer/US1.disabled = true | ||
|
||
|
||
func _on_us_2_pressed() -> void: | ||
user_order.push_back(3) | ||
show_order.push_back(2) | ||
$Label.text = "Ordem escolhida: " + str(show_order) | ||
$VBoxContainer/US2.disabled = true | ||
|
||
func _on_us_3_pressed() -> void: | ||
user_order.push_back(6) | ||
show_order.push_back(3) | ||
$Label.text = "Ordem escolhida: " + str(show_order) | ||
$VBoxContainer/US3.disabled = true | ||
|
||
|
||
func _on_us_4_pressed() -> void: | ||
user_order.push_back(2) | ||
show_order.push_back(4) | ||
$Label.text = "Ordem escolhida: " + str(show_order) | ||
$VBoxContainer/US4.disabled = true | ||
|
||
func _on_us_5_pressed() -> void: | ||
user_order.push_back(1) | ||
show_order.push_back(5) | ||
$Label.text = "Ordem escolhida: " + str(show_order) | ||
$VBoxContainer/US5.disabled = true # Replace with function body. | ||
|
||
func _on_us_6_pressed() -> void: | ||
user_order.push_back(4) | ||
show_order.push_back(6) | ||
$Label.text = "Ordem escolhida: " + str(show_order) | ||
$VBoxContainer/US6.disabled = true | ||
|
||
func _avancar() -> void: | ||
print(calcula_inversoes()) | ||
get_tree().change_scene_to_file('res://addons/gut/gui/BottomPanelShortcuts.tscn') | ||
|
||
|
||
var inversions = 0 | ||
|
||
# Função merge para unir dois subarrays | ||
func merge(arr, left, mid, right): | ||
var n1 = mid - left + 1 | ||
var n2 = right - mid | ||
|
||
# Vetores temporários L e R | ||
var L = [] | ||
var R = [] | ||
|
||
# Preenche os vetores temporários | ||
for i in range(n1): | ||
L.append(arr[left + i]) | ||
for j in range(n2): | ||
R.append(arr[mid + 1 + j]) | ||
|
||
var i = 0 | ||
var j = 0 | ||
var k = left | ||
var inv1 = n1 | ||
|
||
# Mescla os vetores temporários de volta no array original | ||
while i < n1 and j < n2: | ||
if L[i] <= R[j]: | ||
arr[k] = L[i] | ||
inv1 -= 1 | ||
i += 1 | ||
else: | ||
inversions += inv1 | ||
arr[k] = R[j] | ||
j += 1 | ||
k += 1 | ||
|
||
# Copia os elementos restantes de L[] | ||
while i < n1: | ||
arr[k] = L[i] | ||
i += 1 | ||
k += 1 | ||
|
||
# Copia os elementos restantes de R[] | ||
while j < n2: | ||
arr[k] = R[j] | ||
j += 1 | ||
k += 1 | ||
|
||
# Função mergeSort para dividir e ordenar o array | ||
func merge_sort(arr, left, right): | ||
if left >= right: | ||
return | ||
var mid = left + (right - left) / 2 | ||
merge_sort(arr, left, mid) | ||
merge_sort(arr, mid + 1, right) | ||
merge(arr, left, mid, right) | ||
|
||
# Função principal para rodar o algoritmo | ||
func calcula_inversoes(): | ||
var n = 6 | ||
|
||
print("Vetor original:") | ||
print(user_order) | ||
|
||
merge_sort(user_order, 0, n - 1) | ||
|
||
print("\nVetor ordenado:") | ||
print("\nInversões:") | ||
print(inversions) | ||
return inversions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
[gd_scene load_steps=2 format=3 uid="uid://c5stmgcyytu8u"] | ||
|
||
[ext_resource type="Script" path="res://backlog.gd" id="1_bp8u5"] | ||
|
||
[node name="Backlog" type="Node2D"] | ||
position = Vector2(-1, -3) | ||
script = ExtResource("1_bp8u5") | ||
|
||
[node name="Label" type="Label" parent="."] | ||
offset_left = 4.0 | ||
offset_top = 134.0 | ||
offset_right = 323.0 | ||
offset_bottom = 147.0 | ||
theme_override_font_sizes/font_size = 9 | ||
text = "Ordem escolhida: " | ||
|
||
[node name="VBoxContainer" type="VBoxContainer" parent="."] | ||
offset_left = 2.0 | ||
offset_top = 5.0 | ||
offset_right = 319.0 | ||
offset_bottom = 127.0 | ||
|
||
[node name="US1" type="Button" parent="VBoxContainer"] | ||
layout_mode = 2 | ||
theme_override_font_sizes/font_size = 5 | ||
text = "1 - Eu, como candidato, quero consultar meu status para saber se obtive êxito no teste de apitdão | ||
" | ||
|
||
[node name="US2" type="Button" parent="VBoxContainer"] | ||
layout_mode = 2 | ||
theme_override_font_sizes/font_size = 5 | ||
text = "2 - Eu, como administrador, quero consultar os candidatos por aptidão para organizar meu fluxo de trabalho | ||
" | ||
|
||
[node name="US3" type="Button" parent="VBoxContainer"] | ||
layout_mode = 2 | ||
theme_override_font_sizes/font_size = 5 | ||
text = "3 - Eu, como administrador quero alocar pessoas em planetas para combater as corporações eficientemente | ||
" | ||
|
||
[node name="US4" type="Button" parent="VBoxContainer"] | ||
layout_mode = 2 | ||
theme_override_font_sizes/font_size = 5 | ||
text = "4 - Eu, como candidato, quero fazer um teste de aptidão para definir meus atributos" | ||
|
||
[node name="US5" type="Button" parent="VBoxContainer"] | ||
layout_mode = 2 | ||
theme_override_font_sizes/font_size = 5 | ||
text = "5 - Eu, como candidato, quero me cadastrar no sistema da resistência para servir a galáxia" | ||
|
||
[node name="US6" type="Button" parent="VBoxContainer"] | ||
layout_mode = 2 | ||
theme_override_font_sizes/font_size = 5 | ||
text = "6 - Eu, como administrador, quero aprovar candidados com base em suas aptidões para filtrar os ingressantes" | ||
|
||
[node name="Avançar" type="Button" parent="."] | ||
offset_left = 264.0 | ||
offset_top = 151.0 | ||
offset_right = 316.0 | ||
offset_bottom = 175.0 | ||
theme_override_font_sizes/font_size = 11 | ||
text = "Avançar" | ||
|
||
[connection signal="pressed" from="VBoxContainer/US1" to="." method="_on_us_1_pressed"] | ||
[connection signal="pressed" from="VBoxContainer/US2" to="." method="_on_us_2_pressed"] | ||
[connection signal="pressed" from="VBoxContainer/US3" to="." method="_on_us_3_pressed"] | ||
[connection signal="pressed" from="VBoxContainer/US4" to="." method="_on_us_4_pressed"] | ||
[connection signal="pressed" from="VBoxContainer/US5" to="." method="_on_us_5_pressed"] | ||
[connection signal="pressed" from="VBoxContainer/US6" to="." method="_on_us_6_pressed"] | ||
[connection signal="pressed" from="Avançar" to="." method="_avancar"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,3 +16,4 @@ func _on_config_pressed(): | |
|
||
func _on_sair_pressed(): | ||
get_tree().quit() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters