Skip to content

Commit

Permalink
Minimum Playable Product
Browse files Browse the repository at this point in the history
This is a "vertical slice" of the game, demonstrating start-to-finish
gameplay. There is only one level, bubble sort.

[ADDED]
- Main menu with bogo sort, start, and credits buttons
- Level select page with preview display, description and instructions
- Scrolling credits screen with required license texts
- Playing and end screens with time-based scoring and visual feedback
  • Loading branch information
danielzting committed May 29, 2020
2 parents cd0b079 + 43e4f7d commit 6092637
Show file tree
Hide file tree
Showing 28 changed files with 842 additions and 3 deletions.
61 changes: 61 additions & 0 deletions CREDITS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
This project is made possible by open source projects; their required copyrights are listed below.

# [Godot](https://godotengine.org)
Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. Copyright (c) 2014-2020 Godot Engine contributors.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

# [FreeType](https://www.freetype.org)
Portions of this software are copyright © 2019 The FreeType
Project (www.freetype.org). All rights reserved.

# [Hack](https://sourcefoundry.org/hack)
The work in the Hack project is Copyright 2018 Source Foundry Authors and licensed under the MIT License

The work in the DejaVu project was committed to the public domain.

Bitstream Vera Sans Mono Copyright 2003 Bitstream Inc. and licensed under the Bitstream Vera License with Reserved Font Names "Bitstream" and "Vera"

### MIT License

Copyright (c) 2018 Source Foundry Authors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

### BITSTREAM VERA LICENSE

Copyright (c) 2003 by Bitstream, Inc. All Rights Reserved. Bitstream Vera is a trademark of Bitstream, Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy of the fonts accompanying this license ("Fonts") and associated documentation files (the "Font Software"), to reproduce and distribute the Font Software, including without limitation the rights to use, copy, merge, publish, distribute, and/or sell copies of the Font Software, and to permit persons to whom the Font Software is furnished to do so, subject to the following conditions:

The above copyright and trademark notices and this permission notice shall be included in all copies of one or more of the Font Software typefaces.

The Font Software may be modified, altered, or added to, and in particular the designs of glyphs or characters in the Fonts may be modified and additional glyphs or characters may be added to the Fonts, only if the fonts are renamed to names not containing either the words "Bitstream" or the word "Vera".

This License becomes null and void to the extent applicable to Fonts or Font Software that has been modified and is distributed under the "Bitstream Vera" names.

The Font Software may be sold as part of a larger software package but no copy of one or more of the Font Software typefaces may be sold by itself.

THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL BITSTREAM OR THE GNOME FOUNDATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE.

Except as contained in this notice, the names of Gnome, the Gnome Foundation, and Bitstream Inc., shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Font Software without prior written authorization from the Gnome Foundation or Bitstream Inc., respectively. For further information, contact: fonts at gnome dot org.
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,13 @@
# Human Computer Simulator
*Gamifying computer science education*
*Human Computer Simulator* is a game where you get to become your
favorite algorithm and or data structure.

# Screenshots
![Level Select](assets/levels.png)

# Download
This software is in an alpha stage of development and I do not plan on
releasing ready-to-run builds until a stable v1.0 release. However, it
is very easy to run it yourself. Just grab the free and open source
[Godot game engine](https://godotengine.org), import the `project.godot`
file, and hit the play button.
Binary file added assets/hack-regular.ttf
Binary file not shown.
Binary file added assets/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 34 additions & 0 deletions assets/icon.png.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
[remap]

importer="texture"
type="StreamTexture"
path="res://.import/icon.png-b6a7fb2db36edd3d95dc42f1dc8c1c5d.stex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://assets/icon.png"
dest_files=[ "res://.import/icon.png-b6a7fb2db36edd3d95dc42f1dc8c1c5d.stex" ]

[params]

compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0
6 changes: 6 additions & 0 deletions assets/levels.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"BUBBLE SORT":
{
"about": "Bubble sort iterates through the array and looks at each pair of elements, swapping them if they are out of order. When it has gone through the entire array without swapping a single pair, it has finished. Though simple to understand, bubble sort is hopelessly inefficient on all but the smallest of arrays."
}
}
Binary file added assets/levels.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 34 additions & 0 deletions assets/splash.png.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
[remap]

importer="texture"
type="StreamTexture"
path="res://.import/splash.png-8aa957744d9f4b764dd4680b37c88571.stex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://assets/splash.png"
dest_files=[ "res://.import/splash.png-8aa957744d9f4b764dd4680b37c88571.stex" ]

[params]

compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0
Binary file added assets/theme.theme
Binary file not shown.
14 changes: 14 additions & 0 deletions levels/bogo_sort.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
extends ComparisonSort
class_name BogoSort

