Task Solutions-Native Graphical Application :EEE3009

Task Solutions-Native Graphical Application :EEE3009

Cover Page
The fox and Rabbit game is a simple single player game played in a 2d world.
The game has been designed and implemented in C …

Preview text

Cover Page
The fox and Rabbit game is a simple single player game played in a 2d world.
The game has been designed and implemented in C programming language. In
this very game, the fox has to catch the rabbit for the game to be concluded. The
player controls the Fox and the rabbit is machine controlled. In this very nature,
the rabbit therefore moves around the world as it escapes the fox.
The game does not have levels or difficult in the game as it is just a simple game
which has been developed in order to demonstrate the chasing mechanism of the
two objects.
To develop a fox and rabbit chasing game in C programming language.
The game is a native graphical application, presenting the user with visual
options to do various actions, such as: choosing between the world builder and
the game, configuring AI player ’sdifficulty levels, editing or loading game files,
control the user operated rabbit, etc…All Options must support both rabbit (not
the one that eats cheese) and key board input, interchangeably. In other words,
anything you can do with a keyboard, you can do with a rabbit and vice versa.
The keyboard input will be rigorously defined for each window since we plan to
use automated tests using key stroke simulations. You must follow the
instructions regarding key strokes precisely. For AI, the Mini-Max algorithm will
be used. It will be the same algorithm you have implemented in ex3, extended
with alpha-beta pruning. This time, you will have to make up your own utility
evaluation function.
The game fox and rabbit is simple, designed on a single 2D rectangular world of
size 400*600 which contains an empty space, and boundary wall around the
space. In the very beginning of the design, the fox and rabbit are paced at
different locations on the 2D world. The rabbit moves around the world in a
random motion as it escapes the fox, the fox which is being controlled by the
player searches through the word using keyboard commands.
The playercharacter has to make a move at its turn –you may assume that
there is always a possible move until the game ends. There is a bound on the
number of turns for each game, which is known to both players. The game ends
in one of 3 cases:
1.The Fox is adjacent (not diagonally) to the mouse –Fox wins.
2.The Rabbit is adjacent (not diagonally) to the cheese and not to the Fox –
Rabbit wins.
3.None of the above occurred and there are no more turns to play –draw
Deriving Petri Net
Systems of Transition
A quadruple system is a transitional system. TS = (S, E, T, sin), where S denotes
a nonempty set of states, E denotes a set of events, and T S E denotes a time
interval. Sin is an initial state, and S is a transition relation. The transitions of
TS are the components of T, and they will typically be expressed by sse rather
than (s, e, s).
The transitional system is finite if S and E are both finite. Only finite transitional
systems will be addressed in the sequel. A TS is said to be predictable if there can
only be same condition ssuch that ssa for every condition s& every a label. A
TS is labelled nondeterministic if it is not.
The transition relation’s transitive closure T stands for the reachability
connection with states and is represented by the symbol T*. In other words, if
there is a (potentially empty) series of transitions from state sto state s, state s
is attainable from
s& s’ states are noticeable if there is a reachable state of s” from s& s’.as per
the reachability definition, note s” may be the same as s’or s.
each transitional system the preceding axioms are expected to hold
A.2) There is an occurrence for every event:
A.3) Every state is accessible from the starting point:
In (no multiple arcs between sets of states), an extra axiom is assumed:
This axiom is needed in order to partly describe behavior-preserving morphisms
of TSs. A few of the “twin” occurrences that do not fulfill the above axioms
become nonobservable as a result of an incomplete mapping. This can cause
differences in behavior between the original as well as mapped TSs. We are only
concerned in transformations as well as equivocations of TSs wherein events are
completely mapped in our programming interface. As a result, we can safely
disregard the previous premise.
An arc-labeled directed graph can be used to depict a TS. Figure 2a shows a
simple illustration of a TS without cycles.
Petri Nets
A quadruple is a petri nets, where
A PN with the same behavior as the TS in Fig. 2a is shown in Fig. 2b. •t & t•are
the intake as well as outlet sites of transition t, respectively. •p & p•are the inlet
and outlet transitional collections for point p. Its the set of Reachability is the
collection of all N markers that can be reached from the beginning point of m0.
A labelled PN is one that has the labelling functions l: T A, which assigns a sign
(named label) from the alphabet A to every net transitions. Every transition in
the network can be uniquely determined by its labels if no two transitions have
the same labeling (unique labelling). We can call the transition by its label in this
scenario. A PN’s Reachability Graph (RG) is a transitional system with the
Reachability Collection as the set of states, the net’s transitions as the events, as
well as a transitions as the transition.
The RG in Figure 2c, which is produced from the PN in Figure 2b, is closely
related to the TS, as can be shown (Fig. 2a). If just one token can emerge in a
given location, the net is said to be safe. Because they feature straightforward
verification procedures and semantics, safe nets are frequently employed in
various applications.
The place concept is crucial in the creation of PNs. Every area intuitively
correlates to a location in the synthesizing PN, resulting in a one-to-one
connection between area states as well as PN markings in which this location has
a token.
A area is a group of states where all transitions labeled with the same occurrence
e have the same “entry/exit” connection. This is the originator connection in the
Petri Net. The event could always be an entrance (Case 1), become an exit (Case
2), or never “pass” the state’s boundaries (Case 3). (Case 3). (If the predecessors
of neither Case 1 nor Case 2 match, every transitions marked with e is extrinsic
or intrinsic to the region.) As applicable, the transition for the occurrence will be
successors, predecessors, or unrelated to the relevant location.
Considering Figure 2’s TS. The grouping of states
Regions properties
A few significance properties of regions are stated in the following propositions.
PROPERTY 2.3. Every region is made up of disjoint minimum states.
In the basic TSs subclass, property 2.1 was stated. This is extended to all TSs.
The acceptance of Properties 2.2 has been made. Property 2.3 is an improved
version of the analogous condition from, proving that any place may be
considered a linear collection of minimum areas.
Elementary Systems Transition
A few of the results in this part have already been reported for basic nets. Their
applicability to Petri Nets is straightforward, as shown. The important past
findings on elemental nets for Petri Nets will be reformulated in the next part.
Elementary systems Transition Axioms
If, in additional to (A1)-(A3), a transitional system meets the
following two axioms about areas, it is called elementary (ETS).
2 separate states must correspond to two main areas, according to (A4). When
state sis accessible in all preregions of occurrence e, (A5) suggests that e must be
allowed in s. The TS represented in Fig. 2 is clearly appropriate since all
assumptions (A1)-(A5) are fulfilled. Axiom (A4) says that state s1 is unique from
all other states. Regions r1, r2, r4, & r5 encompass this state, and no other
state is encompassed by the same set of regions (for a list of all regions, see
Section 2.3).
Consider occurrence a to demonstrate axiom (A5). Condition s1 & s5 for two
Figure 3a depicts a cyclical elementary TS, while Figure 3b depicts a
nonelementary TS. For occurrences a and b, the forward closures property is
violated. Consider the following scenario. region is the only minimum preregion of
As stated in, a PN’s RG is indeed an elemental TS, and vice versa. If a TS is
elemental, a PN with a parameter graphs similarity to the TS can be built. The
process of synthesizing
The internet, on the surface, appears to have several places as considerable areas.
Every preregion (postregion) of an occurrence corresponds to a predecessors
(successor) transitional region. In the first marking, all areas that corresponds to
areas that cover the beginning state must be laabeled.
Because all areas are mapped into the corresponding spots, a PN created using
this approach is known as a saturated net. Each ETS has a saturation net of its
own, but it is remarkably uniform. As illustrated, only minimum regions require
investigation. The minimum saturated net, which is formed from all minimum
regions, is likewise unique. We’ll take it a step further and create a place-
irredundant PN first, then a place-minimal PN, all while maintaining
bisimilarity between the RG as well as the ETS.
A further flaw in the technique is that axioms (A4) and (A5) do not provide an
effective procedure for verifying elementary since they require generating all
areas of a TS as well as verifying elementary requirements for every individual
state. Our technique utilizes minimized elementary tests to generate minimum
regions quickly. Lastly, the given technique produces a PN with an RG that is
invariant to the TS. This result applies to excitation-closed TSs (ECTS), which
comprise not just ETSs but also all TSs with some bisimilar ETS.
In conclusion, C programming language has been used in the development of the
Fox and Rabbit chasing game in the 2D world. The game has employed various
techniques in its implementation which makes it outstanding and successful.
#define UP 70
#define DOWN 78
#define LEFT 73
#define RIGHT 75
int maximum_length;
int var_changeDirection;
int var_minLength;
char var_alphanumKeys;
void var_dir_record();
void gameACM();
int gameLimit;
void Delay(long double);
void Move();
void CharHealth();
int gameScores();
void gameOutput();
void funcAxis(int ACM_X_axis, int varB_Y_axis);
void funcAxisXY(int ACM_X_axis,int varB_Y_axis);
void funcChange();
void funcMove_limits();
void funcArrowDown();
void funcArrowLeft();
void funcArrowUp();
void funcArrowRight();
void funcGameOver();
int funcResults();
struct struMainAxis
int ACM_X_axis;
int varB_Y_axis;
int isMovement;
typedef struct struMainAxis struMainAxis;
struMainAxis head, bend[500],var_eat,body[30];
int main()
char var_alphanumKeys;
CharHealth(); //to generate var_eat coordinates initially
gameLimit=3; //number of extra lives
Move(); //initialing initial bend struMainAxis
return 0;
void Move()
int a,var_int;
for(var_int=0; var_int

Order Now