s School of Computing, Engineering and Mathematics Assessment Brief Form Module Title: Intelligent Systems Module Code: CI213 Author(s)/Marker(s) of Assignment John Kingston Assignment No: 2...

This is basically a game that I have to do for my university assignment


s School of Computing, Engineering and Mathematics Assessment Brief Form Module Title: Intelligent Systems Module Code: CI213 Author(s)/Marker(s) of Assignment John Kingston Assignment No: 2 Assignment Title: AI for Business/Games Percentage contribution to module mark: 50 Weighting of component assessments within this assignment: 75/15/10 Module Learning Outcome/s Covered: (Refer to module syllabus) LO1-LO3 (depending on option chosen) Assignment Brief and Assessment Criteria: See below Assessment Criteria See below Date of issue: 8 March 2018 Deadline for submission: 14 May 2018 Method of submission: e-submission (except for demonstration component – see below) Date feedback will be provided 11 June 2018 1. A copy of your coursework submission may be made as part of the University of Brighton’s and School of Computing, Engineering & Mathematics procedures which aim to monitor and improve quality of teaching. You should refer to your student handbook for details. All work submitted must be your own (or your team’s for an assignment which has been specified as a group submission) and all sources which do not fall into that category must be correctly attributed. The markers may submit the whole set of submissions to the JISC Plagiarism Detection Service CI213: Assessment 2 2017-18 Option 1: AI for Games You have been asked to program a game that represents an Adventurer travelling through unknown territory. You may either extend the CLIPS starter program that is provided or you may write the program in any language you choose. The adventurer has the following attributes (on a 1-5 scale): Speed 3, Weapon 2, Intelligence 4. The adventure also has three special gadgets, each of which can be used only once: Jetpack (add 2 to Speed); Flashgun (add 2 to Weapon); Textbook (add 2 to Intelligence). On each turn, the Adventurer encounters a creature. The creature’s attributes on the above 3 scales will be randomly determined. In addition, the creature may be Scared (and will flee if you do nothing); Curious (will observe but not approach, as long as you do nothing); or Aggressive (will attack ferociously, whatever you do). These too will be determined randomly. The adventurer has four possible actions at each point: Fight, Flee, Hypnotise or Do Nothing. The chances of success in Fighting depend on the difference in the Weapons attribute: Difference of 2 or more: higher score wins Difference of 1: higher score wins 50% of the time Difference of 0: it’s a draw and the creature runs away The chances of successful Hypnotism are calculated similarly based on differences in Intelligence. For Fleeing, all that matters is who has the greater speed; if both Speeds are equal then the flight will be successful. In addition, the adventurer may use one special gadget before deciding which action to take. Once used, the special gadget disappears. Your task is to write a program to make your Adventurer survive for as long as possible. If you are working in CLIPS, then to deal with the 50% odds, call the function calculate-win (provided in the starter program) with the adventurer’s attribute score first and the creature’s second. It returns one value, the result. So you’ll need the following line in the right hand side of a couple of rules: (bind ?result (calculate-win ?adventurerscore ?creaturescore)) Marking Marks will be awarded for the program matching the specification of the game; for the degree of intelligence included; for defining, successfully running and reporting 3-5 test cases of creatures with pre-defined attributes; and for the program running successfully. You may need to create a separate program (mostly the same but with different initiating rules) to run your test cases. [75 marks] Demonstrate your program to your tutor. You may do this ‘live’ (in class at a time to be announced) or you may make a video. [10 marks] If you choose the video option, it should be a maximum of 3 minutes long, and the camera should be on the screen at all times with you providing an audio description of what the demo is doing. If you have access to programs such as Camtasia which create screen videos, you may use those. Send the video to your tutor by e-mail by the deadline. Write a report that documents the program. You should write 800-1000 words of text, plus any diagrams you think useful. Comment on why you chose the test cases that you used. [15 marks] (deffunction calculate-win (?ascore ?score) (bind ?advantage (- ?ascore ?cscore)) ;; difference in scores (if (>= ?advantage 2) then (bind ?result win)) (if (<= advantage="" -2)="" then="" (bind="" result="" loss))="" (if="" (eq="" advantage="" 0)="" then="" (bind="" result="" draw))="" (if="" (eq="" advantage="" 1)="" then="" (bind="" luck="" (mod="" (random)="" 2))="" (if="" (eq="" luck="" 1)="" then="" (bind="" result="" win)="" else="" (bind="" result="" draw)="" )="" )="" (if="" (eq="" advantage="" -1)="" then="" (bind="" luck="" (mod="" (random)="" 2))="" (if="" (eq="" luck="" 0)="" then="" (bind="" result="" loss)="" else="" (bind="" result="" draw)="" )="" )="" (return="" result)="" )="" (deftemplate="" creature="" (slot="" name)="" (slot="" weapon)="" (slot="" speed)="" (slot="" intelligence)="" (slot="" attitude)="" )="" (deffacts="" adventurer="" (creature="" (name="" adventurer)="" (weapon="" 2)="" (speed="" 3)="" (intelligence="" 4)="" )="" (specials="" jetpack="" blinding="" textbook)="" )="" (deffacts="" game-facts="" (turn-counter="" 0)="" )="" (defrule="" gen-creature="" (creature="" (name="" adventurer))="" (turn-counter="" n)="" ;;="" updating="" this="" will="" refresh="" this="" rule=""> (bind ?wep (mod (random) 5))) (bind ?speed (mod (random) 5))) (bind ?int (mod (random) 5))) (bind ?att (mod (random) 3))) (if (eq ?att 1) then (bind ?atttext scared)) (if (eq ?att 2) then (bind ?atttext curious)) (if (eq ?att 3) then (bind ?atttext aggressive)) (assert (creature (name (random)) (weapon ?wep) (speed ?speed) (intelligence ?int) (attitude ?atttext))) ;;; the next lines are all for user interface purposes (bind ?weptypeno (mod (random) 3))) (if (eq ?weptypeno 1) then (bind ?weptype teeth)) (if (eq ?weptypeno 2) then (bind ?weptype claws)) (if (eq ?weptypeno 3) then (bind ?weptype rocks)) (if (eq ?wep 1) then (bind ?weptext "very blunt")) (if (eq ?wep 2) then (bind ?weptext "blunt")) (if (eq ?wep 3) then (bind ?weptext "fairly sharp")) (if (eq ?wep 4) then (bind ?weptext "sharp")) (if (eq ?wep 5) then (bind ?weptext "razor sharp")) (if (eq ?speed 1) then (bind ?speedtext "very slow")) (if (eq ?speed 2) then (bind ?speedtext "slow")) (if (eq ?speed 3) then (bind ?speedtext "fairly fast")) (if (eq ?speed 4) then (bind ?speedtext "fast")) (if (eq ?speed 5) then (bind ?speedtext "lightning quick")) (if (eq ?int 1) then (bind ?inttext "very dumb")) (if (eq ?int 2) then (bind ?inttext "dumb")) (if (eq ?int 3) then (bind ?inttext "fairly smart")) (if (eq ?int 4) then (bind ?inttext "smart")) (if (eq ?int 5) then (bind ?inttext "really smart")) (printout t "A creature appears! It has " ?weptext " " ?weptype". It looks " ?speedtext " and " ?inttext ". It acts in a " ?atttext " manner." crlf) ) (defrule choose-action (creature (name ?name)) (test (neq ?name Adventurer)) ;; a creature exists which isn't the Adventurer => (printout t "Choose an action [type 1-5]:" crlf "[1] Fight" crlf "[2] Flee" crlf "[3] Hypnotise" crlf "[4] Use special gadget" crlf "[5] Do nothing" crlf ) (bind ?act (read)) (if (eq ?act 1) then (assert (action fight))) (if (eq ?act 2) then (assert (action flee))) (if (eq ?act 3) then (assert (action hypnotise))) (if (eq ?act 4) then (assert (action use_special))) (if (eq ?act 5) then (assert (action do_nothing))) ) Starter code (deftemplate creature (slot name) (slot weapon) (slot speed) (slot intelligence) (slot attitude) ) (deffacts adventurer (creature (name Adventurer) (weapon 2) (speed 3) (intelligence 4) ) (specials jetpack blinding textbook) ) (deffacts game-facts (turn-counter 0) ) (defrule gen-creature (declare (salience 100)) (creature (name Adventurer)) (turn-counter ?n) ;; updating this will refresh this rule => (bind ?wep (+ 1 (mod (random) 5))) (bind ?speed (+ 1 (mod (random) 5))) (bind ?int (+ 1 (mod (random) 5))) (bind ?att (+ 1 (mod (random) 3))) (if (eq ?att 1) then (bind ?atttext scared)) (if (eq ?att 2) then (bind ?atttext curious)) (if (eq ?att 3) then (bind ?atttext aggressive)) (assert (creature (name (random)) (weapon ?wep) (speed ?speed) (intelligence ?int) (attitude ?atttext))) ;;; the next lines are all for user interface purposes (bind ?weptypeno (+ 1 (mod (random) 3))) (if (eq ?weptypeno 1) then (bind ?weptype teeth)) (if (eq ?weptypeno 2) then (bind ?weptype claws)) (if (eq ?weptypeno 3) then (bind ?weptype rocks)) (if (eq ?wep 1) then (bind ?weptext "very blunt")) (if (eq ?wep 2) then (bind ?weptext "blunt")) (if (eq ?wep 3) then (bind ?weptext "fairly sharp")) (if (eq ?wep 4) then (bind ?weptext "sharp")) (if (eq ?wep 5) then (bind ?weptext "razor sharp")) (if (eq ?speed 1) then (bind ?speedtext "very slow")) (if (eq ?speed 2) then (bind ?speedtext "slow")) (if (eq ?speed 3) then (bind ?speedtext "fairly fast")) (if (eq ?speed 4) then (bind ?speedtext "fast")) (if (eq ?speed 5) then (bind ?speedtext "lightning quick")) (if (eq ?int 1) then (bind ?inttext "very dumb")) (if (eq ?int 2) then (bind ?inttext "dumb")) (if (eq ?int 3) then (bind ?inttext "fairly smart")) (if (eq ?int 4) then (bind ?inttext "smart")) (if (eq ?int 5) then (bind ?inttext "really smart")) (printout t "A creature appears! It has " ?weptext " " ?weptype". It looks " ?speedtext " and " ?inttext ". It acts in a " ?atttext " manner." crlf) ) ;(defrule choose-special ; (declare (salience 50)) ;; must fire before the choose-action rule but after the gen-creature rule ; (specials $?specials) ; (test (>= (length$ $?specials) 1)) ;; don't fire the rule if there are no specials left ;
May 09, 2020
SOLUTION.PDF

Get Answer To This Question

Submit New Assignment

Copy and Paste Your Assignment Here