This file contains hidden or 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
| assignment assignments[40] = ([40] nil) // Inicializa las tareas en nulo. | |
| error_report corrections[40] = ([40] nil) // Inicializa las correcciones en nulo. | |
| boolean has_left[40] = ([40] false) // Indica si el alumno se ha ido. | |
| boolean doing_assignment[40] = ([40] false) // Indica si el alumno i esta ocupado haciendo tarea. | |
| sem can_do_assignment[40] = ([40] 0) | |
| sem can_see_correction[40] = ([40] 0) | |
| sem can_check_assignment = 0 // Alumnos esperando corrección | |
This file contains hidden or 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
| sem task_chosen[0..49] = ([50] 0) | |
| sem able_to_work[0..49] = ([50] 0) | |
| sem notify_completion[0..9] = ([10] 1) // Mutex array for notifying each shared task was finished by a single student. | |
| sem grade_mutex = 1 | |
| sem some_task_was_finished = 0 | |
| task tasks[0..9] = ([10] generate_task()) | |
| int students_that_finished[0..9] = ([10] 0) // Amount of students that finished working on each task. | |
| int grade[0..9] // Puntaje. Es el orden en el que cada equipo 0..9 terminó de trabajar en su tarea. | |
| int finished_task // Sólo la declaro. No la inicializo porque su valor inicial no importa. |
This file contains hidden or 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
| sem arrived[0..E - 1] = ([E] 0) | |
| sem start_working[0..E - 1] = ([E] 0) | |
| sem finish_task_mutex = 1 | |
| int remaining_tasks = T | |
| int tasks_done[0..E - 1] = ([E] 0) | |
| task tasks[0..T - 1] = ([T] generate_task()) | |
| reward rewards[0..E - 1] = ([E] null) |
This file contains hidden or 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
| process Employee { | |
| while true { | |
| serve_customer(pop(queue)) | |
| } | |
| } | |
| process Customer[c = 0 to N - 1] { | |
| while timeout[c] < 10 { | |
| p(wait_a_minute) | |
| } |
This file contains hidden or 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
| RSpec.configure do |config| | |
| config.use_transactional_fixtures = false | |
| config.before(:suite) do | |
| DatabaseCleaner.strategy = :transaction | |
| DatabaseCleaner.clean_with(:truncation) | |
| end | |
| config.around(:each) do |example| | |
| DatabaseCleaner.cleaning do |
This file contains hidden or 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
| require "cuba" | |
| require "mote" | |
| require "mote/render" | |
| Cuba.plugin Mote::Render | |
| require_relative "controllers/pages" | |
| require_relative "controllers/tasks" | |
| require_relative "db/data_store" |
This file contains hidden or 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
| class Dragon | |
| def initialize | |
| # ... | |
| end | |
| def fly | |
| take_off | |
| 100.times do | |
| move_wings(:horizontally) |
This file contains hidden or 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
| class Dog | |
| def initialize(name) | |
| @name = name | |
| end | |
| def bark | |
| puts "woof!" | |
| end | |
| end |
This file contains hidden or 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
| public | |
| def greet(who) | |
| "Hi, #{who}!" | |
| end |
This file contains hidden or 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
| class MyClass | |
| @@my_class_variable = "Class variable content." | |
| def initialize | |
| @my_instance_variable = "Instance variable content." | |
| end | |
| # Class methods have a "self." before their name. For now we won't go into the details | |
| # on why it is that way. | |
| def self.thing_my_class_does |