func _init(array).(array):
pass

func check(action):
return true

func next():
array = ArrayModel.new(array.size)

func emphasized(i):
return false
27 changes: 27 additions & 0 deletions levels/bubble_sort.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
extends ComparisonSort
class_name BubbleSort

var swapped = false

func _init(array).(array):
pass

func check(action):
if array.get(index) > array.get(index + 1):
return action == "swap"
else:
return action == "no_swap"

func next():
if array.get(index) > array.get(index + 1):
array.swap(index, index + 1)
swapped = true
index += 1
if index == array.size - 1:
if not swapped:
emit_signal("done")
index = 0
swapped = false

func emphasized(i):
return i == index or i == index + 1
43 changes: 43 additions & 0 deletions levels/comparison_sort.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
extends Node
class_name ComparisonSort

signal done
signal mistake

const ACTIONS = ["swap", "no_swap"]

var array: ArrayModel
var index = 0
var timer = Timer.new()
var active = true

func _init(array):
self.array = array
timer.one_shot = true
timer.connect("timeout", self, "_on_Timer_timeout")
add_child(timer)
self.connect("mistake", self, "_on_ComparisonSort_mistake")

func check(action):
pass

func next():
pass

func _on_ComparisonSort_mistake():
active = false
timer.start(1)

func _on_Timer_timeout():
active = true

func _input(event):
if not active:
return

for action in ACTIONS:
if event.is_action_pressed(action):
if check(action):
next()
else:
emit_signal("mistake")
29 changes: 29 additions & 0 deletions models/array_model.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
"""
A plain old one-dimensional random access array.
"""

extends Reference
class_name ArrayModel

var array = []
var size

func _init(size):
for i in range(1, size + 1):
array.append(i)
array.shuffle()
self.size = size

func get(i):
return array[i]

func is_sorted():
for i in range(size - 1):
if array[i] > array[i + 1]:
return false
return true

func swap(i, j):
var temp = array[i]
array[i] = array[j]
array[j] = temp
103 changes: 101 additions & 2 deletions project.godot
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,116 @@

config_version=4

_global_script_classes=[ ]
_global_script_classes=[ {
"base": "Reference",
"class": "ArrayModel",
"language": "GDScript",
"path": "res://models/array_model.gd"
}, {
"base": "HBoxContainer",
"class": "ArrayView",
"language": "GDScript",
"path": "res://views/array_view.gd"
}, {
"base": "ComparisonSort",
"class": "BogoSort",
"language": "GDScript",
"path": "res://levels/bogo_sort.gd"
}, {
"base": "ComparisonSort",
"class": "BubbleSort",
"language": "GDScript",
"path": "res://levels/bubble_sort.gd"
}, {
"base": "Node",
"class": "ComparisonSort",
"language": "GDScript",
"path": "res://levels/comparison_sort.gd"
} ]
_global_script_class_icons={

"ArrayModel": "",
"ArrayView": "",
"BogoSort": "",
"BubbleSort": "",
"ComparisonSort": ""
}

[application]

config/name="Human Computer Simulator"
run/main_scene="res://scenes/menu.tscn"
run/low_processor_mode=true
boot_splash/image="res://assets/splash.png"
config/icon="res://assets/icon.png"

[autoload]

scene="*res://scripts/scene.gd"

[display]

window/size/width=1920
window/size/height=1080
window/size/fullscreen=true
window/dpi/allow_hidpi=true
window/stretch/mode="2d"

[editor_plugins]

enabled=PoolStringArray( )

[gui]

theme/use_hidpi=true

[input]

ui_accept={
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777221,"unicode":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777222,"unicode":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":32,"unicode":0,"echo":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":0,"pressure":0.0,"pressed":false,"script":null)
]
}
ui_left={
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777231,"unicode":0,"echo":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":14,"pressure":0.0,"pressed":false,"script":null)
]
}
ui_right={
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777233,"unicode":0,"echo":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":15,"pressure":0.0,"pressed":false,"script":null)
]
}
ui_up={
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777232,"unicode":0,"echo":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":12,"pressure":0.0,"pressed":false,"script":null)
]
}
ui_down={
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777234,"unicode":0,"echo":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":13,"pressure":0.0,"pressed":false,"script":null)
]
}
swap={
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777233,"unicode":0,"echo":false,"script":null)
]
}
no_swap={
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777231,"unicode":0,"echo":false,"script":null)
]
}

[rendering]

quality/driver/driver_name="GLES2"
vram_compression/import_etc=true
vram_compression/import_etc2=false
environment/default_clear_color=Color( 0, 0, 0, 1 )
Loading

0 comments on commit 6092637

Please sign in to comment.