BCS1110 1.0-RELEASE (GENERIC) bcs1110.ashish.nl/labs/lab-03/ [ Light ]
guest@bcs1110:~$ cat lab-03.md
# Lab 03 — Hide

Objective

Analyze the hidden door logic in JavaCraft and represent it as a Finite State Automaton (FSA).

Introduction

In this lab, you will examine the hidden door logic within the JavaCraft codebase and translate it into a Finite State Automaton (FSA). You may use either a Deterministic Finite Automaton (DFA) or a Nondeterministic Finite Automaton (NFA).

By the end of this session, you should have a partially complete FSA design to show to your TA.

Learning Objectives

  • Understand the hidden door logic in JavaCraft.
  • Translate this logic into a DFA or NFA with states, transitions, and accept conditions.
  • Build a transition table for your automaton.
  • Validate your automaton against sample inputs.

Preparation

  1. Review Theory of Computation Lecture.
  2. Refresh your knowledge of DFA and NFA, and how they model computation.
  3. Open the JavaCraft source code and locate the hidden door logic implementation.

Lab Tasks

Task 1: Analyze the Hidden Door Logic

  1. Open the JavaCraft code and locate the functions related to the hidden door.
  2. Read through the implementation carefully to understand:
    • The conditions under which the door opens or stays closed.
    • The sequence of events or inputs that trigger state changes.
  3. (Optional) Sketch a simple flowchart to visualize the logic before converting it into an automaton.

Task 2: Translate to Finite State Automaton

  1. Decide whether a DFA or NFA is most appropriate for modeling the hidden door.
  2. Define the following elements:
    • States (including start and accepting states)
    • Transitions between states
    • Input alphabet (what inputs cause state changes)
  3. Create a transition table showing state changes for each input.
  4. Draw a diagram of the automaton with states and transitions clearly labeled.
  5. Test your automaton by running sample input strings and comparing:
    • Game output vs. Automaton acceptance/rejection.
    • Revise your design if results don’t match.

Lab Submission

  1. Show the TA your partially complete FSA (diagram + transition table).

Summary

By completing this lab you have:

  • Analyzed the hidden door logic in JavaCraft.
  • Translated it into a finite state automaton (DFA or NFA).
  • Created a transition table and diagram.

This brings you one step closer to completing the JavaCraft: Pi Edition project successfully.