All Projects → giordano → StarWarsArrays.jl

giordano / StarWarsArrays.jl

Licence: other
Arrays indexed as the order of Star Wars movies

Programming Languages

julia
2034 projects

Projects that are alternatives of or similar to StarWarsArrays.jl

dark-mode-example
Simple and fun dark-mode detection. JavaScript with a user mode toggle.
Stars: ✭ 27 (-70.97%)
Mutual labels:  fun, star-wars
JediKnightPlus
Game modification for Jedi Knight II: Jedi Outcast Multiplayer with useful stuff and custom features
Stars: ✭ 19 (-79.57%)
Mutual labels:  star-wars
crazy-canvas
Simple canvas playground
Stars: ✭ 12 (-87.1%)
Mutual labels:  fun
mango
A @discord bot that has lots of features 🥭
Stars: ✭ 22 (-76.34%)
Mutual labels:  fun
extreme-carpaccio
Slicing and coding game
Stars: ✭ 116 (+24.73%)
Mutual labels:  fun
KotOR.js
A remake of the Odyssey Game Engine that powered KotOR I & II written in JavaScript
Stars: ✭ 43 (-53.76%)
Mutual labels:  starwars
map-replace.js
a VSCode extension that replace selected string with custom JavaScript function.
Stars: ✭ 25 (-73.12%)
Mutual labels:  fun
penney
Penney's Game
Stars: ✭ 14 (-84.95%)
Mutual labels:  fun
observations
Beobachtungen und Betrachtungen rund um das Informatik-Studium an der HSLU
Stars: ✭ 45 (-51.61%)
Mutual labels:  fun
is-odd-or-even
Determines if a given number is odd or even.
Stars: ✭ 15 (-83.87%)
Mutual labels:  fun
xkcd-excuse-generator
Serverless image generator that uses XKCD comic as basis for _all_ excuses!
Stars: ✭ 63 (-32.26%)
Mutual labels:  joke
perseverance-parachute-generator
Generate your own Perseverance parachute-style secret codes!
Stars: ✭ 17 (-81.72%)
Mutual labels:  fun
IA-Imperial-Commander
This is a repository for concept and documentation of a companion app for FFG's Star Wars: Imperial Assault.
Stars: ✭ 16 (-82.8%)
Mutual labels:  star-wars
yii2-elasticsearch
Elasticsearch client based on official Elasticsearch PHP library
Stars: ✭ 14 (-84.95%)
Mutual labels:  indexing
ArrayInterface.jl
Designs for new Base array interface primitives, used widely through scientific machine learning (SciML) and other organizations
Stars: ✭ 111 (+19.35%)
Mutual labels:  arrays
jedi-faker
Faker extension for Star Wars junkie
Stars: ✭ 15 (-83.87%)
Mutual labels:  star-wars
php-collections
A collection library for php
Stars: ✭ 34 (-63.44%)
Mutual labels:  arrays
C-Complete-practice
This repository will contains C programs from beginners to advance level
Stars: ✭ 59 (-36.56%)
Mutual labels:  arrays
SWLOR NWN
Star Wars: Legends of the Old Republic server code, a persistent world for Neverwinter Nights
Stars: ✭ 31 (-66.67%)
Mutual labels:  star-wars
Ninite
A PowerShell Client for Ninite
Stars: ✭ 17 (-81.72%)
Mutual labels:  geek

StarWarsArrays.jl

Build Status Codecov Coveralls

Introduction

StarWarsArrays.jl is a Julia package to provide arrays indexed as the order of the Star Wars movies. Thus, index 4 points to the first element of the parent array, index 2 points to its fifth element, and index 9 points to the nineth element. The ordering applies to all dimensions of the array. StarWarsArrays.jl also supports Machete Order.

This package is inspired by the Reddit thread "Oof level of an array, nice.".

Installation

The latest version of StarWarsArrays.jl is available for Julia v1.0 and later releases, and can be installed with Julia's built-in package manager. In a Julia session, after entering the package manager mode with ], run the command

