Skip to content

Instantly share code, notes, and snippets.

@remyroy
Created December 5, 2016 18:55
Show Gist options
  • Save remyroy/3420c40dc561563e97693a284503f284 to your computer and use it in GitHub Desktop.
Save remyroy/3420c40dc561563e97693a284503f284 to your computer and use it in GitHub Desktop.
Cataclysm DDA: Survey Compilation Script
import csv
from ascii_graph import Pyasciigraph
from collections import OrderedDict
def lchoices(choices):
return map(lambda x: (x, 0), choices)
def main():
questions = OrderedDict()
questions['Which version(s) are you playing on?'] = {
'choices': OrderedDict(lchoices([
'Experimental',
'Experimental + unofficial patches',
'0.C "Cooper" - Stable',
'0.B "Brin" - Stable',
'0.A "Kaufman" - Stable',
'0.9 "Ma" - Stable'
])),
'other': 0
}
questions['If you are using the experimental version, are you playing with z-levels?'] = {
'choices': OrderedDict(lchoices([
'I play with z-levels',
'I play without z-levels'
])),
'other': 0
}
questions['Graphical or console?'] = {
'choices': OrderedDict(lchoices([
'Graphical (SDL - Tiles)',
'Graphical with tileset disabled',
'Console (ncurses)'
])),
'other': 0
}
questions['If you are using the graphical version, which tileset(s) are you using?'] = {
'choices': OrderedDict(lchoices([
'ChestHole',
'ChestHole16',
'ChestHole32',
'ChestHole_iso',
'ChestHoleTileset_iso',
'HitButton iso',
'MShock24',
'MShock24Modded',
'MShock32',
'MShock32Modded',
'MShock32Xottoplus',
'RetroASCII',
'RetroDays10px',
'RetroDays20px',
"Blockhead's",
"Deon's",
"Hoder's",
"Thuztor'@",
"Tsu's",
'BrownLikeBears'
])),
'other': 0,
'remap': {
'MSocck32Modded': 'MShock32Modded'
}
}
questions['If you are playing the graphical version, are you playing with sound?'] = {
'choices': OrderedDict(lchoices([
'With sound',
'Without sound'
])),
'other': 0
}
questions['If you are playing with sound, which soundpack(s) are you using?'] = {
'choices': OrderedDict(lchoices([
'Basic (The default one with a single sound effect in the main menu)',
'ChestHole',
'ChestHoleCC',
'ChestOldTimey',
'RRFSounds'
])),
'other': 0
}
questions['Are you using the official binaries or are you compiling the game yourself?'] = {
'choices': OrderedDict(lchoices([
'I manually download the game from the official website and I use the official binaries',
'I use the CDDA Game Launcher to download the official game binaries for me',
'I compile the game myself',
'I am using binaries compiled by a third party'
])),
'other': 0
}
questions['How often do you update your game?'] = {
'choices': OrderedDict(lchoices([
'I always use the same version',
'I only updated my game a few times so far',
'I only update my game when I start a new character or a new world',
'Every few months',
'Every few weeks',
'Every few days',
'As soon as there is a new version'
])),
'other': 0
}
questions['If you are playing the game with mods, which ones are you using?'] = {
'choices': OrderedDict(lchoices([
'Craftable Gun Pack',
"DeadLeaves' Fictional Guns",
'Generic Guns',
"Icecoon's Arsenal/Icecoon's Weapons Pack",
'Crazy Cataclysm',
'Medieval and Historic Content',
'Filthy Clothing',
'More Survival Tools',
'More Craftables',
'More Classes and Scenarios',
'More Locations',
'Extended Realistic Guns',
'Simplified Nutrition',
'Mythological Replicas',
'DinoMod',
'Animatronic Monsters',
'Tall Buildings',
'Boats',
'Folding Parts pack',
'Tanks and Other Vehicles',
'Vehicle Additions Pack',
'Arcana and Magic Items',
'Necromancy',
'PKs Reimagining',
'Disable mutagens',
'Disable religious texts',
'Disable NPC Needs',
'No Antique Firearms',
'No Energy Weapons',
'No Fictional Guns',
'No Sci-Fi Equipment',
'No Flaming Weapons',
'No Medieval Items',
'No Powered Armor',
'No Survivor Armor',
'Mundane Zombies',
'No Acid Zombies',
'No Explosive Zombies',
'No Fungal Monsters',
'No Zombie Animals',
'No Joke Monsters',
'No Monsters',
'No Triffids',
'Classic Roguelike Classes',
'Fast Zombies',
'Prevent Zombie Revivication',
'Slow Zombies',
'StatsThroughSkills (I, II, III or IV)',
'Perfect Reliability',
'Tough Zombies',
'Zombie Nightvision',
"Artyoms' Gun Emporium",
'C:DDA Extra Professions',
'Cataclysm++',
'Extended Buildings',
'Jury-Rigged Robots',
'Mining Mod',
'Mutation stuff',
'Nimian Manufacture Guns',
'No Recreationals',
'Overmap Rebalancing',
'Packaging',
'Parks and Rec Building Pack',
'Removes Nether Creatures',
'Experimental Z-Level Buildings (0.C)',
'No Rivtech Guns (0.C)'
])),
'other': 0
}
questions['Which operating system(s) are you using to play the game?'] = {
'choices': OrderedDict(lchoices([
'Windows 10',
'Windows 8',
'Windows 7',
'Windows Vista',
'Windows XP',
'macOS 10.12 - Sierra',
'Mac OS X 10.11 - El Capitan',
'Mac OS X 10.10 - Yosemite',
'Mac OS X 10.9 - Mavericks',
'Mac OS X 10.8 - Mountain Lion',
'Mac OS X 10.7 - Lion',
'Mac OS X 10.6 - Snow Leopard',
'Mac OS X 10.5 - Leopard',
'Mac OS X 10.4 - Tiger',
'Android',
'iOS (iPhone, iPad, iPod touch)',
'Raspbian (Raspberry Pi)',
'Wine on a non-Windows OS',
'Ubuntu',
'Debian',
'Fedora',
'Linux Mint',
'Arch Linux',
'Gentoo',
'CentOS',
'PCLinuxOS',
'Slackware Linux',
'openSUSE',
'FreeBSD',
'OpenBSD'
'NetBSD',
'SteamOS'
])),
'other': 0
}
questions['What terminal size(s) are you using?'] = {
'choices': OrderedDict(lchoices([
'Default values: 80x24',
'Around 80x30 or VGA (640x480)',
'Around 100x38 or SVGA (800x600)',
'Around 128x48 or XGA (1024x768)',
'Around 160x45 or HD (1280x720)',
'Around 160x64 or SXGA (1280x1024)',
'Around 200x75 or UXGA (1600x1200)',
'Around 240x68 or FHD (1920x1080)',
'Around 240x75 or WUXGA (1920x1200)',
'Bigger than 240x75 or WUXGA (1920x1200)',
'Fullscreen',
'Fullscreen Windowed Borderless',
])),
'other': 0
}
questions['Which of these world generation options do you use?'] = {
'choices': OrderedDict(lchoices([
'Static spawn (Initial monsters)',
'Wander spawns (Zombie hordes)',
'Classic zombies',
'Surrounded start',
'Static npcs',
'Random npcs'
])),
'other': 0
}
questions['Regarding the other world generation options, are you adjusting them to make the game harder or easier?'] = {
'choices': OrderedDict(lchoices([
'I adjust the world generation options to make the game harder',
'I adjust the world generation options to make the game easier',
'I adjust the world generation options without making the game harder or easier',
'I use the default world generation options'
])),
'other': 0
}
questions['Do you use skill rust?'] = {
'choices': OrderedDict(lchoices([
'It is Off (Off - Default value for the latest experimental)',
'It is Intelligence dependent (Int - Old default value for 0.C and previous experimental versions)',
'It is Capped at skill levels (Capped)',
'It is Intelligence dependent, Capped (IntCap)',
'It is Vanilla, Capped (Vanilla)'
])),
'other': 0
}
with open('/home/remyroy/Desktop/results.csv', 'r') as csvfile:
reader = csv.DictReader(csvfile)
for row in reader:
for key in row.keys():
if not key in questions:
continue
question = questions[key]
answer_value = row[key]
if answer_value == '':
continue
answers = answer_value.split(';')
choices = question['choices']
if 'remap' in question:
remap = question['remap']
else:
remap = None
for answer in answers:
if remap is not None and answer in remap:
answer = remap[answer]
if answer not in choices:
question['other'] += 1
else:
choices[answer] += 1
graph = Pyasciigraph()
for question in questions:
question_data = questions[question]
data = question_data['choices'].items()
if question_data['other'] > 0:
data += [('Other', question_data['other'])]
for line in graph.graph(question, data):
print(line)
print('')
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment