Skip to content

A mastermind game was implemented as a linux driver.

Notifications You must be signed in to change notification settings

cansuynk/linux-mastermind-driver

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 

Repository files navigation

To create the driver

make	

Remove module if exist

sudo rmmod mastermind

Major number, max guess number and secret number can be given as module parameters

sudo insmod mastermind.ko major_number=142 mmind_max_guesses=10 mmind_number=4283	

To see mastermind in the list of loaded modules

lsmod

Remove device node if exist

sudo rm /dev/mastermind

Create device node

sudo mknod -m 666 /dev/mastermind c 142 0

Write to device (example)

echo "1234" > /dev/mastermind

Read from device

cat /dev/mastermind

Compile test code

gcc -o game game.c

Execute test code

./game

When program is executed the process given below will be performed

Enter secret:                               --->type 4 digit secret number				           
Staring new game secret= < secret number >  --->Your secret number will be showing here
Commands:                                   --->Possible commands that user can select
(New Game) new < secret >                   --->To start new game, type "new" and your secret number 
(Exit Game) end 0                           --->To end game, type "end" and 0
(Guess) gus < guess >                       --->To do guess, type "gus" and your guess number

Releases

No releases published

Packages

No packages published