pkg> add https://github.com/giordano/StarWarsArrays.jl

Usage

julia> using StarWarsArrays

julia> v = StarWarsArray(collect(1:9))
9-element StarWarsArray{Int64,1,Array{Int64,1},StarWarsArrays.OriginalOrder}:
 4
 5
 6
 1
 2
 3
 7
 8
 9

julia> v[4]
1

julia> v[2]
5

julia> v[9]
9

julia> v[5] = 42
42

julia> v
9-element StarWarsArray{Int64,1,Array{Int64,1},StarWarsArrays.OriginalOrder}:
  4
  5
  6
  1
 42
  3
  7
  8
  9

julia> m = StarWarsArray(reshape(collect(1:81), 9, 9))
9×9 StarWarsArray{Int64,2,Array{Int64,2},StarWarsArrays.OriginalOrder}:
 31  40  49  4  13  22  58  67  76
 32  41  50  5  14  23  59  68  77
 33  42  51  6  15  24  60  69  78
 28  37  46  1  10  19  55  64  73
 29  38  47  2  11  20  56  65  74
 30  39  48  3  12  21  57  66  75
 34  43  52  7  16  25  61  70  79
 35  44  53  8  17  26  62  71  80
 36  45  54  9  18  27  63  72  81

julia> m[5]
2

julia> m[5,1]
29

julia> m[5,4]
2

julia> m[5,8]
65

julia> m[3,2] = -1
-1

julia> m
9×9 StarWarsArray{Int64,2,Array{Int64,2},StarWarsArrays.OriginalOrder}:
 31  40  49  4  13  22  58  67  76
 32  41  50  5  14  23  59  68  77
 33  -1  51  6  15  24  60  69  78
 28  37  46  1  10  19  55  64  73
 29  38  47  2  11  20  56  65  74
 30  39  48  3  12  21  57  66  75
 34  43  52  7  16  25  61  70  79
 35  44  53  8  17  26  62  71  80
 36  45  54  9  18  27  63  72  81

The second argument of StarWarsArray allows you to specify the order. Here is how to use MacheteOrder:

julia> using StarWarsArrays

julia> v = StarWarsArray(collect(1:9), MacheteOrder)
8-element view(::Array{Int64,1}, [3, 4, 1, 2, 5, 6, 7, 8]) with eltype Int64:
 3
 4
 1
 2
 5
 6
 7
 8

julia> v[4]
1

julia> v[3]
4

julia> v[1]
ERROR: StarWarsError: there is no episode 1 in order MacheteOrder
[...]

julia> m = StarWarsArray(reshape(collect(1:81), 9, 9), MacheteOrder)
8×8 view(::Array{Int64,2}, [3, 4, 1, 2, 5, 6, 7, 8], [3, 4, 1, 2, 5, 6, 7, 8]) with eltype Int64:
 21  30  3  12  39  48  57  66
 22  31  4  13  40  49  58  67
 19  28  1  10  37  46  55  64
 20  29  2  11  38  47  56  65
 23  32  5  14  41  50  59  68
 24  33  6  15  42  51  60  69
 25  34  7  16  43  52  61  70
 26  35  8  17  44  53  62  71

julia> m[5,4]
2

julia> m[2,9]
66

julia> m[1,6]
ERROR: StarWarsError: there is no episode 1 in MacheteOrder
[...]

License

The StarWarsArrays.jl package is licensed under the MIT "Expat" License. The original author is Mosè Giordano.

Disclaimer

Star Wars is the sole and exclusive property of Lucasfilm Limited.

StarWarsArrays.jl is in no way affiliated with or endorsed by Lucasfilm Limited or any of its subsidiaries, employees, or associates. StarWarsArrays.jl offers no suggestion that the work presented on this web page is "official" or produced or sanctioned by the owner or any licensees of the aforementioned trademark.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].